From 44e13547adb794928f1cb2247c7cc038af07c924 Mon Sep 17 00:00:00 2001 From: reinelt Date: Sun, 9 Apr 2006 14:17:50 +0000 Subject: [lcd4linux @ 2006-04-09 14:17:49 by reinelt] autoconf/library fixes, image and graphic display inversion git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@655 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- drv_generic_graphic.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'drv_generic_graphic.c') diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c index e56401f..be41cee 100644 --- a/drv_generic_graphic.c +++ b/drv_generic_graphic.c @@ -23,6 +23,9 @@ * * * $Log: drv_generic_graphic.c,v $ + * Revision 1.26 2006/04/09 14:17:50 reinelt + * autoconf/library fixes, image and graphic display inversion + * * Revision 1.25 2006/02/27 07:53:52 reinelt * some more graphic issues fixed * @@ -184,11 +187,16 @@ RGBA NO_COL = { R: 0x00, G: 0x00, B: 0x00, A:0x00 }; static char *Section = NULL; static char *Driver = NULL; -static int LROWS = 0; /* layout size (pixels!) */ -static int LCOLS = 0; /* layout size (pixels!) */ +/* layout size (pixels!) */ +static int LROWS = 0; +static int LCOLS = 0; +/* framebuffer */ static RGBA *drv_generic_graphic_FB[LAYERS] = { NULL, }; +/* inverted colors */ +static int INVERTED = 0; + /* must be implemented by the real driver */ void (*drv_generic_graphic_real_blit) () = NULL; @@ -261,6 +269,12 @@ static RGBA drv_generic_graphic_blend(const int row, const int col) ret.B = (p.B * p.A + ret.B * (255 - p.A)) / 255; } } + if (INVERTED) { + ret.R = 255 - ret.R; + ret.G = 255 - ret.G; + ret.B = 255 - ret.B; + } + return ret; } @@ -649,6 +663,9 @@ int drv_generic_graphic_init(const char *section, const char *driver) if (color) free(color); + /* inverted display? */ + cfg_number(section, "inverted", 0, 0, 1, &INVERTED); + /* register text widget */ wc = Widget_Text; wc.draw = drv_generic_graphic_draw; @@ -705,11 +722,7 @@ unsigned char drv_generic_graphic_gray(const int row, const int col) unsigned char drv_generic_graphic_black(const int row, const int col) { - RGBA p = drv_generic_graphic_blend(row, col); - if (p.R > 127 || p.G > 127 || p.B > 127) { - return 0; - } - return 1; + return drv_generic_graphic_gray(row, col) < 127; } -- cgit v1.2.3