ColorResList Example for C++ 4.0 and later

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

short i; // Loop counter
short uCount; // Number of bitmaps in the list
OLE_COLOR TransparentColor; // Color used for transparency

// Save the current transparent color.
TransparentColor = m_Lead1.GetBitmapTransparentColor();

// Avoid repaints while we modify the bitmaps.
m_Lead1.SetAutoRepaint(FALSE);

// Change the hue of each bitmap in the list, 
// and restore the transparent color as the last color in the palette.
uCount = m_Lead1.GetBitmapListCount();
for (i = 0; i < uCount; ++i)
{
   m_Lead1.SetBitmapListIndex(i);
   m_Lead1.Hue(i * 10);
   m_Lead1.SetBitmapPalette(255, TransparentColor);
}

// Get an optimized palette for the whole list.
m_Lead1.ColorResList(8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0);

// Update the palette that is used for playback.
for (i = 0; i < 256; ++ i)
   m_Lead1.SetAnimationPalette(i, m_Lead1.GetBitmapPalette(i));

// Start the animation.
m_Lead1.SetAutoRepaint(TRUE);
m_Lead1.SetAnimationEnable(TRUE);