ScummVM API documentation
Graphics::PaletteLookup Class Reference

Public Member Functions

 PaletteLookup (const byte *palette, uint len)
 Construct a new Palette Lookup object. More...
 
bool setPalette (const byte *palette, uint len)
 Pass palette to the look up. It also compares given palette with the current one and resets cache only when their contents is different. More...
 
byte findBestColor (byte r, byte g, byte b, bool useNaiveAlg=false)
 This method returns closest color from the palette and it uses cache for faster lookups. More...
 
uint32 * createMap (const byte *srcPalette, uint len, bool useNaiveAlg=false)
 This method creates a map from the given palette that can be used by crossBlitMap(). More...
 

Constructor & Destructor Documentation

◆ PaletteLookup()

Graphics::PaletteLookup::PaletteLookup ( const byte *  palette,
uint  len 
)

Construct a new Palette Lookup object.

Parameters
palettethe palette data, in interleaved RGB format
lenthe number of palette entries to be read

Member Function Documentation

◆ setPalette()

bool Graphics::PaletteLookup::setPalette ( const byte *  palette,
uint  len 
)

Pass palette to the look up. It also compares given palette with the current one and resets cache only when their contents is different.

Parameters
palettethe palette data, in interleaved RGB format
lenthe number of palette entries to be read
Returns
true if palette was changed and false if it was the same

◆ findBestColor()

byte Graphics::PaletteLookup::findBestColor ( byte  r,
byte  g,
byte  b,
bool  useNaiveAlg = false 
)

This method returns closest color from the palette and it uses cache for faster lookups.

Parameters
useNaiveAlgif true, use a simpler algorithm
Returns
the palette index

◆ createMap()

uint32* Graphics::PaletteLookup::createMap ( const byte *  srcPalette,
uint  len,
bool  useNaiveAlg = false 
)

This method creates a map from the given palette that can be used by crossBlitMap().

Parameters
palettethe palette data, in interleaved RGB format
lenthe number of palette entries to be read
useNaiveAlgif true, use a simpler algorithm
Returns
the created map, or nullptr if one isn't needed.

The documentation for this class was generated from the following file: