ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Graphics::ColorQuantizer Class Reference

Class for selecting a good palette from a large number of colors. More...

#include <color_quantizer.h>

Public Member Functions

 ColorQuantizer (int maxColors)
 Construct a new ColorQuantizer object. More...
 
void addColor (byte r, byte g, byte b)
 Add a single color to the quantizer. More...
 
PalettegetPalette ()
 Retrieve the resulting palette from the quantizer. More...
 

Detailed Description

Class for selecting a good palette from a large number of colors.

Colors are added one by one, after which a palette with at most maxColors entries can be retrieved. The caller is responsible for freeing the palette afterwards.

Constructor & Destructor Documentation

◆ ColorQuantizer()

Graphics::ColorQuantizer::ColorQuantizer ( int  maxColors)

Construct a new ColorQuantizer object.

Parameters
maxColorsthe maximum number of colors in the final palette

Member Function Documentation

◆ addColor()

void Graphics::ColorQuantizer::addColor ( byte  r,
byte  g,
byte  b 
)

Add a single color to the quantizer.

Parameters
rthe R component of the color
gthe G component of the color
bthe B component of the color

◆ getPalette()

Palette* Graphics::ColorQuantizer::getPalette ( )

Retrieve the resulting palette from the quantizer.

Returns
A Palette object with at most maxColor entries.

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