2015-09-27 21:17:59 +00:00
|
|
|
|
|
|
|
#include "compat.h"
|
|
|
|
|
2019-12-23 07:03:42 +00:00
|
|
|
extern void paletteInitClosestColorScale(int32_t rscale, int32_t gscale, int32_t bscale);
|
|
|
|
extern void paletteInitClosestColorMap(uint8_t const * pal) ATTRIBUTE((nonnull(1)));
|
|
|
|
extern void paletteInitClosestColorGrid(void);
|
2015-09-27 21:17:59 +00:00
|
|
|
|
2019-12-23 07:03:55 +00:00
|
|
|
extern int32_t paletteGetClosestColorWithBlacklist(int32_t r, int32_t g, int32_t b, int32_t lastokcol, uint8_t const * blacklist);
|
|
|
|
extern int32_t paletteGetClosestColorWithBlacklistNoCache(int32_t r, int32_t g, int32_t b, int32_t lastokcol, uint8_t const * blacklist);
|
2019-12-23 07:03:42 +00:00
|
|
|
extern void paletteFlushClosestColor(void);
|
2015-09-27 21:17:59 +00:00
|
|
|
|
2019-12-23 07:03:55 +00:00
|
|
|
static FORCE_INLINE int32_t paletteGetClosestColorUpToIndex(int32_t r, int32_t g, int32_t b, int32_t lastokcol)
|
|
|
|
{
|
|
|
|
return paletteGetClosestColorWithBlacklist(r, g, b, lastokcol, NULL);
|
|
|
|
}
|
|
|
|
static FORCE_INLINE int32_t paletteGetClosestColorUpToIndexNoCache(int32_t r, int32_t g, int32_t b, int32_t lastokcol)
|
|
|
|
{
|
|
|
|
return paletteGetClosestColorWithBlacklistNoCache(r, g, b, lastokcol, NULL);
|
|
|
|
}
|
|
|
|
|
2018-04-12 21:03:47 +00:00
|
|
|
static FORCE_INLINE int32_t paletteGetClosestColor(int32_t r, int32_t g, int32_t b)
|
2015-09-27 21:17:59 +00:00
|
|
|
{
|
2019-12-23 07:03:42 +00:00
|
|
|
return paletteGetClosestColorUpToIndex(r, g, b, 255);
|
2015-09-27 21:17:59 +00:00
|
|
|
}
|