1
0
Fork 0
forked from len0rd/rockbox

Grayscale library: LCD linearisation and gamma correction.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10402 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-08-02 00:22:01 +00:00
parent 8cc73f152b
commit 628d20a610
11 changed files with 251 additions and 48 deletions

View file

@ -61,31 +61,27 @@ int gray_get_drawmode(void)
/* Set the foreground shade for subsequent drawing operations */
void gray_set_foreground(unsigned brightness)
{
unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127;
_gray_info.fg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */
_gray_info.fg_brightness = brightness;
_gray_info.fg_index = _gray_info.idxtable[brightness];
}
/* Return the current foreground shade */
unsigned gray_get_foreground(void)
{
return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1))
/ _gray_info.depth;
return _gray_info.fg_brightness;
}
/* Set the background shade for subsequent drawing operations */
void gray_set_background(unsigned brightness)
{
unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127;
_gray_info.bg_brightness = (data + (data >> 8)) >> 8; /* approx. data / 255 */
_gray_info.bg_brightness = brightness;
_gray_info.bg_index = _gray_info.idxtable[brightness];
}
/* Return the current background shade */
unsigned gray_get_background(void)
{
return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1))
/ _gray_info.depth;
return _gray_info.bg_brightness;
}
/* Set draw mode, foreground and background shades at once */