Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_Palette

Palette class.
Contained in: global
Derived from: none
Derived by: none
Group: Display (Display 2D)

#include <ClanLib/display.h>

### public function member index:

### Construction:

`` | `CL_Palette` | `()`;
``virtual`` | `~CL_Palette` | `()`;
`` | `CL_Palette` | `(`unsigned` `char`* `palette`, `int` `num_colors`=256)`;
`` | `CL_Palette` | `(`char`* `palette_id`, `CL_InputSourceProvider`* `provider`)`;
`` | `CL_Palette` | `(`CL_InputSource`* `input`)`;

## Description:

CL_Palette represents a palette in the form of a 256 byte array.
Palettes are in ClanLib only used by surface providers. A provider specifies it's palette by returning a CL_Palette. But It can also choose to return NULL. In that case it will use the system palette. You can change the system palette from CL_Display or CL_DisplayCard.
See Also - CL_Display - The system palette is set here.
See Also - CL_DisplayCard - The card specific system palette is set here.
See Also - CL_SurfaceProvider - Palettelized surfaces use this class.

## Function Member Descriptions:

CL_Palette::CL_Palette - Creates a palette.
`` `CL_Palette` `()`;

CL_Palette::CL_Palette - Creates a palette using values from an unsigned char array.
`` `CL_Palette` `(`unsigned` `char`* `palette`, `int` `num_colors`=256)`;

> palette - palette source.
> num_colors - number of palette colors.

CL_Palette::CL_Palette - Creates a palette from a input source.
`` `CL_Palette` `(`char`* `palette_id`, `CL_InputSourceProvider`* `provider`)`;

> palette_id - ID used to get palette from provider.
> provider - Input source type (eg. a datafile or a normal file).

CL_Palette::CL_Palette - Creates a palette from an already open input source.
`` `CL_Palette` `(`CL_InputSource`* `input`)`;

> input - Input source to read from.

CL_Palette::~CL_Palette - Palette destructor
``virtual`` `~CL_Palette` `()`;

## Variable Member Descriptions:

CL_Palette::num_colors - Number of colours in the palette.
``int`` ``num_colors`;`

CL_Palette::palette - The actual palette. 1 byte for each color component (rgb), 256 colors.
``unsigned` `char` *` ``palette`;`