Converting Color and Format

Non-RGB surface formats are described by four-character codes (FOURCC). If an application calls the IDirectDrawSurface5::GetPixelFormat method to request the pixel format, and the surface is a non-RGB surface, the DDPF_FOURCC flag will be set and the dwFourCC member of the DDPIXELFORMAT structure will be valid. If the FOURCC code represents a YUV format, the DDPF_YUV flag will also be set and the dwYUVBitCount, dwYBitMask, dwUBitMask, dwVBitMask, and dwYUVAlphaBitMask members will be valid masks that can be used to extract information from the pixels.

If an RGB format is present, the DDPF_RGB flag will be set and the dwRGBBitCount, dwRBitMask, dwGBitMask, dwBBitMask, and dwRGBAlphaBitMask members will be valid masks that can be used to extract information from the pixels. The DDPF_RGB flag can be set in conjunction with the DDPF_FOURCC flag if a nonstandard RGB format is being described.

Color conversions between different RGB formats are not supported. Color conversions are only supported between different FOURCC formats and between a FOURCC format and an RGB format.

During color and format conversion, two sets of FOURCC codes are exposed to the application. One set of FOURCC codes represents the capabilities of the blitting hardware; the other represents the capabilities of the overlay hardware.

For more information, see Four-Character Codes (FOURCC) or Converting Between YUV and RGB.

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.