yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gfx::SnesPalette Class Reference

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 SnesColoroperator[] (size_t index) const
 
SnesColoroperator[] (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_
 

Detailed Description

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.

Member Typedef Documentation

◆ ColorArray

Definition at line 130 of file snes_palette.h.

Constructor & Destructor Documentation

◆ SnesPalette() [1/7]

yaze::gfx::SnesPalette::SnesPalette ( )
inline

Definition at line 132 of file snes_palette.h.

◆ SnesPalette() [2/7]

yaze::gfx::SnesPalette::SnesPalette ( char *  data)

◆ SnesPalette() [3/7]

yaze::gfx::SnesPalette::SnesPalette ( const unsigned char *  snes_pal)

◆ SnesPalette() [4/7]

yaze::gfx::SnesPalette::SnesPalette ( const char *  data,
size_t  length 
)

Definition at line 43 of file snes_palette.cc.

References colors_, kMaxColors, and size_.

◆ SnesPalette() [5/7]

yaze::gfx::SnesPalette::SnesPalette ( const std::vector< uint16_t > &  colors)

Definition at line 51 of file snes_palette.cc.

References colors_, kMaxColors, and size_.

◆ SnesPalette() [6/7]

yaze::gfx::SnesPalette::SnesPalette ( const std::vector< SnesColor > &  colors)

Definition at line 59 of file snes_palette.cc.

References colors_, kMaxColors, and size_.

◆ SnesPalette() [7/7]

yaze::gfx::SnesPalette::SnesPalette ( const std::vector< ImVec4 > &  colors)

Definition at line 67 of file snes_palette.cc.

References colors_, kMaxColors, and size_.

Member Function Documentation

◆ operator[]() [1/2]

const SnesColor & yaze::gfx::SnesPalette::operator[] ( size_t  index) const
inline

Definition at line 140 of file snes_palette.h.

References colors_.

◆ operator[]() [2/2]

SnesColor & yaze::gfx::SnesPalette::operator[] ( size_t  index)
inline

Definition at line 141 of file snes_palette.h.

References colors_.

◆ set_size()

void yaze::gfx::SnesPalette::set_size ( size_t  size)
inline

Definition at line 143 of file snes_palette.h.

References size(), and size_.

Referenced by yaze::zelda3::palette_internal::SetColorsPalette().

Here is the call graph for this function:

◆ size()

size_t yaze::gfx::SnesPalette::size ( ) const
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().

◆ empty()

◆ Resize()

void yaze::gfx::SnesPalette::Resize ( size_t  size)
inline

Definition at line 148 of file snes_palette.h.

References size(), and size_.

Here is the call graph for this function:

◆ begin() [1/2]

auto yaze::gfx::SnesPalette::begin ( )
inline

Definition at line 150 of file snes_palette.h.

References colors_.

◆ end() [1/2]

auto yaze::gfx::SnesPalette::end ( )
inline

Definition at line 151 of file snes_palette.h.

References colors_, and size_.

◆ begin() [2/2]

auto yaze::gfx::SnesPalette::begin ( ) const
inline

Definition at line 152 of file snes_palette.h.

References colors_.

◆ end() [2/2]

auto yaze::gfx::SnesPalette::end ( ) const
inline

Definition at line 153 of file snes_palette.h.

References colors_, and size_.

◆ AddColor()

◆ UpdateColor()

void yaze::gfx::SnesPalette::UpdateColor ( size_t  index,
const SnesColor color 
)
inline

Definition at line 161 of file snes_palette.h.

References colors_, and size_.

Referenced by yaze::gui::DisplayEditablePalette(), and yaze::test::TEST().

◆ clear()

void yaze::gfx::SnesPalette::clear ( )
inline

◆ sub_palette()

SnesPalette yaze::gfx::SnesPalette::sub_palette ( size_t  start,
size_t  length 
) const
inline

Definition at line 169 of file snes_palette.h.

References AddColor(), colors_, and size_.

Referenced by yaze::test::TEST().

Here is the call graph for this function:

◆ operator==()

bool yaze::gfx::SnesPalette::operator== ( const SnesPalette other) const
inline

Definition at line 181 of file snes_palette.h.

References colors_, and size_.

◆ operator!=()

bool yaze::gfx::SnesPalette::operator!= ( const SnesPalette other) const
inline

Definition at line 193 of file snes_palette.h.

Member Data Documentation

◆ kMaxColors

constexpr size_t yaze::gfx::SnesPalette::kMaxColors = 256
staticconstexpr

Definition at line 129 of file snes_palette.h.

Referenced by AddColor(), SnesPalette(), SnesPalette(), SnesPalette(), and SnesPalette().

◆ colors_

◆ size_

size_t yaze::gfx::SnesPalette::size_
private

The documentation for this class was generated from the following files: