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... | |
| Palette * | getPalette () |
| Retrieve the resulting palette from the quantizer. More... | |
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.
| Graphics::ColorQuantizer::ColorQuantizer | ( | int | maxColors | ) |
Construct a new ColorQuantizer object.
| maxColors | the maximum number of colors in the final palette |
| void Graphics::ColorQuantizer::addColor | ( | byte | r, |
| byte | g, | ||
| byte | b | ||
| ) |
Add a single color to the quantizer.
| r | the R component of the color |
| g | the G component of the color |
| b | the B component of the color |
| Palette* Graphics::ColorQuantizer::getPalette | ( | ) |
Retrieve the resulting palette from the quantizer.