Color

When Windows calls the Enable function the first time, a graphics driver should initialize the members of the GDIINFO structure that contain information about the device's color capabilities. The following table identifies these members and their purpose:

GDIINFO member Purpose
dpNumColors Specifies the number of colors (or pens, in the case of plotters) supported by the device.
dpRaster Specifies whether or not the device is palette capable.
dpNumPalReg Specifies the total number of simultaneous colors which can be displayed on a palette-capable device.
dpPalReserved Specifies the number of palette entries that are reserved for system colors. (This member is only required for palette capable devices.)
dpColorRes Specifies the number of bits required to identify an entry in the palette.

As a minimum, all drivers must specify the number of supported colors by setting the dpNumColors member of the GDIINFO structure; in addition, all drivers must specify whether or not the device is palette capable by setting the appropriate value for the dpRaster member. However, the remaining members of the GDIINFO structure should only be set by drivers that support palette-capable devices.

In addition to setting the appropriate members of the GDIINFO structure, every graphics driver must support the ColorInfo function. However, only drivers for palette-capable devices must support the remaining five color functions: GetPalette, GetPalTrans, SetPalette, SetPalTrans, and UpdateColors.

The ColorInfo function converts an RGB value into a physical color value or converts a physical color-value into an RGB value. A physical color value is an index into a device's color table. The GetPalette function retrieves the RGB values that correspond to a specified range of indices in a device's palette. The GetPalTrans function retrieves a copy of the driver's palette-translation table. The SetPalette function sets one or more entries in a device's palette. The SetPalTrans function creates an inverse of the driver's palette translation table. The UpdateColors function uses the current translation-table colors to update a rectangular region on a video display.