bx_color bx_rgb_to_color ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Returns the color suported by the system that best approximates a given RGB (Red,Green,Blue) triplet. The three channels are in the range from 0 to 255 (or from 0x00 to 0xFF in hexadecimal base).

Parameters:
r the red channel, in the range from 0x00 to 0xFF (saturated).
g the green channel, in the range from 0x00 to 0xFF(saturated).
b the blue channel, in the range from 0x00 to 0xFF (saturated).
Returns:
the best matching color for the (r,g,b) triplet that is supported by the system.
Remarks:
  • currently, only TrueColor and PseudoColor video modes are supported.
  • in TrueColor, the system internally allocates a number of bits per channel to encode a color, and any set of such encoded colors may be displayed on screen simultaneously: Triplets encoded on 24 bits (= 8+8+8 bits) and on 16 bits (= 5+6+5 bits) are the most common cases.
  • in PseudoColor, a palette of only 256 colors must be chosen (bx-lib pre-allocates a palette so you a a 6*6*6 RGB cube) and a color is simply an index in this array of colors.
  • (0xFF,0x00,0x00), (0x00,0xFF,0x00), and (0x00,0x00,0xFF) respetively yield red, green and blue.
  • (0xFF,0xFF,0x00), (0xFF,0x00,0xFF), and (0x00,0xFF,0xFF) respectively yield yellow, magenta and cyan.
  • (0x00,0x00,0x00), (0x80,0x80,0x80) and (0xFF,0xFF,0xFF) respectively yield black, gray and white.


Generated on Fri Oct 10 00:01:00 2008 for bx-lib : the Basic X11 Library tuned for C beginners by  doxygen 1.5.6