2 * bmp2b.c - convert colored 24 bit bmp to the betty display ram format
4 * author: hackbard@hackdaworld.org
13 #include <sys/types.h>
25 int main(int argc,char **argv) {
42 strncpy(in,argv[++i],128);
45 strncpy(out,argv[++i],128);
55 printf("%s -i <bitmap> -o <out file> [-b/c]\n",
58 printf(" -b: binary out\n");
59 printf(" -c: char array\n\n");
64 /* the bitmap infile */
70 if((src.width!=DX)|(src.height=!DY)) {
71 printf("wrong dimensions: %d %d (need: %d %d)\n",
72 src.width,src.height,DX,DY);
77 fd=open(out,O_WRONLY|O_CREAT);
79 perror("open outfile");
84 dprintf(fd,"unsigned char default_logo[%d]={\n",DX*PM*2);
86 for(page=0;page<PM;page++) {
87 for(col=0;col<DX;col++) {
91 pix=((page*8+i)*DX)+col;
92 b=src.map[pix].r+src.map[pix].g+src.map[pix].b;
96 buf[1]|=(1<<i); // 1 1
100 buf[0]|=(1<<i); // 1 0
104 buf[1]|=(1<<i); // 0 1
107 // 0 0 .. do nothing!
116 printf("write failure\n");
120 else if(stat==CHAR) {
121 dprintf(fd,"\t%02x,%02x%c\n",buf[0],buf[1],
122 ((page+1==PM)&(col+1==DX))?' ':',');