1 | // Aseprite |
---|---|
2 | // Copyright (C) 2020-2021 Igara Studio S.A. |
3 | // |
4 | // This program is distributed under the terms of |
5 | // the End-User License Agreement for Aseprite. |
6 | |
7 | #ifdef HAVE_CONFIG_H |
8 | #include "config.h" |
9 | #endif |
10 | |
11 | #include "app/ui/rgbmap_algorithm_selector.h" |
12 | |
13 | #include "app/i18n/strings.h" |
14 | |
15 | namespace app { |
16 | |
17 | RgbMapAlgorithmSelector::RgbMapAlgorithmSelector() |
18 | { |
19 | // addItem() must match the RgbMapAlgorithm enum |
20 | static_assert(int(doc::RgbMapAlgorithm::DEFAULT) == 0 && |
21 | int(doc::RgbMapAlgorithm::RGB5A3) == 1 && |
22 | int(doc::RgbMapAlgorithm::OCTREE) == 2, |
23 | "Unexpected doc::RgbMapAlgorithm values"); |
24 | |
25 | addItem(Strings::rgbmap_algorithm_selector_default()); |
26 | addItem(Strings::rgbmap_algorithm_selector_rgb5a3()); |
27 | addItem(Strings::rgbmap_algorithm_selector_octree()); |
28 | |
29 | algorithm(doc::RgbMapAlgorithm::DEFAULT); |
30 | } |
31 | |
32 | doc::RgbMapAlgorithm RgbMapAlgorithmSelector::algorithm() |
33 | { |
34 | return (doc::RgbMapAlgorithm)getSelectedItemIndex(); |
35 | } |
36 | |
37 | void RgbMapAlgorithmSelector::algorithm(const doc::RgbMapAlgorithm mapAlgo) |
38 | { |
39 | setSelectedItemIndex((int)mapAlgo); |
40 | } |
41 | |
42 | } // namespace app |
43 |