Add "Alpha & Opacity" section to Preferences > Color (fix #1544)

This commit is contained in:
Martín Capello 2024-01-08 15:19:25 -03:00
parent 9d69cb8dfe
commit d331195c4c
7 changed files with 48 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Aseprite -->
<!-- Copyright (C) 2018-2023 Igara Studio S.A. -->
<!-- Copyright (C) 2018-2024 Igara Studio S.A. -->
<!-- Copyright (C) 2014-2018 David Capello -->
<preferences>
@ -133,6 +133,10 @@
<value id="BILINEAR_MIPMAP" value="2" />
<value id="TRILINEAR_MIPMAP" value="3" />
</enum>
<enum id="AlphaRange">
<value id="EIGHT_BIT" value="0" />
<value id="PERCENTAGE" value="1" />
</enum>
</types>
<global>
@ -431,6 +435,10 @@
<option id="window_profile" type="WindowColorProfile" default="WindowColorProfile::MONITOR" />
<option id="window_profile_name" type="std::string" />
</section>
<section id="range">
<option id="alpha" type="AlphaRange" default="AlphaRange::EIGHT_BIT" />
<option id="opacity" type="AlphaRange" default="AlphaRange::PERCENTAGE" />
</section>
<section id="canvas_size">
<option id="trim_outside" type="bool" default="false" />
</section>

View File

@ -1,5 +1,5 @@
# Aseprite
# Copyright (C) 2018-2023 Igara Studio S.A.
# Copyright (C) 2018-2024 Igara Studio S.A.
# Copyright (C) 2016-2018 David Capello
#
# This work is licensed under the Creative Commons Attribution 4.0
@ -1469,6 +1469,11 @@ use_embedded_cs = Use embedded profile
convert_cs = Convert to working RGB space
assign_cs = Assign working RGB space
ask_cs = Ask
alpha_and_opacity = Alpha && Opacity
alpha_range = Alpha Range:
opacity_range = Opacity Range:
8bit_value = 0-255
percentage = 0%-100%
available_themes = Available Themes
extension_themes = Extension Themes
select_theme = &Select

View File

@ -1,5 +1,5 @@
<!-- Aseprite -->
<!-- Copyright (C) 2020-2023 by Igara Studio S.A. -->
<!-- Copyright (C) 2020-2024 by Igara Studio S.A. -->
<!-- Copyright (C) 2001-2016 by David Capello -->
<gui>
<window id="cel_properties" text="@.title">

View File

@ -1,5 +1,5 @@
<!-- Aseprite -->
<!-- Copyright (C) 2018-2023 Igara Studio S.A. -->
<!-- Copyright (C) 2018-2024 Igara Studio S.A. -->
<!-- Copyright (C) 2001-2018 David Capello -->
<gui>
<window id="options" text="@.title">
@ -192,7 +192,7 @@
<separator text="@.section_color" horizontal="true" />
<check text="@.color_management" id="color_management" pref="color.manage" />
<grid columns="2">
<grid columns="2">
<label text="@.window_cs" id="window_cs_label" />
<combobox id="window_cs">
<listitem text="@.use_monitor_cs" />
@ -213,20 +213,34 @@
<listitem text="@.convert_cs" />
<listitem text="@.assign_cs" />
<listitem text="@.ask_cs" />
</combobox>
</combobox>
<label text="@.missing_cs" id="missing_cs_label" />
<combobox id="missing_cs">
<listitem text="@.disable_cs" />
<listitem text="@.assign_cs" />
<listitem text="@.ask_cs" />
</combobox>
</grid>
</combobox>
</grid>
<hbox>
<hbox expansive="true" />
<hbox>
<hbox expansive="true" />
<button id="reset_color_management" text="@general.reset" minwidth="60" />
</hbox>
</hbox>
<separator text="@.alpha_and_opacity" horizontal="true" />
<grid columns="2">
<label text="@.alpha_range" id="alpha_range_label" />
<combobox id="alpha">
<listitem text="@.8bit_value" />
<listitem text="@.percentage" />
</combobox>
<label text="@.opacity_range" id="opacity_range_label" />
<combobox id="opacity">
<listitem text="@.8bit_value" />
<listitem text="@.percentage" />
</combobox>
</grid>
</vbox>
<!-- Editor -->

View File

@ -1,5 +1,5 @@
# Aseprite
# Copyright (C) 2018-2023 Igara Studio S.A.
# Copyright (C) 2018-2024 Igara Studio S.A.
# Copyright (C) 2001-2018 David Capello
# Generate a ui::Widget for each widget in a XML file

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2023 Igara Studio S.A.
// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -776,6 +776,9 @@ public:
}
update_windows_color_profile_from_preferences();
m_pref.range.alpha(static_cast<app::gen::AlphaRange>(alpha()->getSelectedItemIndex()));
m_pref.range.opacity(static_cast<app::gen::AlphaRange>(opacity()->getSelectedItemIndex()));
// Change sprite grid bounds
if (m_context &&
m_context->activeDocument() &&
@ -1073,6 +1076,9 @@ private:
filesWithCs()->setEnabled(state);
missingCsLabel()->setEnabled(state);
missingCs()->setEnabled(state);
alpha()->setSelectedItemIndex(static_cast<int>(m_pref.range.alpha()));
opacity()->setSelectedItemIndex(static_cast<int>(m_pref.range.opacity()));
}
void onResetColorManagement() {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2019-2024 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -334,6 +334,7 @@ FOR_ENUM(app::gen::SymmetryMode)
FOR_ENUM(app::gen::TimelinePosition)
FOR_ENUM(app::gen::ToGrayAlgorithm)
FOR_ENUM(app::gen::WindowColorProfile)
FOR_ENUM(app::gen::AlphaRange)
FOR_ENUM(app::tools::ColorFromTo)
FOR_ENUM(app::tools::DynamicSensor)
FOR_ENUM(app::tools::FreehandAlgorithm)