The information in this article applies to:
SUMMARY"Animation" of the Windows palette is the replacement of one set of colors in the palette by another set of colors. This article discusses animation and how it is used in a Windows-based application. Animate.exe is a sample application that enables you to draw a color wheel and "spin" it using animation can be found in the Microsoft Software Library. MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. For an example of animation, consider a chain of rectangles on the screen:
If index 20 is mapped to the color green in the palette, index 21 is
mapped to red, and index 22 is mapped to blue, a "Broadway Lights"
effect can be achieved by remapping the three colors to the different
indexes. For example, mapping red to 20, blue to 21, and green to 22,
the "lights" appears to move to the left.
Changing the hardware registers (the system palette) is much faster than redrawing the rectangles, because no pixels need to be updated. Only a very small set of hardware registers need to be changed. This allows for very fast graphical effects. With video systems capable of supporting 256 colors, these hardware registers are changed through palette animation, and the GDI call, AnimatePalette() was specifically designed for this purpose. This article is meant to be a supplement to the information provided in the Windows Software Development Kit (SDK) manuals, not a replacement. This article will discuss the actual steps necessary to create and use a palette in an application from a programmer's standpoint. Q: What is the difference between a logical palette and the lpPaletteColors as referenced in the AnimatePalette() function description? A: The logical palette is the one made by CreatePalette(), while the lpPaletteColors is a pointer to a separate memory structure that holds the animation colors. For this article, the term "animation palette" will be used to refer to the memory structure pointed to by lpPaletteColors. Q: What special considerations are necessary for animation? A: There are two necessary considerations.
Q: How is palette animation actually done? A: There are two steps to animating the Palette:
Additional query words:
Keywords : kbfile kbsample kb16bitonly kbGDI kbPalettes kbSDKWin16 |
Last Reviewed: December 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |