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

Represents an indexed color pixel. More...

#include <index_pixel.hpp>

Public Member Functions

 IndexPixel ()
 
 IndexPixel (unsigned int index)
 
bool operator== (const IndexPixel &other) const =default
 
auto operator<=> (const IndexPixel &) const =default
 
bool is_transparent () const
 Checks if this indexed pixel is transparent.
 
unsigned int index () const
 

Detailed Description

Represents an indexed color pixel.

In indexed color mode, each pixel stores an index into a palette rather than a direct color value. By convention, palette index 0 is always the transparent color.

Invariant
Default-constructed IndexPixel is transparent (satisfies SupportsTransparency design invariant). That is, IndexPixel{} produces a transparent pixel value with index 0.

Definition at line 21 of file index_pixel.hpp.

Constructor & Destructor Documentation

◆ IndexPixel() [1/2]

porytiles2::IndexPixel::IndexPixel ( )
inline

Definition at line 23 of file index_pixel.hpp.

◆ IndexPixel() [2/2]

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

Definition at line 26 of file index_pixel.hpp.

Member Function Documentation

◆ index()

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

Definition at line 51 of file index_pixel.hpp.

◆ is_transparent()

bool porytiles2::IndexPixel::is_transparent ( ) const
inline

Checks if this indexed pixel is transparent.

In indexed color mode, palette index 0 is conventionally the transparent color.

Returns
True if the palette index is 0, false otherwise

Definition at line 46 of file index_pixel.hpp.

◆ operator<=>()

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

◆ operator==()

bool porytiles2::IndexPixel::operator== ( const IndexPixel other) const
default

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