- Main Page
- Modules
- Classes
- Files

# Palette

## Functions
bool | CxImage::IsGrayScale ()
bool | CxImage::IsIndexed () const
bool | CxImage::IsSamePalette (CxImage &img, bool bCheckAlpha=true)
uint32_t | CxImage::GetPaletteSize ()
RGBQUAD * | CxImage::GetPalette () const
RGBQUAD | CxImage::GetPaletteColor (uint8_t idx)
bool | CxImage::GetPaletteColor (uint8_t i, uint8_t *r, uint8_t *g, uint8_t *b)
uint8_t | CxImage::GetNearestIndex (RGBQUAD c)
void | CxImage::BlendPalette (COLORREF cr, int32_t perc)
void | CxImage::SetGrayPalette ()
void | CxImage::SetPalette (uint32_t n, uint8_t *r, uint8_t *g, uint8_t *b)
void | CxImage::SetPalette (RGBQUAD *pPal, uint32_t nColors=256)
void | CxImage::SetPalette (rgb_color *rgb, uint32_t nColors=256)
void | CxImage::SetPaletteColor (uint8_t idx, uint8_t r, uint8_t g, uint8_t b, uint8_t alpha=0)
void | CxImage::SetPaletteColor (uint8_t idx, RGBQUAD c)
void | CxImage::SetPaletteColor (uint8_t idx, COLORREF cr)
void | CxImage::SwapIndex (uint8_t idx1, uint8_t idx2)
void | CxImage::SwapRGB2BGR ()
void | CxImage::SetStdPalette ()

## Detailed Description

These functions have no effects on RGB images and in this case the returned value is always 0.

## Function Documentation

void CxImage::BlendPalette | ( | COLORREF | cr,
|  | int32_t | perc |
| ) |  |  | `[inherited]`

Colorize the palette.

See also:
  Colorize

uint8_t CxImage::GetNearestIndex | ( | RGBQUAD | c | ) | `[inherited]`

Returns the best palette index that matches a specified color.

RGBQUAD * CxImage::GetPalette | ( |  | ) | const`[inherited]`

returns the pointer to the first palette index

bool CxImage::GetPaletteColor | ( | uint8_t | i,
|  | uint8_t * | r,
|  | uint8_t * | g,
|  | uint8_t * | b |
| ) |  |  | `[inherited]`

Returns the color of the specified index.

Parameters:

  | i | = palette index
  | r,g,b | = output color channels

RGBQUAD CxImage::GetPaletteColor | ( | uint8_t | idx | ) | `[inherited]`

Returns the color of the specified index.

uint32_t CxImage::GetPaletteSize | ( |  | ) | `[inherited]`

returns the palette dimension in byte

bool CxImage::IsGrayScale | ( |  | ) | `[inherited]`

Returns true if the image has 256 colors and a linear grey scale palette.

bool CxImage::IsIndexed | ( |  | ) | const`[inherited]`

Returns true if the image has 256 colors or less.

bool CxImage::IsSamePalette | ( | CxImage & | img,
|  | bool | bCheckAlpha = `true` |
| ) |  |  | `[inherited]`

Checks if image has the same palette, if any.

Parameters:

  | img | = image to compare.
  | bCheckAlpha | = check also the rgbReserved field.

void CxImage::SetGrayPalette | ( |  | ) | `[inherited]`

Sets (or replaces) the palette to gray scale palette. The function doesn't change the pixels; for standard gray scale conversion use GrayScale().

void CxImage::SetPalette | ( | rgb_color * | rgb,
|  | uint32_t | nColors = `256` |
| ) |  |  | `[inherited]`

void CxImage::SetPalette | ( | RGBQUAD * | pPal,
|  | uint32_t | nColors = `256` |
| ) |  |  | `[inherited]`

void CxImage::SetPalette | ( | uint32_t | n,
|  | uint8_t * | r,
|  | uint8_t * | g,
|  | uint8_t * | b |
| ) |  |  | `[inherited]`

void CxImage::SetPaletteColor | ( | uint8_t | idx,
|  | COLORREF | cr |
| ) |  |  | `[inherited]`

void CxImage::SetPaletteColor | ( | uint8_t | idx,
|  | RGBQUAD | c |
| ) |  |  | `[inherited]`

void CxImage::SetPaletteColor | ( | uint8_t | idx,
|  | uint8_t | r,
|  | uint8_t | g,
|  | uint8_t | b,
|  | uint8_t | alpha = `0` |
| ) |  |  | `[inherited]`

void CxImage::SetStdPalette | ( |  | ) | `[inherited]`

Sets a palette with standard colors for 1, 4 and 8 bpp images.

void CxImage::SwapIndex | ( | uint8_t | idx1,
|  | uint8_t | idx2 |
| ) |  |  | `[inherited]`

swap two indexes in the image and their colors in the palette

void CxImage::SwapRGB2BGR | ( |  | ) | `[inherited]`

swap Red and Blue colors