From 5b3b7e2609d010298a345eed91255c880b3f9e0f Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Sun, 26 Mar 2000 12:55:03 +0000 Subject: [lcd4linux @ 2000-03-26 12:55:03 by reinelt] enhancements to the PPM driver --- Raster.c | 87 ++++++++++++++++++++++++++++++++++++++++++--------- lcd4linux.c | 21 +++++++------ lcd4linux.conf.sample | 2 +- 3 files changed, 85 insertions(+), 25 deletions(-) diff --git a/Raster.c b/Raster.c index 1159612..f4f86f4 100644 --- a/Raster.c +++ b/Raster.c @@ -1,4 +1,4 @@ -/* $Id: Raster.c,v 1.3 2000/03/25 05:50:43 reinelt Exp $ +/* $Id: Raster.c,v 1.4 2000/03/26 12:55:03 reinelt Exp $ * * driver for raster formats * @@ -20,6 +20,10 @@ * * * $Log: Raster.c,v $ + * Revision 1.4 2000/03/26 12:55:03 reinelt + * + * enhancements to the PPM driver + * * Revision 1.3 2000/03/25 05:50:43 reinelt * * memory leak in Raster_flush closed @@ -48,6 +52,11 @@ #include #include #include +#include +#include +#include +#include + #include "cfg.h" #include "display.h" @@ -67,21 +76,37 @@ static int foreground=0; static int halfground=0; static int background=0; +extern char* output; + + int Raster_flush (void) { + static int seq=0; + static unsigned char *bitbuf=NULL; + static unsigned char *rowbuf=NULL; int xsize, ysize, row, col; unsigned char R[3], G[3], B[3]; - static unsigned char *buffer=NULL; + char path[256], tmp[256], buffer[256]; + int fd; + + xsize=2*border+(Display.cols-1)*cgap+Display.cols*Display.xres*pixel+(Display.cols*Display.xres-1)*pgap; + ysize=2*border+(Display.rows-1)*rgap+Display.rows*Display.yres*pixel+(Display.rows*Display.yres-1)*pgap; - xsize=2*border+(Display.cols-1)*cgap+Display.cols*Display.xres*(pixel+pgap); - ysize=2*border+(Display.rows-1)*rgap+Display.rows*Display.yres*(pixel+pgap); + if (bitbuf==NULL) { + if ((bitbuf=malloc(xsize*ysize*sizeof(*bitbuf)))==NULL) { + fprintf (stderr, "Raster: malloc(%d) failed: %s\n", xsize*ysize*sizeof(*bitbuf), strerror(errno)); + return -1; + } + } - if (buffer==NULL) { - if ((buffer=malloc(xsize*ysize*sizeof(*buffer)))==NULL) + if (rowbuf==NULL) { + if ((rowbuf=malloc(3*xsize*sizeof(*rowbuf)))==NULL) { + fprintf (stderr, "Raster: malloc(%d) failed: %s\n", 3*xsize*sizeof(*rowbuf), strerror(errno)); return -1; + } } - - memset (buffer, 0, xsize*ysize*sizeof(*buffer)); + + memset (bitbuf, 0, xsize*ysize*sizeof(*bitbuf)); for (row=0; row>16; G[0]=0xff&background>>8; B[0]=0xff&background; - + R[1]=0xff&halfground>>16; G[1]=0xff&halfground>>8; B[1]=0xff&halfground; - + R[2]=0xff&foreground>>16; G[2]=0xff&foreground>>8; B[2]=0xff&foreground; for (row=0; row"; +char *output=NULL; int tick, tack; static void usage(void) { printf ("%s\n", release); - printf ("usage: lcd4linux [-h] [-l] [-f config-file]\n"); + printf ("usage: lcd4linux [-h] [-l] [-f config-file] [-o output-file]\n"); } void main (int argc, char *argv[]) @@ -103,7 +108,7 @@ void main (int argc, char *argv[]) char *display; int c, smooth; - while ((c=getopt (argc, argv, "hlf:"))!=EOF) { + while ((c=getopt (argc, argv, "hlf:o:"))!=EOF) { switch (c) { case 'h': usage(); @@ -115,6 +120,9 @@ void main (int argc, char *argv[]) case 'f': cfg=optarg; break; + case 'o': + output=optarg; + break; default: exit(2); } @@ -149,13 +157,6 @@ void main (int argc, char *argv[]) process_init(); - // FIXME: just debugging - lcd_clear(); - lcd_put (1, 1, "so what!"); - lcd_bar (BAR_R|BAR_H2, 2,1,50,19,46); - lcd_flush(); - exit (0); - lcd_clear(); lcd_put (1, 1, "* LCD4Linux V" VERSION " *"); lcd_put (2, 1, " (c) 2000 M.Reinelt"); diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 9be532f..aad16c6 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -5,7 +5,7 @@ #Display X11 DISPLAY PPM -size 10x2 +size 20x4 font 5x8 pixel 3+1 gap 4x4 -- cgit v1.2.3