/* * bmp2b.c - convert colored 24 bit bmp to the betty display ram format * * author: hackbard@hackdaworld.org * changed: damaltor@gmail.com * changelog: edited the first lines of output to fit boop's requirements * the old line is still there, but commented * */ #define _GNU_SOURCE #include #include #include #include #include #include #include "bmp.h" #define DX 128 #define DY 160 #define PM (DY/8) #define BINARY 1 #define CHAR 2 #define SHOW 3 int main(int argc,char **argv) { int i,fd; t_bmp src,dst; char in[128]; char out[128]; char blook[128+8]; unsigned char stat; unsigned char buf[2]; int page,col; int b,pix; stat=0; for(i=1;i -o [-b/c]\n", argv[0]); printf("\n"); printf(" -b: binary out\n"); printf(" -c: char array\n\n"); return -1; } } /* the bitmap infile */ bmp_init(&src,1); src.mode=READ; 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); return -1; } /* out file */ fd=open(out,O_WRONLY|O_CREAT); if(fd<0) { perror("open outfile"); return fd; } if(stat==CHAR) dprintf(fd,"const unsigned char b_w = %d;\nconst unsigned char b_h = %d;\nconst char b_data[] = {\n",DX,DY); // dprintf(fd,"const unsigned char default_logo[%d]={\n",DX*PM*2); // was the old function for(page=0;page