mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Add options to sort the palette by RGBA channels
This commit is contained in:
parent
6aeee0b8fa
commit
ba4c34a70f
@ -348,6 +348,10 @@ void ColorBar::onPaletteButtonClick()
|
||||
sat("Sort by Saturation"),
|
||||
bri("Sort by Brightness"),
|
||||
lum("Sort by Luminance"),
|
||||
red("Sort by Red"),
|
||||
grn("Sort by Green"),
|
||||
blu("Sort by Blue"),
|
||||
alp("Sort by Alpha"),
|
||||
asc("Ascending"),
|
||||
des("Descending");
|
||||
menu.addChild(&rev);
|
||||
@ -358,6 +362,11 @@ void ColorBar::onPaletteButtonClick()
|
||||
menu.addChild(&bri);
|
||||
menu.addChild(&lum);
|
||||
menu.addChild(new ui::MenuSeparator);
|
||||
menu.addChild(&red);
|
||||
menu.addChild(&grn);
|
||||
menu.addChild(&blu);
|
||||
menu.addChild(&alp);
|
||||
menu.addChild(new ui::MenuSeparator);
|
||||
menu.addChild(&asc);
|
||||
menu.addChild(&des);
|
||||
|
||||
@ -370,6 +379,10 @@ void ColorBar::onPaletteButtonClick()
|
||||
sat.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::SATURATION));
|
||||
bri.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::VALUE));
|
||||
lum.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::LUMA));
|
||||
red.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::RED));
|
||||
grn.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::GREEN));
|
||||
blu.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::BLUE));
|
||||
alp.Click.connect(Bind<void>(&ColorBar::onSortBy, this, SortPaletteBy::ALPHA));
|
||||
asc.Click.connect(Bind<void>(&ColorBar::setAscending, this, true));
|
||||
des.Click.connect(Bind<void>(&ColorBar::setAscending, this, false));
|
||||
|
||||
|
@ -61,6 +61,11 @@ struct PalEntryWithIndexPredicate {
|
||||
value2 = rgba_getb(c2);
|
||||
break;
|
||||
|
||||
case SortPaletteBy::ALPHA:
|
||||
value1 = rgba_geta(c1);
|
||||
value2 = rgba_geta(c2);
|
||||
break;
|
||||
|
||||
case SortPaletteBy::HUE:
|
||||
case SortPaletteBy::SATURATION:
|
||||
case SortPaletteBy::VALUE: {
|
||||
|
@ -17,6 +17,7 @@ namespace doc {
|
||||
RED,
|
||||
GREEN,
|
||||
BLUE,
|
||||
ALPHA,
|
||||
HUE,
|
||||
SATURATION,
|
||||
VALUE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user