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 |
void | Resize (size_t size) |
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.
yaze::gfx::SnesPalette::SnesPalette | ( | char * | data | ) |
Definition at line 19 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 31 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 43 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
yaze::gfx::SnesPalette::SnesPalette | ( | const std::vector< uint16_t > & | colors | ) |
Definition at line 51 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
yaze::gfx::SnesPalette::SnesPalette | ( | const std::vector< SnesColor > & | colors | ) |
Definition at line 59 of file snes_palette.cc.
References colors_, kMaxColors, and size_.
yaze::gfx::SnesPalette::SnesPalette | ( | const std::vector< ImVec4 > & | colors | ) |
Definition at line 67 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 |
Definition at line 143 of file snes_palette.h.
Referenced by yaze::zelda3::palette_internal::SetColorsPalette().
|
inline |
Definition at line 144 of file snes_palette.h.
References size_.
Referenced by yaze::gfx::BppFormatManager::AnalyzeGraphicsSheet(), yaze::gfx::Bitmap::ApplyStoredPalette(), yaze::gfx::GraphicsOptimizer::CalculateColorEfficiency(), yaze::gfx::GraphicsOptimizer::CountUsedColors(), yaze::gfx::CreatePaletteGroupFromLargePalette(), yaze::gui::DisplayEditablePalette(), yaze::editor::DisplayPalette(), yaze::gui::DisplayPalette(), yaze::gui::PaletteWidget::DrawPaletteAnalysis(), yaze::editor::GraphicsEditor::DrawPaletteControls(), yaze::editor::anonymous_namespace{gfx_group_editor.cc}::DrawPaletteFromPaletteGroup(), yaze::gui::PaletteWidget::DrawPaletteGrid(), yaze::editor::PaletteEditor::DrawPaletteGroup(), yaze::editor::PaletteEditor::EditColorInPalette(), yaze::gfx::Bitmap::InvalidatePaletteCache(), yaze::editor::Tile16Editor::LoadTile8(), yaze::gfx::BppFormatManager::OptimizePaletteForFormat(), yaze::editor::Tile16Editor::RefreshAllPalettes(), yaze::editor::Tile16Editor::RegenerateTile16BitmapFromROM(), yaze::gui::BppFormatUI::RenderAnalysisPanel(), yaze::gui::BppFormatUI::RenderSheetAnalysis(), yaze::editor::PaletteEditor::ResetColorToOriginal(), Resize(), yaze::gui::PaletteWidget::RestorePaletteBackup(), yaze::Rom::SavePalette(), yaze::gui::SelectablePalettePipeline(), yaze::editor::Tile16Editor::set_palette(), set_size(), yaze::editor::Tile16Editor::SetCurrentTile(), yaze::gfx::Bitmap::SetPalette(), yaze::gfx::Bitmap::SetPaletteWithTransparent(), yaze::gui::PaletteWidget::ShowColorAnalysis(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::test::TEST(), yaze::editor::Tile16Editor::UpdateTile16Edit(), and yaze::editor::Tile16Editor::UpdateTile8Palette().
|
inline |
Definition at line 145 of file snes_palette.h.
References size_.
Referenced by yaze::gfx::Bitmap::ApplyStoredPalette(), yaze::gfx::Bitmap::Create(), yaze::editor::anonymous_namespace{gfx_group_editor.cc}::DrawPaletteFromPaletteGroup(), yaze::LoadAllGraphicsData(), yaze::test::TEST(), and yaze::test::TEST().
|
inline |
|
inline |
Definition at line 150 of file snes_palette.h.
References colors_.
|
inline |
Definition at line 151 of file snes_palette.h.
|
inline |
Definition at line 152 of file snes_palette.h.
References colors_.
|
inline |
Definition at line 153 of file snes_palette.h.
|
inline |
Definition at line 155 of file snes_palette.h.
References colors_, kMaxColors, and size_.
Referenced by yaze::gfx::CreatePaletteGroupFromColFile(), yaze::gfx::CreatePaletteGroupFromLargePalette(), yaze::gfx::GraphicsOptimizationBenchmarks::CreateTestPalette(), yaze::zelda3::DungeonRenderingIntegrationTest::CreateTestPalette(), yaze::zelda3::ObjectRenderingTest::CreateTestPalette(), yaze::test::DungeonObjectRenderingTests::CreateTestPaletteGroup(), yaze::gfx::BppFormatManager::OptimizePaletteForFormat(), 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 161 of file snes_palette.h.
References colors_, and size_.
Referenced by yaze::gui::DisplayEditablePalette(), and yaze::test::TEST().
|
inline |
Definition at line 167 of file snes_palette.h.
References size_.
Referenced by yaze::gui::CanvasPaletteManager::Clear(), yaze::gfx::BppFormatManager::ClearCache(), and yaze::test::TEST().
|
inline |
Definition at line 169 of file snes_palette.h.
References AddColor(), colors_, and size_.
Referenced by yaze::test::TEST().
|
inline |
Definition at line 181 of file snes_palette.h.
|
inline |
Definition at line 193 of file snes_palette.h.
|
staticconstexpr |
Definition at line 129 of file snes_palette.h.
Referenced by AddColor(), SnesPalette(), SnesPalette(), SnesPalette(), and SnesPalette().
|
private |
Definition at line 196 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 197 of file snes_palette.h.
Referenced by AddColor(), clear(), empty(), end(), end(), operator==(), Resize(), set_size(), size(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), SnesPalette(), sub_palette(), and UpdateColor().