The Virtual Palette

The virtual palette lets you work with 256-color objects in direct color virtual buffers. When we discuss bitmapped images, we'll see how you can initialize the virtual palette and then display a 256-color bitmap in a direct color virtual buffer. The pixels in the 256-color bitmap will reference RGB values from the virtual palette, just as they would reference RGB values from the logical palette in a 256-color virtual buffer. The virtual palette contains 256 sets of RGB values, numbered 0 to 255. When using a direct color virtual buffer, fg_defpal() sets up the virtual palette with the same 256 colors as the default logical palette.

To modify the values in the virtual palette, use either fg_setrgb() or fg_setdacs(). For direct color virtual buffers, these functions update the virtual palette entries instead of the logical palette entries (if a palette-based display driver is being used, fg_setrgb() and fg_setdacs() will update both the virtual palette and logical palette). As you might expect, fg_getrgb() and fg_getdacs() retrieve RGB data from the virtual palette when using a direct color virtual buffer.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.