ColorConverter

This class contains GPE color conversion support. The base ColorConverter class is defined in the Swconvrt.cpp file. This converter enables translation among any combination of source and destination surface pixel types at the time that bit blocks are written to the display.

Pixel formats for surfaces conform to one of the following types:

PAL_RGB
Format in which each pixel is an unsigned long of the form 0x00BBGGRR. This is identical to the PALETTENTRY structure.
PAL_BGR
Format in which each pixel is an unsigned long of the form 0x00RRGGBB. This is identical to the RGBQUAD structure.
PAL_MASKED
Format in which the red, green, and blue (RGB) channels of each pixel are isolated by using bitmasks to identify which specific bits are used for each channel. This is most common for formats of 15 and 16 bpp.
PAL_INDEXED
Format in which each pixel contains an index into the current palette for the surface. Palette entries may be 1, 2, 4, or 8 bits long, depending on how many bits per pixel the display uses.

When display drivers call GPE functions with XLATEOBJ pointer parameters, the functions create and initialize ColorConverter objects to handle any color conversion. Alternatively, based upon the value of the XLATEOBJ member iUniq, the functions may use a cached ColorConverter object from a previous call.

The ColorConverter object populates two pointers: pLookup and pConverter. If both are NULL, no conversion is required because the source and destination formats are compatible and palettes, if any, are identical.

If pLookup is not NULL, 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, it is the address of a function that is called to convert a source pixel to a destination pixel. Use this when source and destination formats are incompatible and the source format is not indexed. At most, either pLookup or pConverter is set to non-NULL.

Because color conversion is an optional feature for Windows CE, you can reduce or remove part or all of the feature in order to reduce the size of the driver. However, if you choose to alter the conversion feature, be sure to author all bitmaps provided for the platform to a bit depth or palette that is supported by the display driver. The current size of the complete color converter is slightly over 2 KB when compiled without debugging symbols.