yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::app::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 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
 
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 107 of file snes_palette.h.

Constructor & Destructor Documentation

◆ SnesPalette() [1/7]

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

Definition at line 110 of file snes_palette.h.

References colors.

◆ SnesPalette() [2/7]

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

◆ SnesPalette() [3/7]

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

◆ SnesPalette() [4/7]

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

◆ SnesPalette() [5/7]

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

Definition at line 250 of file snes_palette.cc.

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

Here is the call graph for this function:

◆ SnesPalette() [6/7]

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

Definition at line 258 of file snes_palette.cc.

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

Here is the call graph for this function:

◆ SnesPalette() [7/7]

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

Definition at line 266 of file snes_palette.cc.

References colors.

Member Function Documentation

◆ Create()

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

Definition at line 123 of file snes_palette.h.

References colors.

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

◆ AddColor() [1/3]

◆ AddColor() [2/3]

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

Definition at line 130 of file snes_palette.h.

References colors.

◆ AddColor() [3/3]

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

Definition at line 131 of file snes_palette.h.

References colors.

◆ GetColor()

◆ mutable_color()

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

◆ clear()

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

Definition at line 142 of file snes_palette.h.

References colors.

Referenced by yaze::app::gfx::Bitmap::Cleanup(), and yaze::app::gfx::Tilesheet::clear().

◆ size()

◆ empty()

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

◆ operator[]()

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

Definition at line 146 of file snes_palette.h.

References colors.

◆ operator()() [1/2]

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

Definition at line 154 of file snes_palette.h.

References colors.

◆ operator()() [2/2]

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

Definition at line 161 of file snes_palette.h.

References colors.

◆ sub_palette()

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

Definition at line 170 of file snes_palette.h.

References AddColor(), and colors.

Referenced by yaze::app::gfx::Bitmap::ApplyPaletteFromPaletteGroup(), and yaze::app::gfx::Bitmap::ApplyPaletteWithTransparent().

Here is the call graph for this function:

Member Data Documentation

◆ colors

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

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