ColorConverter Class

Complete color conversion support is contained within the GPE base classes in the file swconvrt.cpp as the class ColorConverter. This converter allows for Blt-time translation between any combination of source and destination surface pixel types. Pixel formats for surfaces conform to one of the following basic types:

PAL_RGB
Essentially the same as a PALETTENTRY structure, or an unsigned long of the form 0x00BBGGRR)
PAL_BGR
The same as an RGBQUAD structure, or an unsigned long of the form 0x00RRGGBB
PAL_MASKED
Similar to RGB or BGR in that specific bits are used for the different primary components of a color. This is most common for 15 or 16 bit pixel definitions.
PAL_INDEXED
A palettized surface. Each pixel may contain 1, 2, 4, or 8 bits to select from the current palette for the surface.

Upon entry to a Drv function which contains a pxlo (XLATEOBJ *) parameter, the Drv function creates and initializes a ColorConverter object for the translation. Alternatively, based upon the iUniq field of the XLATEOBJ, it may use a cached ColorConverter from a previous call.

The ColorConverter populates two pointers — pLookup and pConverter. If both are NULL then no conversion is required for this operation (the source and destination formats are compatible and the palettes -if any- are identical). If pLookup is not NULL, then the operation must convert each source pixel to a destination pixel using the source pixel value as an index into the lookup table.

If pConverter is not NULL, then it is the address of a function which should be called to convert a source pixel to a destination pixel. This is only used when the source and destination formats are not compatible and the source format is not indexed.

At most one of pLookup and pConverter will be set to non-NULL.

Color conversion is an optional feature for Windows CE. As such, it may be removed in part, or completely to reduce the size of the driver. If it is removed or reduced for a given platform, then all bitmaps provided for that platform must be authored to a bit depth and/or palette which is supported by the display driver. The current size of the complete color converter is slightly over 2K bytes (non-debug)