Add: 32bpp-to-8bpp palette index lookup.

Lookups are calculated on demand and caches in a 256KB in-memory table.
This commit is contained in:
Peter Nelson
2023-12-22 16:01:32 +00:00
committed by Peter Nelson
parent daec0e2ca4
commit 0bc22dd310
2 changed files with 114 additions and 0 deletions

View File

@@ -19,6 +19,13 @@ extern Palette _cur_palette; ///< Current palette
bool CopyPalette(Palette &local_palette, bool force_copy = false);
void GfxInitPalettes();
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b);
static inline uint8_t GetNearestColourIndex(const Colour colour)
{
return GetNearestColourIndex(colour.r, colour.g, colour.b);
}
/**
* Checks if a Colours value is valid.
*