Direct Color Virtual BuffersWhen a high color virtual buffer is active, fg_setcolorrgb() translates its three 8-bit RGB color components to their equivalent 16-bit encoded color value and then sets the current color to that value. The fg_maprgb() function performs this same translation and returns the encoded color as its function value. It does not update the current color, but passing its return value to fg_setcolor() will do so. The following sets of calls each show three different ways of defining the same color for high color virtual buffers:
C/C++:
Delphi:
Visual Basic:
When a true color virtual buffer is active, fg_setcolorrgb() translates its three 8-bit RGB color components to their equivalent 32-bit xRGB encoded color value and then sets the current color to that value. The fg_maprgb() function performs this same translation and returns the encoded color as its function value. It does not update the current color, but passing its return value to fg_setcolor() will do so (by default, the high-order byte will be zero, so you can use the xRGB color value with both 24-bit and 32-bit true color virtual buffers). The following sets of calls each show three different ways of defining the same color for true color virtual buffers:
C/C++:
Delphi:
Visual Basic:
Note that direct color virtual buffers always use RGB values between 0 and 255, whether we're using a high color or a true color buffer. Increasing RGB values produce more intense colors. The fg_unmaprgb() function provides the inverse capability of fg_maprgb(): it extracts the individual RGB components from an encoded color value. The first fg_unmaprgb() parameter is the color value, encoded in the 5/6/5 or 5/5/5 format for high color virtual buffers, or the xRGB format for true color virtual buffers. The remaining three parameters, passed by reference, respectively receive the red, green, and blue color components. Each RGB component will be between 0 and 255. The fg_unmaprgb() function is meaningful only for direct color virtual buffers. The fg_getcolor() function returns the current color, as defined in the most recent call to fg_setcolorrgb() or fg_setcolor(). It has no parameters and returns the current color as its function value. The fg_getcolor() return value is encoded in the 5/6/5 or 5/5/5 format for high color virtual buffers, or the xRGB format for true color virtual buffers.
|
 
copyright 2001 Ted Gruber Software, Inc.