The information in this article applies to:
SUMMARY
You can use the Game SDK function CreatePalette() to create a
DIRECTDRAWPALETTE object for a DirectDraw object.
MORE INFORMATIONUse the following code to create a gray-scale palette with 256 colors:
Now, when in full screen mode, all 256 colors will be set -- the larger
the palette index number, the brighter the color. All of your offscreen
surfaces (bitmaps) will contain bytes that map to these 256 colors
correctly.
However, when you go into windowed mode, your bitmaps will no longer map to the colors correctly because the 256 palette entries you specified in "ape" are mapped to the physical palette like a GDI logical palette is mapped to the physical palette when RealizePalette() is called. In windowed mode, there is no way to know how your 256 colors will get mapped unless you use the PC_NOCOLLAPSE flag for your entries. This way, you can ensure that entry 1 will map to physical entry 10, entry 2 will map to physical entry 11, entry 3 will map to physical entry 12, and so on. You should rely only on the first 236 colors, though, because there are only 236 free entries in the physical palette when in windowed mode. For example, you could call the following code when your application switches to windowed mode:
Now you need to add 10 to all of the bytes in all of your bitmap data
because all colors are now offset by 10. Once you have done so, your bitmap
images will display correctly.
Additional query words: 1.00 kbinf DDraw DirectDraw Palette
Keywords : kbcode GDIDDraw |
Last Reviewed: November 11, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |