13 while (bit
< length(colors
))
21 while ((getline line
< fin
) > 0)
23 pattern
[height
++] = line
;
24 if (length(line
)>width
)
28 printf ("Processing %s -> %s (%d x %d x %d)\n", fin
, fout
, width
, height
, depth
);
30 for (y=
0; y
<height
; y
++)
37 for (d=
0; d
<depth
; d
++)
40 left=
substr(line
,1,16);
46 cpen=
substr(left
,x
,1);
51 pen=
index(colors
,cpen
);
54 printf ("Error: Unknown pen '%s' in file in line %d\n", cpen
, y
+2);
60 for (d=
0; d
<depth
; d
++)
62 if (pen
/2.0 != int
(pen
/2.0))
64 #printf ("Pos: %d/%d Plane:%d %04x\n", y, xoff, d, bit);
80 printf ("#define %s_WIDTH %d\n", NAME
, width
) >> fout
;
81 printf ("#define %s_HEIGHT %d\n\n", NAME
, height
) >> fout
;
83 # printf ("UWORD %sData[] =\n", name) >> fout;
84 printf ("UBYTE %sData[] =\n", name
) >> fout
;
86 printf ("{\n") >> fout
;
87 xmax=int
((width
+15)/16);
90 for (d=
0; d
<depth
; d
++)
94 for (y=
0; y
<height
; y
++)
98 for (x=
0; x
<xmax
; x
++)
100 # printf (" 0x%04X,", out[y,x,d]) >> fout;
101 printf (" 0x%02X,", out
[y
,x
,d
]/256) >> fout
;
102 printf (" 0x%02X,", out
[y
,x
,d
]%256) >> fout
;
105 printf ("\n") >> fout
;
109 printf ("\n") >> fout
;
111 printf ("};\n\n") >> fout
;
114 printf ("struct Image %sImage =\n{\n", name
) >> fout
;
115 printf (" 0, 0, /* Left, Top */\n") >> fout
;
116 printf (" %s_WIDTH, %s_HEIGHT, /* Width, Height */\n", NAME
, NAME
) >> fout
;
117 printf (" %d, /* Depth */\n", depth
) >> fout
;
118 printf (" (UWORD *)%sData, /* ImageData */\n", name
) >> fout
;
119 printf (" 0x%02X, /* PlanePick */\n", pick
) >> fout
;
120 printf (" 0x00, /* PlaneOnOff */\n") >> fout
;
121 printf (" NULL /* NextImage */\n") >> fout
;
122 printf ("};\n") >> fout
;