The information in this article applies to:
SUMMARYA popular method used to perform a fade on an image is to animate the palette. An application displays a bitmap, and then animates the palette to all black, fading the image into blackness. MORE INFORMATIONThe following file is available for download from the Microsoft
Download Center. Click the file name below to download the file: Fadein.exeFor more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. This sample application in FADEIN.EXE contains code that performs the following tasks:
You can take advantage of an optimization in Windows to work around this issue. When Windows is performing a BitBlt and it detects that an identity palette is being used, no color matching is performed. The source bits are moved to the destination unchanged. To perform a fade from black to color, use an identity palette to get the bits onto the screen and then fade the palette from all black to the original bitmap's desired colors. To prepare a bitmap to use an identity palette, you must reduce the image from 256 colors to 236. An identity palette must contain the system entries in its first and last ten entries. The code in the sample below that reduces the image to 236 colors must first calculate the optimal 236 colors from a 256 color table. It then determines how close the colors are to each other, and discards colors that have close matches while keeping colors that have no close matches. Once it determines the best 236 colors, BitBlt() maps the 256 color image to 236 colors. Everything is then moved up ten to allow for the system colors in the identity palette. Additional query words: AnimatePalette CreateDIBSection kbgraphic kbfile
Keywords : kbfile kbgraphic kbNTOS350 kbWinOS2000 kbSDKWin32 kbWinOS95 |
Last Reviewed: December 15, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |