다음을 통해 공유


Setting Palette Entries in Windowed Mode (Windows CE 5.0)

Send Feedback

The rules that apply to the PALETTEENTRY structure used with the IDirectDraw4::CreatePalette method also apply to the IDirectDrawPalette::SetEntries method.

Typically, you maintain your own array of PALETTEENTRY structures, so you do not need to rebuild it. When necessary, you can modify the array, and then call IDirectDrawPalette::SetEntries when 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 PALETTEENTRY array. 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 

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.