blob: 61a5edeb29c715afc037a3a094831e7391ff255d [file] [log] [blame]
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -08001#include <stdio.h>
2#include <stdlib.h>
3
4int main(int argc, char *argv)
5{
6 unsigned n;
7 unsigned char *x;
8 unsigned m;
9 unsigned run_val;
10 unsigned run_count;
11
12 n = gimp_image.width * gimp_image.height;
13 m = 0;
14 x = gimp_image.pixel_data;
15
16 printf("struct {\n");
17 printf(" unsigned width;\n");
18 printf(" unsigned height;\n");
19 printf(" unsigned cwidth;\n");
20 printf(" unsigned cheight;\n");
21 printf(" unsigned char rundata[];\n");
22 printf("} font = {\n");
23 printf(" .width = %d,\n .height = %d,\n .cwidth = %d,\n .cheight = %d,\n", gimp_image.width, gimp_image.height,
24 gimp_image.width / 96, gimp_image.height);
25 printf(" .rundata = {\n");
26
27 run_val = (*x ? 0 : 255);
28 run_count = 1;
29 n--;
30 x+=3;
31
32 while(n-- > 0) {
33 unsigned val = (*x ? 0 : 255);
34 x+=3;
35 if((val == run_val) && (run_count < 127)) {
36 run_count++;
37 } else {
38eject:
39 printf("0x%02x,",run_count | (run_val ? 0x80 : 0x00));
40 run_val = val;
41 run_count = 1;
42 m += 5;
43 if(m >= 75) {
44 printf("\n");
45 m = 0;
46 }
47 }
48 }
49 printf("0x%02x,",run_count | (run_val ? 0x80 : 0x00));
50 printf("\n0x00,");
51 printf("\n");
52 printf(" }\n};\n");
53 return 0;
54}