Class PaletteController¶
Defined in File palettecontroller.h
Class Documentation¶
-
class
PaletteController
¶ -
Public Functions
-
PaletteController
()¶
-
~PaletteController
()¶
-
PaletteController::PaletteWrapper &
add_palette
(QString name, Colors::RGB colors[], uint8_t num_colors, PaletteType type, const Colors::RGB &base_color, const Colors::RGB &target_color, bool mirror = false, uint8_t start = 0, uint8_t length = 0)¶ Adds a palette to the list.
- Return
New palette.
- Parameters
name
: Palette name.colors
: Colors in the palette.num_colors
: Number of colors in the palette.type
: The type of Palette.mirror
: Whether to mirror the palette.
-
QString
check_palette_name
(QString name)¶ Checks the given string against the existing list of Palettes. If a Palette is already using the name, a number is appended to the end of the name.
- Return
Same name if the name is unused, or a new name if it’s in use.
- Parameters
name
: Name to test.
-
Colors::RGB
deserialize_color
(const QString &string)¶ Converts a serialized color into an RGB object.
- Return
Deserialized color.
- Parameters
string
: Serialized color.
-
int
find
(Colors::RGB *colors, int num_colors)¶ Searches for a Palette with the given colors.
- Return
Index of the Palette, or -1 if not found.
- Parameters
colors
: Color array to match.num_colors
: Number of colors in the array.
-
PaletteController::PaletteWrapper &
get_palette
(uint8_t index)¶ Returns the palette at the specified index.
- Return
Palette.
- Parameters
index
: Palette index.
-
PaletteController::PaletteWrapper *
get_palette
(const QString &name)¶ Gets the palette with the specified name.
- Return
Palette.
- Parameters
name
: Palette name.
-
std::vector<PaletteController::PaletteWrapper> *
get_palettes
()¶ Gets the full list of palettes.
- Return
Palette list.
-
void
initialize_palettes
()¶ Resets the palette list to defaults.
-
void
load_palettes
()¶ Loads custom palettes from settings
-
void
remove_palette
(uint8_t index)¶ Removes the palette at the specified index.
- Parameters
index
: Palette index.
-
void
save_palettes
()¶ Saves Palettes to settings.
-
QString
serialize_color
(Colors::RGB &color)¶ Converts a color into a string for serialization.
- Return
Serialized string.
- Parameters
color
: Color to serialize.
-
struct
PaletteWrapper
¶ Wrapper class for PixelMaestro Palettes.
Public Functions
-
bool
operator==
(Colors::RGB *section_colors)¶
-
PaletteWrapper
(QString new_name, Colors::RGB new_colors[], uint8_t num_colors, PaletteType type, const Colors::RGB &base_color, const Colors::RGB &target_color, bool mirror, uint8_t start, uint8_t length)¶ Constructor. Provides storage for colors (which is why we pass colors directly instead of a Palette object.)
- Parameters
new_name
: Palette name.new_colors
: Palette colors.num_colors
: Number of colors in the Palette.type
: The type of Palette.base_color
: The Palette’s initial color.target_color
: The Palette’s target color.mirror
: For scaling Palettes, whether to mirror the colors.start
: For comets, where the body of the comet starts.length
: For comets, where the tail of the comet ends.
Public Members
-
Colors::RGB
base_color
¶
-
Colors::RGB
target_color
¶
-
bool
mirror
¶
-
QString
name
= ""¶
-
uint8_t
start
= 0¶
-
uint8_t
length
= 0¶
-
PaletteType
type
= PaletteType::Blank¶
-
Palette
palette
¶
-
bool
-