]> hackdaworld.org Git - my-code/arm.git/commitdiff
create a bmp copy with 4 colors + modified default log
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 12 Sep 2007 10:20:04 +0000 (12:20 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 12 Sep 2007 10:20:04 +0000 (12:20 +0200)
betty/bmp2b.c
betty/default_logo.h

index 9baf3b57b1da11ad14d545e67036deb192f0cf38..a2badfd719b2f381cfc5007346e539fb6cc7f9be 100644 (file)
 
 #define BINARY 1
 #define CHAR   2
 
 #define BINARY 1
 #define CHAR   2
+#define SHOW   3
 
 int main(int argc,char **argv) {
 
        int i,fd;
 
 int main(int argc,char **argv) {
 
        int i,fd;
-       t_bmp src;
+       t_bmp src,dst;
        char in[128];
        char out[128];
        char in[128];
        char out[128];
+       char blook[128+8];
        unsigned char stat;
        unsigned char buf[2];
        int page,col;
        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;
        /* the bitmap infile */
        bmp_init(&src,1);
        src.mode=READ;
-       strcpy(src.file,in);
+       strncpy(src.file,in,128);
        bmp_read_file(&src);
 
        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);
        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<<i);
                                        buf[1]|=(1<<i); // 1 1
                                if(b<=(0.25*255)) {
                                        buf[0]|=(1<<i);
                                        buf[1]|=(1<<i); // 1 1
+                                       dst.map[pix].r=0;
+                                       dst.map[pix].g=0;
+                                       dst.map[pix].b=0;
                                        continue;
                                }
                                if(b<=(0.5*255)) {
                                        buf[0]|=(1<<i); // 1 0
                                        continue;
                                }
                                if(b<=(0.5*255)) {
                                        buf[0]|=(1<<i); // 1 0
+                                       dst.map[pix].r=0.25*255;
+                                       dst.map[pix].g=0.25*255;
+                                       dst.map[pix].b=0.25*255;
                                        continue;
                                }
                                if(b<=(0.75*255)) {
                                        buf[1]|=(1<<i); // 0 1
                                        continue;
                                }
                                if(b<=(0.75*255)) {
                                        buf[1]|=(1<<i); // 0 1
+                                       dst.map[pix].r=0.75*255;
+                                       dst.map[pix].g=0.75*255;
+                                       dst.map[pix].b=0.75*255;
                                        continue;
                                }
                                // 0 0 .. do nothing!
                                        continue;
                                }
                                // 0 0 .. do nothing!
+                               dst.map[pix].r=255;
+                               dst.map[pix].g=255;
+                               dst.map[pix].b=255;
                        }
                        if(stat==BINARY) {
                                i=write(fd,buf,2);
                        }
                        if(stat==BINARY) {
                                i=write(fd,buf,2);
@@ -127,8 +150,11 @@ int main(int argc,char **argv) {
        if(stat==CHAR)
                dprintf(fd,"};\n");
 
        if(stat==CHAR)
                dprintf(fd,"};\n");
 
+       bmp_write_file(&dst);
+
        close(fd);
        bmp_shutdown(&src);
        close(fd);
        bmp_shutdown(&src);
+       bmp_shutdown(&dst);
 
        return 0;
 }
 
        return 0;
 }
index b890c5a7255904ea101c0c70c8ffaf8ddf94740c..93c6cb7c8c8cca4ca112e2553b4f760f0282d604 100644 (file)
@@ -2049,7 +2049,7 @@ unsigned char default_logo[5120]={
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
-       ff,00,
+       00,ff,
        ff,ff,
        ff,ff,
        ff,ff,
        ff,ff,
        ff,ff,
        ff,ff,
@@ -2177,39 +2177,39 @@ unsigned char default_logo[5120]={
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
-       3f,c0,
-       ff,1f,
-       ff,1f,
-       ff,1f,
-       ff,1f,
-       ff,1f,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,1e,
-       ff,0e,
-       ff,1e,
-       ff,0e,
-       ff,0e,
-       ff,0f,
-       ff,0f,
-       ff,0f,
-       ff,0f,
-       ff,0f,
+       00,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,fe,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
        00,ff,
        00,00,
        00,00,
        00,ff,
        00,00,
        00,00,
@@ -2305,40 +2305,40 @@ unsigned char default_logo[5120]={
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
-       00,e7,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       03,fc,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       01,fe,
-       00,e0,
+       00,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,ff,
+       ff,df,
+       00,ff,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
@@ -2433,40 +2433,40 @@ unsigned char default_logo[5120]={
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
-       00,00,
-       00,0f,
-       00,4f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       00,4f,
-       00,4f,
-       40,0f,
-       00,cf,
-       40,8f,
-       40,8f,
-       40,8f,
-       00,cf,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       40,0f,
-       00,4f,
-       00,0f,
-       00,01,
+       00,07,
+       0f,17,
+       3f,5f,
+       7f,3f,
+       7f,7f,
+       7f,bf,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       ff,7f,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,ff,
+       7f,3f,
+       3f,7f,
+       3f,1f,
+       0f,17,
+       00,02,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,
        00,00,