Microsoft Windows CE 3.0  

ColorConverter

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This class contains GPE color conversion support. The base ColorConverterclass 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 longof the form 0x00BBGGRR. This is identical to the PALETTENTRYstructure.
PAL_BGR
Format in which each pixel is an unsigned longof the form 0x00RRGGBB. This is identical to the RGBQUADstructure.
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 XLATEOBJpointer parameters, the functions create and initialize ColorConverterobjects to handle any color conversion. Alternatively, based upon the value of the XLATEOBJmember iUniq, the functions may use a cached ColorConverterobject from a previous call.

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

If pLookupis 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 pConverteris 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 pLookupor pConverteris set to non-NULL. Note, even if two palettes contain the same entries, the palletes are not considered to be the same if one palette is mutable and the other is not.

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.



 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.