]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2000-03-26 20:00:44 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 26 Mar 2000 20:00:44 +0000 (20:00 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 26 Mar 2000 20:00:44 +0000 (20:00 +0000)
README.Raster added

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@24 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

README.Raster [new file with mode: 0644]
Raster.c
cfg.c
lcd4linux.conf.sample

diff --git a/README.Raster b/README.Raster
new file mode 100644 (file)
index 0000000..b0e05b4
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# $Id: README.Raster,v 1.1 2000/03/26 20:00:44 reinelt Exp $
+#
+
+This is the README file for the Raster display driver for lcd4linux
+
+This driver is intended to create various raster formats, at the moment 
+only binary PPM (portable pixmap) is supported.
+
+The driver creates the output file(s) specified with the -o switch. The
+parameter is used as a format string for sprintf(), if you specify '%d'
+in the output file, files with a sequence number will be created.
+
+The output file is first created with a '.tmp' extension, this temporary
+file will be written and closed, and finally (atomically) renamed. This way
+you can be shure that you will always get a complete file, but its contents
+changes every 'tick' milliseconds. 
+
+Configuration:
+
+The driver needs/supports the following entries in lcd4linux.conf:
+
+Display: must be "PPM"
+size: [columns]x[rows], e.g. "20x4"
+font: [xrex]x[yres], at the moment only "5x8" and "6x8" supported.
+pixel: [pixelsize]+[pixelgap], e.g. "5+1"
+gap: [row gap]x[column gap], e.g. "3x3"
+border: border width
+foreground: color of an active LCD Pixel, must be #rrggbb
+halfground: color of an inactive LCD Pixel, must be #rrggbb
+background: backlight color, must be #rrggbb
+
+This may look weird, but it is weird. Let's explain this a bit further:
+The raster driver tries to emulate a real LC display. A real LCD has a
+size of columns*rows characters. Each character consists of xres*yres 
+LCD cells. One single cell will be represented by a rectangle of
+pixelsize*pixelsize pixels. If you want to, you can emulate the gap 
+between this lcd cells by specifying a pixelgap greater than zero.
+Sometimes there's a gap between characters, too. You can specify this 
+gap (in pixels again) horizontally and vertically. Usually this gap
+is the same size as a cell (which is pixelsize+pixelgap). 
+
+If you use a font of 5x8, some characters may use the first and the last 
+pixel. So you should specify a column gap, otherwise the caracters may 
+touch. On the other hand, the 6x8 font never uses the first pixel. So you 
+can omit the column gap, and will get the same text layout, but 
+uninterupted bars!
+
+After all: don't try to understand this unless you have tried it out!
index 78f2b9a64c5e1db7bc05ededd6ec1e5ae2bd8aba..22b88199ab0079ea849d61ee728cc7b4f1b83795 100644 (file)
--- a/Raster.c
+++ b/Raster.c
@@ -1,4 +1,4 @@
-/* $Id: Raster.c,v 1.6 2000/03/26 19:03:52 reinelt Exp $
+/* $Id: Raster.c,v 1.7 2000/03/26 20:00:44 reinelt Exp $
  *
  * driver for raster formats
  *
  *
  *
  * $Log: Raster.c,v $
+ * Revision 1.7  2000/03/26 20:00:44  reinelt
+ *
+ * README.Raster added
+ *
  * Revision 1.6  2000/03/26 19:03:52  reinelt
  *
  * more Pixmap renaming
@@ -82,9 +86,9 @@ static int rgap=0;
 static int cgap=0;
 static int border=0;
 
-static int foreground=0;
-static int halfground=0;
-static int background=0;
+static unsigned int foreground=0;
+static unsigned int halfground=0;
+static unsigned int background=0;
 
 extern char* output;
 
@@ -222,9 +226,18 @@ int Raster_init (LCD *Self)
 
   border=atoi(cfg_get("border")?:"0");
 
-  foreground=strtol(cfg_get("foreground")?:"000000", NULL, 16);
-  halfground=strtol(cfg_get("halfground")?:"ffffff", NULL, 16);
-  background=strtol(cfg_get("background")?:"ffffff", NULL, 16);
+  if (sscanf(s=cfg_get("foreground")?:"#102000", "#%x", &foreground)!=1) {
+    fprintf (stderr, "Raster: bad foreground color '%s'\n", s);
+    return -1;
+  }
+  if (sscanf(s=cfg_get("halfground")?:"#70c000", "#%x", &halfground)!=1) {
+    fprintf (stderr, "Raster: bad halfground color '%s'\n", s);
+    return -1;
+  }
+  if (sscanf(s=cfg_get("background")?:"#80d000", "#%x", &background)!=1) {
+    fprintf (stderr, "Raster: bad background color '%s'\n", s);
+    return -1;
+  }
 
   if (pix_init (rows, cols, xres, yres)!=0) {
     fprintf (stderr, "Raster: pix_init(%d, %d, %d, %d) failed\n", rows, cols, xres, yres);
diff --git a/cfg.c b/cfg.c
index 1e0df084e6c56619aa628fd17f1d0b331770fac2..fcb96511d10c9dea4e39be6a8effb75d4be20cbc 100644 (file)
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.3 2000/03/26 19:03:52 reinelt Exp $
+/* $Id: cfg.c,v 1.4 2000/03/26 20:00:44 reinelt Exp $
  *
  * config file stuff
  *
  *
  *
  * $Log: cfg.c,v $
+ * Revision 1.4  2000/03/26 20:00:44  reinelt
+ *
+ * README.Raster added
+ *
  * Revision 1.3  2000/03/26 19:03:52  reinelt
  *
  * more Pixmap renaming
@@ -89,7 +93,6 @@ static char *strip (char *s)
   for (p=s; *p; p++) {
     if (*p=='"') do p++; while (*p && *p!='\n' && *p!='"');
     if (*p=='\'') do p++; while (*p && *p!='\n' && *p!='\'');
-    if (p>s && *(p-1)=='\\' && *p=='#')
     if (*p=='\n' || (*p=='#' && (p==s || *(p-1)!='\\'))) {
       *p='\0';
       break;
@@ -99,6 +102,17 @@ static char *strip (char *s)
   return s;
 }
 
+static char *dequote (char *string)
+{
+  char *s=string;
+  char *p=string;
+  
+  do {
+    if (*s!='\\') *p++=*s;
+  } while (*s++);
+  
+  return string;
+}
 
 void cfg_set (char *key, char *val)
 {
@@ -107,17 +121,16 @@ void cfg_set (char *key, char *val)
   for (i=0; i<nConfig; i++) {
     if (strcasecmp(Config[i].key, key)==0) {
       if (Config[i].val) free (Config[i].val);
-      Config[i].val=strdup(val);
+      Config[i].val=dequote(strdup(val));
       return;
     }
   }
   nConfig++;
   Config=realloc(Config, nConfig*sizeof(ENTRY));
   Config[i].key=strdup(key);
-  Config[i].val=strdup(val);
+  Config[i].val=dequote(strdup(val));
 }
 
-
 char *cfg_get (char *key)
 {
   int i;
@@ -130,7 +143,6 @@ char *cfg_get (char *key)
   return NULL;
 }
 
-
 int cfg_read (char *file)
 {
   FILE *stream;
@@ -171,7 +183,6 @@ int cfg_read (char *file)
   return 0;
 }
 
-
 char *cfg_file (void)
 {
   if (Config_File)
index 4c27373560620d322c81c7b4b7cc862153f66836..631abdd938ac9304ef632a2155e3646314b45fcd 100644 (file)
@@ -3,20 +3,16 @@
 #Speed 19200
 #Contrast 160
 
-Display xlcd
-#Display PPM
+#Display xlcd
+Display PPM
 size 20x4
 font 5x8
 pixel 3+0
 gap 3x3
 border 5
-foreground black
-halfground gray
-background wheat
-
-#foreground 102000
-#halfground 70c000
-#background 80d000
+foreground \#102000
+halfground \#70c000
+background \#80d000
 
 
 #Row1 "*** %o %v ***"