Porytiles
Loading...
Searching...
No Matches
porytiles2::ColorIndex Class Reference

Represents a color index value for palette operations. More...

#include <color_index.hpp>

Public Member Functions

 ColorIndex (unsigned int index)
 
auto operator<=> (const ColorIndex &) const =default
 
unsigned int index () const
 Returns the underlying unsigned integer index value.
 

Detailed Description

Represents a color index value for palette operations.

ColorIndex is a semantic wrapper around an unsigned integer that represents a unique identifier for a unique color in the global ColorIndexMap construction process. This type provides type safety and semantic clarity when working with color indices, distinguishing them from other integer values in the codebase.

Unlike IndexPixel, ColorIndex does not follow the SupportsTransparency concept, as it is used to represent the sequential indices assigned to non-transparent colors in the ColorIndexMap. A ColorSet is a collection of ColorIndexes, which can be redeemed for their original colors by consulting the ColorIndexMap.

Invariant
ColorIndex value must be less than num_colors (256). Construction with an invalid index will panic.

Definition at line 31 of file color_index.hpp.

Constructor & Destructor Documentation

◆ ColorIndex()

porytiles2::ColorIndex::ColorIndex ( unsigned int  index)
inline

Definition at line 34 of file color_index.hpp.

Member Function Documentation

◆ index()

unsigned int porytiles2::ColorIndex::index ( ) const
inline

Returns the underlying unsigned integer index value.

Returns
The color index value

Definition at line 51 of file color_index.hpp.

◆ operator<=>()

auto porytiles2::ColorIndex::operator<=> ( const ColorIndex ) const
default

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