394
Platforms
©2000-2008 Tibbo Technology Inc.
Color displays
For color displays (lcd.paneltyle= 1- PL_LCD_PANELTYPE_COLOR), three additional
R/O properties --
,
-- will
indicate how many bits are available in each color channel, and also how three
color fields are combined into a word describing the overall color of the pixel. You
need to know this for setting pixels, as well as defining the foreground/background
color used in drawing lines and rectangles, filling areas, and printing text (see
Working With Pixels and Colors
).
These three properties are of word type. Each 16-bit value packs two 8-bit
parameters: number of bits per pixel for this color channel (high byte) and the bit
position of the field in the color word (low byte). Supposing, lcd.redbits=&h0500,
lcd.bluebits=&h0605, and lcd.greenbits=&h050B. You reconstruct the composition
of the red, green, and blue bits in a word:
In this example, the red field is the first one on the right, followed by the blue field
(this field starts from bit 5), then green field (starts from bit 11 or 7hB). You now
also know that there are 5
2
= 32 brightness levels for red and green, and 64
brightness levels for blue.
You can use this detailed information to select color values that will work correctly
on all color displays, even those you haven't tested yet. Here is a useful example
where you work out three constants -- color_red, color_green, and color_blue --
that will universally work for any color display.
427
420
415
395