Represents a palette of colors for the Super Nintendo Entertainment System (SNES). More...
#include <snes_palette.h>
Public Types | |
using | ColorArray = std::array<SnesColor, kMaxColors> |
Public Member Functions | |
SnesPalette () | |
SnesPalette (char *data) | |
SnesPalette (const unsigned char *snes_pal) | |
SnesPalette (const char *data, size_t length) | |
SnesPalette (const std::vector< uint16_t > &colors) | |
SnesPalette (const std::vector< SnesColor > &colors) | |
SnesPalette (const std::vector< ImVec4 > &colors) | |
const SnesColor & | operator[] (size_t index) const |
SnesColor & | operator[] (size_t index) |
void | set_size (size_t size) |
size_t | size () const |
bool | empty () const |
auto | begin () |
auto | end () |
auto | begin () const |
auto | end () const |
void | AddColor (const SnesColor &color) |
void | UpdateColor (size_t index, const SnesColor &color) |
void | clear () |
SnesPalette | sub_palette (size_t start, size_t length) const |
bool | operator== (const SnesPalette &other) const |
bool | operator!= (const SnesPalette &other) const |
Static Public Attributes | |
static constexpr size_t | kMaxColors = 256 |
Private Attributes | |
ColorArray | colors_ |
size_t | size_ |
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
The SnesPalette
class provides functionality to create, modify, and access colors in an SNES palette. It supports various constructors to initialize the palette with different types of data. The palette can be modified by adding or changing colors, and it can be cleared to remove all colors. Colors in the palette can be accessed using index-based access. The class also provides a method to create a sub-palette by selecting a range of colors from the original palette.
Definition at line 127 of file snes_palette.h.
using yaze::gfx::SnesPalette::ColorArray = std::array<SnesColor, kMaxColors> |
Definition at line 130 of file snes_palette.h.
|
inline |
Definition at line 132 of file snes_palette.h.
References size_.
Referenced by operator!=(), operator==(), and sub_palette().
yaze::gfx::SnesPalette::SnesPalette | ( | char * | data | ) |
Definition at line 20 of file snes_palette.cc.
References snes_color::blue, colors_, yaze::gfx::ConvertSnesToRgb(), snes_color::green, snes_color::red, yaze::gfx::SnesColor::set_rgb(), yaze::gfx::SnesColor::set_snes(), size_, and yaze::gfx::SnesColor::snes().
yaze::gfx::SnesPalette::SnesPalette | ( | const unsigned char * | snes_pal | ) |
Definition at line 32 of file snes_palette.cc.
References snes_color::blue, colors_, yaze::gfx::ConvertSnesToRgb(), snes_color::green, snes_color::red, yaze::gfx::SnesColor::set_rgb(), yaze::gfx::SnesColor::set_snes(), size_, and yaze::gfx::SnesColor::snes().
yaze::gfx::SnesPalette::SnesPalette | ( | const char * | data, |
size_t | length ) |
Definition at line 44 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
yaze::gfx::SnesPalette::SnesPalette | ( | const std::vector< uint16_t > & | colors | ) |
Definition at line 52 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
yaze::gfx::SnesPalette::SnesPalette | ( | const std::vector< SnesColor > & | colors | ) |
Definition at line 60 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
yaze::gfx::SnesPalette::SnesPalette | ( | const std::vector< ImVec4 > & | colors | ) |
Definition at line 68 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
|
inline |
Definition at line 140 of file snes_palette.h.
References colors_.
|
inline |
Definition at line 141 of file snes_palette.h.
References colors_.
|
inline |
|
inline |
Definition at line 144 of file snes_palette.h.
References size_.
Referenced by yaze::gfx::CreatePaletteGroupFromLargePalette(), yaze::gui::DisplayEditablePalette(), yaze::editor::DisplayPalette(), yaze::gui::DisplayPalette(), yaze::editor::anonymous_namespace{gfx_group_editor.cc}::DrawPaletteFromPaletteGroup(), yaze::editor::PaletteEditor::DrawPaletteGroup(), yaze::editor::PaletteEditor::EditColorInPalette(), yaze::editor::PaletteEditor::ResetColorToOriginal(), yaze::Rom::SavePalette(), yaze::gui::SelectablePalettePipeline(), set_size(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), and yaze::test::TEST().
|
inline |
Definition at line 145 of file snes_palette.h.
References size_.
Referenced by yaze::editor::anonymous_namespace{gfx_group_editor.cc}::DrawPaletteFromPaletteGroup(), yaze::test::TEST(), and yaze::test::TEST().
|
inline |
Definition at line 147 of file snes_palette.h.
References colors_.
|
inline |
Definition at line 148 of file snes_palette.h.
|
inline |
Definition at line 149 of file snes_palette.h.
References colors_.
|
inline |
Definition at line 150 of file snes_palette.h.
|
inline |
Definition at line 152 of file snes_palette.h.
References colors_, kMaxColors, and size_.
Referenced by yaze::gfx::CreatePaletteGroupFromColFile(), yaze::gfx::CreatePaletteGroupFromLargePalette(), sub_palette(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), and yaze::test::TEST().
|
inline |
Definition at line 158 of file snes_palette.h.
References colors_, and size_.
Referenced by yaze::gui::DisplayEditablePalette(), and yaze::test::TEST().
|
inline |
|
inline |
Definition at line 166 of file snes_palette.h.
References AddColor(), colors_, size_, and SnesPalette().
Referenced by yaze::test::TEST().
|
inline |
Definition at line 178 of file snes_palette.h.
References colors_, size_, and SnesPalette().
|
inline |
Definition at line 190 of file snes_palette.h.
References SnesPalette().
|
staticconstexpr |
Definition at line 129 of file snes_palette.h.
Referenced by AddColor(), SnesPalette(), SnesPalette(), SnesPalette(), and SnesPalette().
|
private |
Definition at line 193 of file snes_palette.h.
Referenced by AddColor(), begin(), begin(), end(), end(), operator==(), operator[](), operator[](), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), sub_palette(), and UpdateColor().
|
private |
Definition at line 194 of file snes_palette.h.
Referenced by AddColor(), clear(), empty(), end(), end(), operator==(), set_size(), size(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), sub_palette(), and UpdateColor().