yaze 0.2.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
 
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.

References size_.

Referenced by operator!=(), operator==(), and sub_palette().

◆ 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 44 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 52 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 60 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 68 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_.

Here is the call graph for this function:

◆ size()

◆ empty()

bool yaze::gfx::SnesPalette::empty ( ) const
inline

◆ begin() [1/2]

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

Definition at line 147 of file snes_palette.h.

References colors_.

◆ end() [1/2]

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

Definition at line 148 of file snes_palette.h.

References colors_, and size_.

◆ begin() [2/2]

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

Definition at line 149 of file snes_palette.h.

References colors_.

◆ end() [2/2]

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

Definition at line 150 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 158 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

Definition at line 164 of file snes_palette.h.

References size_.

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

◆ sub_palette()

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

Definition at line 166 of file snes_palette.h.

References AddColor(), colors_, size_, and SnesPalette().

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 178 of file snes_palette.h.

References colors_, size_, and SnesPalette().

Here is the call graph for this function:

◆ operator!=()

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

Definition at line 190 of file snes_palette.h.

References SnesPalette().

Here is the call graph for this function:

Member Data Documentation

◆ kMaxColors

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_


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