X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fbmp2b.c;h=0010f15b329bc1616dadbdd8b781d9fa86224018;hp=9baf3b57b1da11ad14d545e67036deb192f0cf38;hb=HEAD;hpb=69c590669acb39977d264c7c2103e0d2582b2e36 diff --git a/betty/bmp2b.c b/betty/bmp2b.c index 9baf3b5..0010f15 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); @@ -81,30 +92,43 @@ int main(int argc,char **argv) { } if(stat==CHAR) - dprintf(fd,"unsigned char default_logo[%d]={\n",DX*PM*2); + dprintf(fd,"const unsigned char default_logo[%d]={\n",DX*PM*2); for(page=0;page