Microsoft DirectX 8.1 (C++) |
Modifies the PALETTEENTRY structure to create an identity palette.
Syntax
HRESULT MakeIdentityPalette(
PALETTEENTRY *pEntry,
INT iColours,
LPSTR szDevice
);
Parameters
pEntry
Pointer to an array of prospective palette colors.
iColours
Number of colors in the array.
szDevice
Pointer to string that contains the name of the destination device. If omitted, this parameter defaults to the main device.
Return Value
Returns NOERROR if successful or S_FALSE if unsuccessful.
Remarks
When a palette is installed in a window, GDI does a fair job of compressing the requested colors where possible. So, for example, if the array contains five entries of black, they will be compressed into one palette entry. This is useful for most applications; however, when drawing video it will force GDI to map the pixels in the supplied image to the compressed palette (which results in serious performance penalties).
Therefore, the PALETTEENTRY fields supplied must be adjusted so that they will never have colors compressed. This means that when the window displaying the image has the foreground focus, the palette created by this object will map directly to the palette selected in the display device: a so-called identity palette.
See Also