6 sub(/.
*\
//,"",name
); # strip path
14 while (bit
< length(colors
))
22 while ((getline line
< fin
) > 0)
24 pattern
[height
++] = line
;
25 if (length(line
)>width
)
29 printf ("Processing %s -> %s (%d x %d x %d)\n", fin
, fout
, width
, height
, depth
);
31 for (y=
0; y
<height
; y
++)
38 for (d=
0; d
<depth
; d
++)
41 left=
substr(line
,1,16);
47 cpen=
substr(left
,x
,1);
52 pen=
index(colors
,cpen
);
55 printf ("Error: Unknown pen '%s' in file in line %d\n", cpen
, y
+2);
61 for (d=
0; d
<depth
; d
++)
63 if (pen
/2.0 != int
(pen
/2.0))
65 #printf ("Pos: %d/%d Plane:%d %04x\n", y, xoff, d, bit);
81 printf ("#define %s_WIDTH %d\n", NAME
, width
) >> fout
;
82 printf ("#define %s_HEIGHT %d\n\n", NAME
, height
) >> fout
;
84 # printf ("UWORD %sData[] =\n", name) >> fout;
85 printf ("UBYTE %sData[] =\n", name
) >> fout
;
87 printf ("{\n") >> fout
;
88 xmax=int
((width
+15)/16);
91 for (d=
0; d
<depth
; d
++)
95 for (y=
0; y
<height
; y
++)
99 for (x=
0; x
<xmax
; x
++)
101 # printf (" 0x%04X,", out[y,x,d]) >> fout;
102 printf (" 0x%02X,", out
[y
,x
,d
]/256) >> fout
;
103 printf (" 0x%02X,", out
[y
,x
,d
]%256) >> fout
;
106 printf ("\n") >> fout
;
110 printf ("\n") >> fout
;
112 printf ("};\n\n") >> fout
;
115 printf ("struct Image %sImage =\n{\n", name
) >> fout
;
116 printf (" 0, 0, /* Left, Top */\n") >> fout
;
117 printf (" %s_WIDTH, %s_HEIGHT, /* Width, Height */\n", NAME
, NAME
) >> fout
;
118 printf (" %d, /* Depth */\n", depth
) >> fout
;
119 printf (" (UWORD *)%sData, /* ImageData */\n", name
) >> fout
;
120 printf (" 0x%02X, /* PlanePick */\n", pick
) >> fout
;
121 printf (" 0x00, /* PlaneOnOff */\n") >> fout
;
122 printf (" NULL /* NextImage */\n") >> fout
;
123 printf ("};\n") >> fout
;