/* $Id: widget_icon.c,v 1.7 2004/02/15 21:43:43 reinelt Exp $ * * icon widget handling * * Copyright 2003,2004 Michael Reinelt * Copyright 2004 The LCD4Linux Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * $Log: widget_icon.c,v $ * Revision 1.7 2004/02/15 21:43:43 reinelt * T6963 driver nearly finished * framework for graphic displays done * i2c_sensors patch from Xavier * some more old generation files removed * * Revision 1.6 2004/02/07 13:45:23 reinelt * icon visibility patch #2 from Xavier * * Revision 1.5 2004/02/04 19:11:44 reinelt * icon visibility patch from Xavier * * Revision 1.4 2004/01/30 20:57:56 reinelt * HD44780 patch from Martin Hejl * dmalloc integrated * * Revision 1.3 2004/01/29 04:40:03 reinelt * every .c file includes "config.h" now * * Revision 1.2 2004/01/23 07:04:39 reinelt * icons finished! * * Revision 1.1 2004/01/23 04:54:03 reinelt * icon widget added (not finished yet!) * */ /* * exported functions: * * WIDGET_CLASS Widget_Icon * the icon widget * */ #include "config.h" #include #include #include #include #include "debug.h" #include "cfg.h" #include "evaluator.h" #include "timer.h" #include "widget.h" #include "widget_icon.h" #ifdef WITH_DMALLOC #include #endif // icons always are 8 pixels high #define YRES 8 static void widget_icon_read_bitmap (char *section, WIDGET_ICON *Icon) { int row, n; char key[15]; char *val, *v; unsigned char *map; for (row=0; rowbitmap+row; n=0; for (v=val; *v!='\0'; v++) { if (n>=Icon->maxmap) { Icon->maxmap++; Icon->bitmap=realloc(Icon->bitmap, Icon->maxmap*YRES*sizeof(char)); memset (Icon->bitmap+n*YRES, 0, YRES*sizeof(char)); map=Icon->bitmap+n*YRES+row; } switch (*v) { case '|': n++; map+=YRES; break; case '*': (*map)<<=1; (*map)|=1; break; default: (*map)<<=1; } } } } void widget_icon_update (void *Self) { WIDGET *W = (WIDGET*)Self; WIDGET_ICON *Icon = W->data; RESULT result = {0, 0.0, NULL}; // evaluate expres
<html><head>
<title>PNG Test</title>
</head>
<body>
<h1>PNG test</h1>
<img src=/cgi-bin/nph-png>
</body>
</html>