8 #define FILENAME "DIAGONAL.TIL"
\r
9 char fn[100] = FILENAME;
\r
10 typedef unsigned char BYTE;
\r
11 typedef BYTE ROW[16];
\r
12 typedef ROW BITMAP[16];
\r
17 BITMAP pattern={{1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0},
\r
18 {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
\r
19 {1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0},
\r
20 {1,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0},
\r
21 {1,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0},
\r
22 {0,0,1,0,0,1,1,0,1,1,0,0,2,0,0,0},
\r
23 {0,0,1,0,0,1,2,0,1,2,0,0,2,0,0,0},
\r
24 {0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0},
\r
25 {0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0},
\r
26 {0,1,0,0,1,2,0,0,0,1,2,0,0,2,0,0},
\r
27 {0,0,1,0,1,2,1,1,1,1,2,0,2,0,0,0},
\r
28 {0,0,1,0,0,2,2,2,2,2,0,0,2,0,0,2},
\r
29 {0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,2},
\r
30 {0,0,0,0,2,2,0,0,0,2,2,0,0,0,0,2},
\r
31 {0,0,0,0,0,0,2,2,2,0,0,0,0,0,2,2},
\r
32 {0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2}};
\r
34 void copy_pattern(BITMAP b,BITMAP patt, BYTE l, BYTE m, BYTE h)
\r
38 for (y=0; y<16; y++) {
\r
39 for (x=0; x<16; x++) {
\r
40 switch (patt[y][x]) {
\r
55 /* Transforms linear to planar */
\r
56 void transform(BITMAP b,BITMAP c)
\r
59 BYTE *pb = (BYTE *)c;
\r
61 for (p=0; p<4; p++) {
\r
62 for (y=0; y<16; y++) {
\r
63 for (x=0; x<16; x+=4) {
\r
64 *(pb++) = b[y][x+p];
\r
70 void main(int argc,char *argv[])
\r
76 fp = fopen(fn,"wb");
\r
78 printf("Couldn't open %s for write.\n",fn);
\r
82 width = atoi(argv[1]);
\r
85 printf("Width = %d\n",width);
\r
88 for (i = 0; i< width; i++) {
\r
91 less = (BYTE)((i + width - 1) % width);
\r
92 more = (BYTE)((i + 1) % width);
\r
93 copy_pattern(b, pattern, less, (BYTE)i, more);
\r
95 fwrite(c, 16,16, fp);
\r
96 printf("Square %d\r",i);
\r
99 printf("All done! \n");
\r