Chapter 13. Palettes

Up to this chapter, we have been using lots of colors in our programs; we talked about color pens, color brushes, 16-, 24-, and 32-bit bitmaps, gradient fill, alpha blending, and image processing. But if we run these programs on a 256-color display monitor, suddenly we go back to the dark ages. All the colorful displays turn grayish with ugly dithering patterns.

The problem lies in the palette, a tool that Windows GDI and display hardware borrowed from graphics artists to map the color index in a palette-based frame buffer to RGB colors.

In this chapter, we discuss what happens if you don't pay attention to the palette at all, what's the least you should do if you want your program to run reasonably well on palette-based displays, ...

Get Windows Graphics Programming Win32 GDI and DirectDraw® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.