|
Porytiles
|
Represents an indexed color pixel. More...
#include <index_pixel.hpp>
Public Member Functions | |
| IndexPixel () | |
| IndexPixel (std::size_t 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. | |
| std::size_t | index () const |
| Returns the raw index value. | |
| std::size_t | color_index () const |
| Returns the color index within a palette (lower 4 bits). | |
| std::size_t | palette_index () const |
| Returns the palette index (upper 4 bits). | |
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.
IndexPixel{} produces a transparent pixel value with index 0. Definition at line 18 of file index_pixel.hpp.
|
inline |
Definition at line 20 of file index_pixel.hpp.
|
inline |
Definition at line 23 of file index_pixel.hpp.
|
inline |
Returns the color index within a palette (lower 4 bits).
In true-color mode, the full 8-bit index encodes both the palette index (upper 4 bits) and the color index within that palette (lower 4 bits). This method extracts just the color index, which is what GBA hardware uses to look up colors in the selected palette.
For standard 4-bit indexed pixels (values 0-15), this returns the same value as index().
Definition at line 77 of file index_pixel.hpp.
|
inline |
Returns the raw index value.
For standard 4-bit indexed pixels, this returns the palette color index (0-15). For true-color encoded pixels, this returns the full 8-bit value where upper 4 bits are the palette index and lower 4 bits are the color index.
Definition at line 60 of file index_pixel.hpp.
|
inline |
Checks if this indexed pixel is transparent.
In indexed color mode, color index 0 is conventionally the transparent color. For true-color encoded pixels (where the full 8-bit value encodes both palette and color index), this checks only the lower 4 bits (the color index within the palette), since that's what determines transparency in the GBA hardware.
Definition at line 46 of file index_pixel.hpp.
|
default |
|
default |
|
inline |
Returns the palette index (upper 4 bits).
In true-color mode, the full 8-bit index encodes both the palette index (upper 4 bits) and the color index within that palette (lower 4 bits). This method extracts the palette index, which identifies which of the 16 possible palettes this pixel's color belongs to.
For standard 4-bit indexed pixels (values 0-15), this always returns 0.
Definition at line 94 of file index_pixel.hpp.