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 Member Functions

template<typename T>
 SnesPalette (const std::vector< T > &data)
 
 SnesPalette ()=default
 
 SnesPalette (char *snesPal)
 
 SnesPalette (const unsigned char *snes_pal)
 
 SnesPalette (const std::vector< ImVec4 > &)
 
 SnesPalette (const std::vector< snes_color > &)
 
 SnesPalette (const std::vector< SnesColor > &)
 
void Create (const std::vector< SnesColor > &cols)
 
void Create (std::ranges::range auto &&cols)
 
void AddColor (const SnesColor &color)
 
void AddColor (const snes_color &color)
 
void AddColor (uint16_t color)
 
absl::StatusOr< SnesColorGetColor (int i) const
 
auto mutable_color (int i)
 
void clear ()
 
auto size () const
 
auto empty () const
 
auto begin ()
 
auto end ()
 
SnesColoroperator[] (int i)
 
void operator() (int i, const SnesColor &color)
 
void operator() (int i, const ImVec4 &color)
 
SnesPalette sub_palette (int start, int end) const
 

Private Attributes

std::vector< SnesColorcolors
 

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 or through the GetColor method. The class also provides a method to create a sub-palette by selecting a range of colors from the original palette.

Definition at line 108 of file snes_palette.h.

Constructor & Destructor Documentation

◆ SnesPalette() [1/7]

template<typename T>
yaze::gfx::SnesPalette::SnesPalette ( const std::vector< T > & data)
inlineexplicit

Definition at line 111 of file snes_palette.h.

References colors.

Referenced by sub_palette().

◆ SnesPalette() [2/7]

yaze::gfx::SnesPalette::SnesPalette ( )
default

◆ SnesPalette() [3/7]

yaze::gfx::SnesPalette::SnesPalette ( char * snesPal)
explicit

◆ SnesPalette() [4/7]

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

◆ SnesPalette() [5/7]

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

Definition at line 247 of file snes_palette.cc.

References colors, and yaze::gfx::SnesColor::set_rgb().

Here is the call graph for this function:

◆ SnesPalette() [6/7]

yaze::gfx::SnesPalette::SnesPalette ( const std::vector< snes_color > & cols)
explicit

Definition at line 255 of file snes_palette.cc.

References colors, yaze::gfx::ConvertRgbToSnes(), and yaze::gfx::SnesColor::set_snes().

Here is the call graph for this function:

◆ SnesPalette() [7/7]

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

Definition at line 263 of file snes_palette.cc.

References colors.

Member Function Documentation

◆ Create() [1/2]

void yaze::gfx::SnesPalette::Create ( const std::vector< SnesColor > & cols)
inline

Definition at line 124 of file snes_palette.h.

References colors.

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

◆ Create() [2/2]

void yaze::gfx::SnesPalette::Create ( std::ranges::range auto && cols)
inline

Definition at line 130 of file snes_palette.h.

References colors.

◆ AddColor() [1/3]

void yaze::gfx::SnesPalette::AddColor ( const SnesColor & color)
inline

◆ AddColor() [2/3]

void yaze::gfx::SnesPalette::AddColor ( const snes_color & color)
inline

Definition at line 135 of file snes_palette.h.

References colors.

◆ AddColor() [3/3]

void yaze::gfx::SnesPalette::AddColor ( uint16_t color)
inline

Definition at line 136 of file snes_palette.h.

References colors.

◆ GetColor()

◆ mutable_color()

auto yaze::gfx::SnesPalette::mutable_color ( int i)
inline

Definition at line 145 of file snes_palette.h.

References colors.

Referenced by yaze::editor::PaletteEditor::DrawPaletteGroup().

◆ clear()

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

Definition at line 147 of file snes_palette.h.

References colors.

◆ size()

◆ empty()

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

◆ begin()

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

Definition at line 150 of file snes_palette.h.

References colors.

◆ end()

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

Definition at line 151 of file snes_palette.h.

References colors.

Referenced by sub_palette().

◆ operator[]()

SnesColor & yaze::gfx::SnesPalette::operator[] ( int i)
inline

Definition at line 153 of file snes_palette.h.

References colors.

◆ operator()() [1/2]

void yaze::gfx::SnesPalette::operator() ( int i,
const SnesColor & color )
inline

Definition at line 161 of file snes_palette.h.

References colors.

◆ operator()() [2/2]

void yaze::gfx::SnesPalette::operator() ( int i,
const ImVec4 & color )
inline

Definition at line 168 of file snes_palette.h.

References colors.

◆ sub_palette()

SnesPalette yaze::gfx::SnesPalette::sub_palette ( int start,
int end ) const
inline

Definition at line 177 of file snes_palette.h.

References AddColor(), colors, end(), and SnesPalette().

Here is the call graph for this function:

Member Data Documentation

◆ colors

std::vector<SnesColor> yaze::gfx::SnesPalette::colors
private

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