Hi!
Ok i did the modifications for RLE encoding the picture
I included my quickndirty perl program that converts the image from gimp to the
RLE compressed image as c header. Requirements for converting any logo to this:
- input image in header file format (gimp)
- 8 colors (palette values needs to be entered in perl script)
- 150px wide (could be changed in gui.c)
-> convert it into header with the perl file in the attached tgz
Here is the new gui.c code (also in tgz):
Index: core/gui.c
===================================================================
--- core/gui.c (revision 469)
+++ core/gui.c (working copy)
@@ -29,6 +29,7 @@
#include "script.h"
#include "motion_detector.h"
#include "raw.h"
+#include "gui_logo.h"
//-------------------------------------------------------------------
@@ -2179,11 +2180,35 @@
}
w=w*FONT_WIDTH+10;
- x = (screen_width-w)>>1; y = (screen_height-h)>>1;
+ x = (screen_width-w)>>1; y = ((screen_height-h)>>1) + 20;
draw_filled_round_rect(x, y, x+w, y+h, cl);
for (i=0; i<sizeof(text)/sizeof(text[0]); ++i) {
draw_string(x+((w-strlen(text[i])*FONT_WIDTH)>>1), y+i*FONT_HEIGHT+4, text[i], cl);
}
+
+ int pos;
+ int mx=0;
+ int my=0;
+ int offset_x = (screen_width-150)>>1;
+ int offset_y = ((screen_height-84)>>1) - 42;
+ const color color_lookup[8] = {0xFF, 0x2E, 0x22, 0x3D, 0x1F, 0x21, 0x00, 0x11};
+
+ for(pos=0; pos<HEADER_DATA_LEN; pos++){
+ char data = header_data[pos];
+ color c = color_lookup[(data>>5) & 0x07];
+ for(i=0; i<(data&0x1F)+1; i++){
+ if (c!=0x00){
+ draw_pixel(offset_x+mx,offset_y+my,c);
+ }
+ if (mx==149){
+ mx=0;
+ my++;
+ }else{
+ mx++;
+ }
+
+ }
+ }
}
//-------------------------------------------------------------------
This way i could shrink the image from 12600 bytes (it was completely unoptimized)
down to 2457Bytes (=only 615 x 32 bit !)
The code to decode it is also very small (could be optimized for runtime i guess but not necessary)
Btw saving the image uncompressed as 8 colors/px would result in 4725Bytes
I think RLE is the best solution for the image. And wasting 615 words (32 bit each) should be no problem