8bpp palette class.
More...
#include <th_gfx_sdl.h>
◆ palette() [1/2]
Create an empty palette. All entries are black and fully opaque.
◆ palette() [2/2]
| palette::palette |
( |
const uint8_t * |
pData, |
|
|
size_t |
iDataLength, |
|
|
bool |
is8bit |
|
) |
| |
Load a 256 index color palette from the supplied data.
- Parameters
-
| pData | Palette data in RGB or RGBA format. |
| iDataLength | Size of the data. |
| is8bit | Whether the data is in 8bpp (otherwise 6bpp). |
- Returns
- Whether loading of the palette succeeded.
◆ get_alpha()
Get the opacity component of a colour.
- Parameters
-
| iColour | Colour to examine. |
- Returns
- The opacity of the colour.
◆ get_argb_data()
Get the internal palette data for fast (read-only) access.
- Returns
- Table with all 256 colours of the palette.
◆ get_blue()
Get the blue component of a colour.
- Parameters
-
| iColour | Colour to examine. |
- Returns
- The blue component intensity of the colour.
◆ get_green()
Get the green component of a colour.
- Parameters
-
| iColour | Colour to examine. |
- Returns
- The green component intensity of the colour.
◆ get_red()
Get the red component of a colour.
- Parameters
-
| iColour | Colour to examine. |
- Returns
- The red component intensity of the colour.
◆ pack_argb()
Convert A, R, G, B values to a 32bpp colour.
- Parameters
-
| iA | Amount of opacity (0-255). |
| iR | Amount of red (0-255). |
| iG | Amount of green (0-255). |
| iB | Amount of blue (0-255). |
- Returns
- 32bpp value representing the provided colour values.
◆ set_argb()
| void palette::set_argb |
( |
int |
iEntry, |
|
|
uint32_t |
iVal |
|
) |
| |
|
inline |
Set an entry of the palette.
- Parameters
-
| iEntry | Entry to modify. |
| iVal | Palette value to set. |
◆ set_entry()
| bool palette::set_entry |
( |
int |
iEntry, |
|
|
uint8_t |
iR, |
|
|
uint8_t |
iG, |
|
|
uint8_t |
iB |
|
) |
| |
Set an entry of the palette.
The RGB colour (255, 0, 255) is used as the transparent colour.
- Parameters
-
| iEntry | Entry number to change. |
| iR | Amount of red in the new entry. |
| iG | Amount of green in the new entry. |
| iB | Amount of blue in the new entry. |
- Returns
- Setting the entry succeeded.
◆ color_count
Number of colours in the palette.
The documentation for this class was generated from the following files: