- Main Page
- Modules
- Classes
- Files

# Palette

## Functions
bool | CxImage::IsGrayScale ()
bool | CxImage::IsIndexed () const
bool | CxImage::IsSamePalette (CxImage &img, bool bCheckAlpha=true)
DWORD | CxImage::GetPaletteSize ()
RGBQUAD * | CxImage::GetPalette () const
RGBQUAD | CxImage::GetPaletteColor (BYTE idx)
bool | CxImage::GetPaletteColor (BYTE i, BYTE *r, BYTE *g, BYTE *b)
BYTE | CxImage::GetNearestIndex (RGBQUAD c)
void | CxImage::BlendPalette (COLORREF cr, long perc)
void | CxImage::SetGrayPalette ()
void | CxImage::SetPalette (DWORD n, BYTE *r, BYTE *g, BYTE *b)
void | CxImage::SetPalette (RGBQUAD *pPal, DWORD nColors=256)
void | CxImage::SetPalette (rgb_color *rgb, DWORD nColors=256)
void | CxImage::SetPaletteColor (BYTE idx, BYTE r, BYTE g, BYTE b, BYTE alpha=0)
void | CxImage::SetPaletteColor (BYTE idx, RGBQUAD c)
void | CxImage::SetPaletteColor (BYTE idx, COLORREF cr)
void | CxImage::SwapIndex (BYTE idx1, BYTE 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,
|  | long | perc |
| ) |  |  | `[inherited]`

Colorize the palette.

See also:
  Colorize

BYTE 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 | ( | BYTE | i,
|  | BYTE * | r,
|  | BYTE * | g,
|  | BYTE * | b |
| ) |  |  | `[inherited]`

Returns the color of the specified index.

Parameters:

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

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

Returns the color of the specified index.

DWORD 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,
|  | DWORD | nColors = `256` |
| ) |  |  | `[inherited]`

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

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

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

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

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

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

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

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

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

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

swap Red and Blue colors