Microsoft Windows CE 3.0  

Setting Palette Entries in Windowed Mode

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.

The rules that apply to the PALETTEENTRYstructure used with the IDirectDraw4::CreatePalettemethod also apply to the IDirectDrawPalette::SetEntriesmethod. Typically, you maintain your own array of PALETTEENTRYstructures, so you do not need to rebuild it. When necessary, you can modify the array, and then call IDirectDrawPalette::SetEntrieswhen it is time to update the palette.

In most circumstances, you should not attempt to set any of the Windows static entries when in nonexclusive (windowed) mode or you will get unpredictable results. The only exception is when you reset the 256 entries.

For palette animation, you typically change only a small subset of entries in your PALETTEENTRYarray. You submit only those entries to IDirectDrawPalette::SetEntries. If you are resetting such a small subset, you must reset only those entries marked with the PC_NOCOLLAPSE and PC_RESERVED flags. Attempting to animate other entries can have unpredictable results.

The following example illustrates palette animation in nonexclusive mode:

LPDIRECTDRAW lpDD; // Already initialized
PALETTEENTRY pPaletteEntry[256]; // Already initialized
LPDIRECTDRAWPALETTE lpDDPal; // Already initialized int index;
HRESULT ddrval; PALETTEENTRY temp; // Animate some entries. Cycle
the first 16 available entries. // They were already animated. temp
= pPaletteEntry[10]; for (index = 10; index < 25; index ++) {
pPaletteEntry[index] = pPaletteEntry[index+1]; } pPaletteEntry[25]
= temp; // Set the values. Do not pass a pointer to the entire
palette entry // structure, but only to the changed entries. ddrval
= lpDDPal->SetEntries( 0, // Flags must be zero 10, // First
entry 16, // Number of entries & (pPaletteEntry[10])); // Where
to get the data


 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.