From: hackbard Date: Wed, 12 Sep 2007 10:20:04 +0000 (+0200) Subject: create a bmp copy with 4 colors + modified default log X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b90619a95d2b4303e21c0b9de3364e3744ca50b1;p=my-code%2Farm.git create a bmp copy with 4 colors + modified default log --- diff --git a/betty/bmp2b.c b/betty/bmp2b.c index 9baf3b5..a2badfd 100644 --- a/betty/bmp2b.c +++ b/betty/bmp2b.c @@ -21,13 +21,15 @@ #define BINARY 1 #define CHAR 2 +#define SHOW 3 int main(int argc,char **argv) { int i,fd; - t_bmp src; + t_bmp src,dst; char in[128]; char out[128]; + char blook[128+8]; unsigned char stat; unsigned char buf[2]; int page,col; @@ -64,9 +66,18 @@ int main(int argc,char **argv) { /* the bitmap infile */ bmp_init(&src,1); src.mode=READ; - strcpy(src.file,in); + strncpy(src.file,in,128); bmp_read_file(&src); + /* the bitmap outfile */ + sprintf(blook,"blook_%s",in); + bmp_init(&dst,1); + dst.mode=WRITE; + strncpy(dst.file,blook,128+8); + dst.width=src.width; + dst.height=src.height; + bmp_alloc_map(&dst); + if((src.width!=DX)|(src.height=!DY)) { printf("wrong dimensions: %d %d (need: %d %d)\n", src.width,src.height,DX,DY); @@ -94,17 +105,29 @@ int main(int argc,char **argv) { if(b<=(0.25*255)) { buf[0]|=(1<