mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Save last used dithering algorithm converting RGB -> Indexed
This commit is contained in:
parent
b6d07d995f
commit
495058e8ff
@ -236,6 +236,7 @@
|
||||
</section>
|
||||
<section id="quantization">
|
||||
<option id="with_alpha" type="bool" default="true" />
|
||||
<option id="dithering_algorithm" type="std::string" />
|
||||
</section>
|
||||
<section id="eyedropper" text="Editor">
|
||||
<option id="channel" type="EyedropperChannel" default="EyedropperChannel::COLOR_ALPHA" />
|
||||
|
@ -196,6 +196,15 @@ public:
|
||||
|
||||
m_ditheringSelector = new DitheringSelector(DitheringSelector::SelectBoth);
|
||||
m_ditheringSelector->setExpansive(true);
|
||||
|
||||
// Select default dithering method
|
||||
{
|
||||
int index = m_ditheringSelector->findItemIndex(
|
||||
Preferences::instance().quantization.ditheringAlgorithm());
|
||||
if (index >= 0)
|
||||
m_ditheringSelector->setSelectedItemIndex(index);
|
||||
}
|
||||
|
||||
m_ditheringSelector->Change.connect(
|
||||
base::Bind<void>(&ColorModeWindow::onDithering, this));
|
||||
ditheringPlaceholder()->addChild(m_ditheringSelector);
|
||||
@ -239,6 +248,15 @@ public:
|
||||
return flatten()->isSelected();
|
||||
}
|
||||
|
||||
// Save the dithering method used for the future
|
||||
void saveDitheringAlgorithm() {
|
||||
if (m_ditheringSelector) {
|
||||
if (auto item = m_ditheringSelector->getSelectedItem()) {
|
||||
Preferences::instance().quantization.ditheringAlgorithm(item->text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void stop() {
|
||||
@ -466,6 +484,8 @@ void ChangePixelFormatCommand::onExecute(Context* context)
|
||||
m_ditheringAlgorithm = window.ditheringAlgorithm();
|
||||
m_ditheringMatrix = window.ditheringMatrix();
|
||||
flatten = window.flattenEnabled();
|
||||
|
||||
window.saveDitheringAlgorithm();
|
||||
}
|
||||
#endif // ENABLE_UI
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user