/* $Id$ * $URL$ * * new style Image (PPM/PNG) Driver for LCD4Linux * * Copyright (C) 2003 Michael Reinelt * Copyright (C) 2004 The LCD4Linux Team * * This file is part of LCD4Linux. * * LCD4Linux 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. * * LCD4Linux 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. * */ /* * * exported fuctions: * * struct DRIVER drv_Image * */ #include "config.h" #include #include #include #include #include #include #include #include #ifdef WITH_PNG #ifdef HAVE_GD_GD_H #include #else #ifdef HAVE_GD_H #include #else #error "gd.h not found!" #error "cannot compile PNG driver" #endif #endif #if GD2_VERS != 2 #error "lcd4linux requires libgd version 2" #error "cannot compile PNG driver" #endif #endif #include "debug.h" #include "cfg.h" #include "timer.h" #include "qprintf.h" #include "plugin.h" #include "drv.h" #include "drv_generic_graphic.h" #ifdef WITH_DMALLOC #include #endif static char Name[] = "Image"; static enum { NIL, PPM, PNG } Format; static int pixel = -1; /* pointsize in pixel */ static int pgap = 0; /* gap between points */ static int rgap = 0; /* row gap between lines */ static int cgap = 0; /* column gap between characters */ static int border = 0; /* window border */ static int dimx, dimy; /* total window dimension in pixel */ static RGBA BC; static RGBA *drv_IMG_FB = NULL; static int dirty = 1; /****************************************/ /*** hardware dependant functions ***/ /****************************************/ #ifdef WITH_PPM static int drv_IMG_flush_PPM(void) { static int seq = 0; static RGBA *bitbuf = NULL; static unsigned char *rowbuf = NULL; int xsize, ysize, row, col, i; char path[256], tmp[256], buffer[256]; int fd; xsize = 2 * border + (DCOLS / XRES - 1) * cgap + DCOLS * pixel + (DCOLS - 1) * pgap; ysize = 2 * border + (DROWS / YRES - 1) * rgap + DROWS * pixel + (DROWS - 1) * pgap; if (bitbuf == NULL) { if ((bitbuf = malloc(xsize * ysize * sizeof(*bitbuf))) == NULL) { error("%s: malloc() failed: %s", Name, strerror(errno)); return -1; } } if (rowbuf == NULL) { if ((rowbuf = malloc(3 * xsize * sizeof(*rowbuf))) == NULL) { error("Raster: malloc() failed: %s", strerror(errno)); return -1; } } for (i = 0; i < xsize * ysize; i++) { bitbuf[i] = BC; } for (row = 0;
# Sweden - Nordanede
[CHANNEL]
	DELIVERY_SYSTEM = DVBT
	FREQUENCY = 666000000
	BANDWIDTH_HZ = 8000000
bad %s.Gap '%s' from %s", Name, section, s, cfg_source()); free(s); return -1; } free(s); if (rgap < 0) rgap = pixel + pgap; if (cgap < 0) cgap = pixel + pgap; if (cfg_number(section, "border", 0, 0, -1, &border) < 0) return -1; s = cfg_get(section, "basecolor", "000000ff"); if (color2RGBA(s, &BC) < 0) { error("%s: ignoring illegal color '%s'", Name, s); } free(s); drv_IMG_FB = malloc(DCOLS * DROWS * sizeof(*drv_IMG_FB)); if (drv_IMG_FB == NULL) { error("%s: framebuffer could not be allocated: malloc() failed", Name); return -1; } for (i = 0; i < DCOLS * DROWS; i++) { drv_IMG_FB[i] = BC; } dimx = DCOLS * pixel + (DCOLS - 1) * pgap + (DCOLS / XRES - 1) * cgap; dimy = DROWS * pixel + (DROWS - 1) * pgap + (DROWS / YRES - 1) * rgap; /* initially flush the image to a file */ drv_IMG_flush(); /* regularly flush the image to a file */ /* Fixme: make 100msec configurable */ timer_add(drv_IMG_timer, NULL, 100, 0); return 0; } /****************************************/ /*** plugins ***/ /****************************************/ /* none at the moment... */ /****************************************/ /*** exported functions ***/ /****************************************/ /* list models */ int drv_IMG_list(void) { #ifdef WITH_PPM printf("PPM "); #endif #ifdef WITH_PNG printf("PNG "); #endif return 0; } /* initialize driver & display */ int drv_IMG_init(const char *section, const __attribute__ ((unused)) int quiet) { int ret; info("%s: %s", Name, "$Rev$"); /* real worker functions */ drv_generic_graphic_real_blit = drv_IMG_blit; /* start display */ if ((ret = drv_IMG_start(section)) != 0) return ret; /* initialize generic graphic driver */ if ((ret = drv_generic_graphic_init(section, Name)) != 0) return ret; /* register plugins */ /* none at the moment... */ return 0; } /* close driver & display */ int drv_IMG_quit(const __attribute__ ((unused)) int quiet) { info("%s: shutting down.", Name); drv_generic_graphic_quit(); if (drv_IMG_FB) { free(drv_IMG_FB); drv_IMG_FB = NULL; } return (0); } DRIVER drv_Image = { .name = Name, .list = drv_IMG_list, .init = drv_IMG_init, .quit = drv_IMG_quit, };