7 #define PALNAME "Diagonal"
\r
8 #define FILENAME "%s.PAL"
\r
9 char fn[100] = FILENAME;
\r
10 typedef unsigned char BYTE;
\r
11 typedef unsigned short int WORD;
\r
12 typedef struct COLOR {
\r
14 } COLOR, far *LPCOLOR;
\r
16 void main() /* int argc, char *argv[]) */
\r
20 int colors = COLORS;
\r
24 sprintf(fn,FILENAME,PALNAME);
\r
25 fp = fopen(fn,"wb");
\r
27 printf("Couldn't open %s for write.\n",fn);
\r
34 for (i = 0; i < colors; i++) {
\r
35 c.r = (BYTE)r; r+=dr;
\r
36 if (r > 63) { r = 63; dr = -dr; }
\r
37 else if (r < 0) { r = 0; dr = -dr; }
\r
38 c.g = (BYTE)g; g+=dg;
\r
39 if (g > 63) { g = 63; dg = -dg; }
\r
40 else if (g < 0) { g = 0; dg = -dg; }
\r
41 c.b = (BYTE)b; b+=db;
\r
42 if (b > 63) { b = 63; db = -db; }
\r
43 else if (b < 0) { b = 0; db = -db; }
\r
44 fwrite(&c, sizeof(c),1, fp);
\r
45 printf("Palette %d\r",i);
\r
48 printf("All done! \n");
\r