Automatic palette manager.
More...
#include <palette_manager.hpp>
Automatic palette manager.
◆ PaletteManager()
DSC::PaletteManager::PaletteManager |
( |
void * |
palettes_offset | ) |
|
creates a new PaletteManager instance
- Parameters
-
palettes_offset | the address of the palette data managed by the instance
|
◆ reserve1()
int DSC::PaletteManager::reserve1 |
( |
int |
color | ) |
|
choose an index for the specified color
- Parameters
-
- Returns
- a value V that tells the palette index it has been placed at.
If the color already exists in the palette, it is not added once again and the position of the already existing color is returned.
◆ reserve16()
int DSC::PaletteManager::reserve16 |
( |
const void * |
palette4 | ) |
|
loads a 4-bit palette
- Parameters
-
palette4 | address to a stream of 16 unsigned shorts represing the BGR15 color codes |
- Returns
- the id of the palette slot assigned to the given 4-bit palette has been, a number from 0 (0x0) to 15 (0xF)
This function does not have the expected effect unless the target palette is a standard palette. Do not load 4-bit palettes in extended slots. They may be loaded, but can't be used in the intended ways.
◆ try_load()
Attempts to load colors from asset data palette.
- Parameters
-
- Returns
- allocation result information
◆ unload()
void DSC::PaletteManager::unload |
( |
const AssetData * |
asset | ) |
|
Unloads colors from a previously loaded asset data palette.
- Parameters
-
- Warning
- No checks are performed to ensure that the asset's palette has been previously loaded before deallocation happens. Accidentally unloading "unloaded" data may result in possible data loss and corruption.
◆ unload1()
void DSC::PaletteManager::unload1 |
( |
int |
color | ) |
|
removes a certain color from the palette
- Parameters
-
If the color is being used by more than one asset, it is still kept in the palette even after unloading it. A color is fully released only after no other resources use it. Attempts to unload an inexistent color are simply ignored.
◆ unload16()
void DSC::PaletteManager::unload16 |
( |
const void * |
palette4 | ) |
|
removes a 4-bit palette
- Parameters
-
palette4 | address to a stream of 16 unsigned shorts represing the BGR15 color codes |
A 4-bit palette is fully released only after no other resources use it. Attempts to unload an inexistent palette are simply ignored.
The documentation for this class was generated from the following file: