aboutsummaryrefslogtreecommitdiffstats
path: root/pixmap.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2000-03-24 11:36:56 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2000-03-24 11:36:56 +0000
commit108ff7e83d8a69ef209e269c1a836f47fb425799 (patch)
tree1b31309b468fb2de31bf93282e40b7279844e5f9 /pixmap.c
parent965f2f1d917c26c87e6ef5e86ae9d5fca307d432 (diff)
downloadlcd4linux-108ff7e83d8a69ef209e269c1a836f47fb425799.tar.gz
[lcd4linux @ 2000-03-24 11:36:56 by reinelt]
new syntax for raster configuration changed XRES and YRES to be configurable PPM driver works nice git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@18 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'pixmap.c')
-rw-r--r--pixmap.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/pixmap.c b/pixmap.c
index 48343cb..24a65be 100644
--- a/pixmap.c
+++ b/pixmap.c
@@ -1,4 +1,4 @@
-/* $Id: pixmap.c,v 1.2 2000/03/23 07:24:48 reinelt Exp $
+/* $Id: pixmap.c,v 1.3 2000/03/24 11:36:56 reinelt Exp $
*
* generic pixmap driver
*
@@ -20,6 +20,12 @@
*
*
* $Log: pixmap.c,v $
+ * Revision 1.3 2000/03/24 11:36:56 reinelt
+ *
+ * new syntax for raster configuration
+ * changed XRES and YRES to be configurable
+ * PPM driver works nice
+ *
* Revision 1.2 2000/03/23 07:24:48 reinelt
*
* PPM driver up and running (but slow!)
@@ -38,8 +44,8 @@
* int pix_clear(void);
* clears the pixmap
*
- * int pix_init (int r, int c);
- * allocates & clear pixmap wit r rows and c columns
+ * int pix_init (int rows, int cols, int XRES, int YRES);
+ * allocates & clears pixmap
*
* int pix_put (int row, int col, char *text);
* draws text into the pixmap
@@ -56,33 +62,38 @@
#include "pixmap.h"
#include "fontmap.h"
-static int rows=0;
-static int cols=0;
+static int ROWS=0;
+static int COLS=0;
+static int XRES=0;
+static int YRES=0;
+
unsigned char *Pixmap=NULL;
int pix_clear(void)
{
int i;
- for (i=0; i<rows*cols; i++) {
+ for (i=0; i<ROWS*COLS; i++) {
Pixmap[i]=0;
}
return 0;
}
-int pix_init (int r, int c)
+int pix_init (int rows, int cols, int xres, int yres)
{
- if (r<1 || c<1)
+ if (rows<1 || cols<1 || xres<1 || yres<1)
return -1;
if (Pixmap)
free (Pixmap);
- rows=r*YRES;
- cols=c*XRES;
+ XRES=xres;
+ YRES=yres;
+ ROWS=rows*yres;
+ COLS=cols*xres;
- if ((Pixmap=malloc (rows*cols*sizeof(unsigned char)))==NULL)
+ if ((Pixmap=malloc (ROWS*COLS*sizeof(unsigned char)))==NULL)
return -1;
return pix_clear();
@@ -95,13 +106,13 @@ int pix_put (int row, int col, char *text)
row*=YRES;
col*=XRES;
- while (*text && col<cols) {
+ while (*text && col<COLS) {
c=*text;
for (y=0; y<YRES; y++) {
mask=1<<XRES;
for (x=0; x<XRES; x++) {
mask>>=1;
- Pixmap[(row+y)*cols+col+x]=Fontmap[c][y]&mask?1:0;
+ Pixmap[(row+y)*COLS+col+x]=Fontmap[c][y]&mask?1:0;
}
}
col+=XRES;
@@ -118,11 +129,11 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
col*=XRES;
if (type & BAR_H) {
- if (max>cols-col)
- max=cols-col;
+ if (max>COLS-col)
+ max=COLS-col;
} else {
- if (max>rows-row)
- max=rows-row;
+ if (max>ROWS-row)
+ max=ROWS-row;
}
if (len1<1) len1=1;
@@ -143,7 +154,7 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
for (y=0; y<YRES; y++) {
len=y<YRES/2?len1:len2;
for (x=0; x<max; x++) {
- Pixmap[(row+y)*cols+col+x]=x<len?!rev:rev;
+ Pixmap[(row+y)*COLS+col+x]=x<len?!rev:rev;
}
}
break;
@@ -157,7 +168,7 @@ int pix_bar (int type, int row, int col, int max, int len1, int len2)
for (y=0; y<max; y++) {
for (x=0; x<XRES; x++) {
len=x<XRES/2?len1:len2;
- Pixmap[(row+y)*cols+col+x]=y<len?!rev:rev;
+ Pixmap[(row+y)*COLS+col+x]=y<len?!rev:rev;
}
}
break;