## Display Device Driver Reference for OS/2

[prev][next][parent][TOC]

### Creating and Selecting Palettes

A palette is created by passing an array of RGBs to the GpiCreatePalette function in a similar manner to creating a Logical Color Table. This call returns a handle to the palette created. This handle must be used to address the palette in all other related calls.

Unlike LCTs, palettes are global objects and are not confined to a particular presentation space. An application can create multiple palettes and use a different one for each of its tasks. Palette handles can even be passed between different applications to enable them to share the color palettes.

To start drawing with a particular palette in a Presentation Space (PS), the palette must be selected into the PS using the GpiSelectPalette function. This function associates the PS with the palette, and all subsequent color information is taken from the RGB values in the palette. The colors are addressed by an application in the same way as the colors within an LCT-by specifying indexes into the array of RGBs originally used to create the palette.