Color palette resources management for sprites and background layers.
More...
Color palette resources management for sprites and background layers.
|
TLN_Palette | TLN_CreatePalette (int entries) |
| Creates a new color table. More...
|
|
TLN_Palette | TLN_LoadPalette (const char *filename) |
| Loads a palette from a standard .act file. More...
|
|
TLN_Palette | TLN_ClonePalette (TLN_Palette src) |
| Creates a duplicate of the specified palette. More...
|
|
bool | TLN_SetPaletteColor (TLN_Palette palette, int color, uint8_t r, uint8_t g, uint8_t b) |
| Sets the RGB color value of a palette entry. More...
|
|
bool | TLN_MixPalettes (TLN_Palette src1, TLN_Palette src2, TLN_Palette dst, uint8_t factor) |
| Mixes two palettes to create a third one. More...
|
|
bool | TLN_AddPaletteColor (TLN_Palette palette, uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t num) |
| Modifies a range of colors by adding the provided color value to the selected range. The result is always a brighter color. More...
|
|
bool | TLN_SubPaletteColor (TLN_Palette palette, uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t num) |
| Modifies a range of colors by subtracting the provided color value to the selected range. The result is always a darker color. More...
|
|
bool | TLN_ModPaletteColor (TLN_Palette palette, uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t num) |
| Modifies a range of colors by modulating (normalized product) the provided color value to the selected range. The result is always a darker color. More...
|
|
uint8_t * | TLN_GetPaletteData (TLN_Palette palette, int index) |
| Returns the color value of a palette entry. More...
|
|
int | TLN_GetPaletteNumColors (TLN_Palette palette) |
| Returns the number of color entries in the given palette. More...
|
|
bool | TLN_DeletePalette (TLN_Palette palette) |
| Deletes the specified palette and frees memory. More...
|
|
◆ TLN_CreatePalette()
Creates a new color table.
- Parameters
-
entries | Number of color entries (typically 256) |
- Returns
- Reference to the created palette or NULL if error
◆ TLN_LoadPalette()
◆ TLN_ClonePalette()
Creates a duplicate of the specified palette.
- Parameters
-
src | Reference to the palette to clone |
- Returns
- A reference to the newly cloned palette, or NULL if error
- See also
- TLN_CreatePalette()
◆ TLN_SetPaletteColor()
bool TLN_SetPaletteColor |
( |
TLN_Palette |
palette, |
|
|
int |
index, |
|
|
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b |
|
) |
| |
Sets the RGB color value of a palette entry.
- Parameters
-
palette | Reference to the palette to modify |
index | Index of the palette entry to modify (0-255) |
r | Red component of the color (0-255) |
g | Green component of the color (0-255) |
b | Blue component of the color (0-255) |
◆ TLN_MixPalettes()
Mixes two palettes to create a third one.
- Parameters
-
src1 | Reference to the first source palette |
src2 | Reference to the second source palette |
dst | Reference to the target palette |
factor | Integer with mixing factor. 0=100% src1, 255=100% src2, 128=50%/50% |
◆ TLN_AddPaletteColor()
bool TLN_AddPaletteColor |
( |
TLN_Palette |
palette, |
|
|
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b, |
|
|
uint8_t |
start, |
|
|
uint8_t |
num |
|
) |
| |
Modifies a range of colors by adding the provided color value to the selected range. The result is always a brighter color.
- Parameters
-
palette | Reference to the palette to modify |
r | Red component of the color (0-255) |
g | Green component of the color (0-255) |
b | Blue component of the color (0-255) |
start | index of the first color entry to modify |
num | number of colors from start to modify |
◆ TLN_SubPaletteColor()
bool TLN_SubPaletteColor |
( |
TLN_Palette |
palette, |
|
|
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b, |
|
|
uint8_t |
start, |
|
|
uint8_t |
num |
|
) |
| |
Modifies a range of colors by subtracting the provided color value to the selected range. The result is always a darker color.
- Parameters
-
palette | Reference to the palette to modify |
r | Red component of the color (0-255) |
g | Green component of the color (0-255) |
b | Blue component of the color (0-255) |
start | index of the first color entry to modify |
num | number of colors from start to modify |
◆ TLN_ModPaletteColor()
bool TLN_ModPaletteColor |
( |
TLN_Palette |
palette, |
|
|
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b, |
|
|
uint8_t |
start, |
|
|
uint8_t |
num |
|
) |
| |
Modifies a range of colors by modulating (normalized product) the provided color value to the selected range. The result is always a darker color.
- Parameters
-
palette | Reference to the palette to modify |
r | Red component of the color (0-255) |
g | Green component of the color (0-255) |
b | Blue component of the color (0-255) |
start | index of the first color entry to modify |
num | number of colors from start to modify |
◆ TLN_GetPaletteData()
uint8_t* TLN_GetPaletteData |
( |
TLN_Palette |
palette, |
|
|
int |
index |
|
) |
| |
Returns the color value of a palette entry.
- Parameters
-
palette | Reference to the palette to get the color |
index | Index of the palette entry to obtain (0-255) |
- Returns
- 32-bit integer with the packed color in internal pixel format RGBA
◆ TLN_GetPaletteNumColors()
Returns the number of color entries in the given palette.
- Parameters
-
palette | Reference to the palette to query |
- Returns
- number of color entries
◆ TLN_DeletePalette()
Deletes the specified palette and frees memory.
- Parameters
-
palette | Reference to the palette to delete |