38 |
|
extern int getgifpix(); |
39 |
|
|
40 |
|
COLR *scanln; |
41 |
+ |
BYTE *pixscan; |
42 |
|
|
43 |
|
int xmax, ymax; /* picture size */ |
44 |
|
|
46 |
|
|
47 |
|
int greyscale = 0; /* convert to B&W? */ |
48 |
|
|
49 |
+ |
int dither = 1; /* dither colors? */ |
50 |
+ |
|
51 |
|
int bradj = 0; /* brightness adjustment */ |
52 |
|
|
53 |
|
char *progname; |
77 |
|
case 'b': |
78 |
|
greyscale = 1; |
79 |
|
break; |
80 |
+ |
case 'd': |
81 |
+ |
dither = !dither; |
82 |
+ |
break; |
83 |
|
case 'c': |
84 |
|
ncolors = atoi(argv[++i]); |
85 |
|
break; |
160 |
|
if (bradj) |
161 |
|
shiftcolrs(scanln, xmax, bradj); |
162 |
|
colrs_gambs(scanln, xmax); |
163 |
+ |
if (pixscan != NULL) |
164 |
+ |
dith_colrs(pixscan, scanln, xmax); |
165 |
|
} |
166 |
|
|
167 |
|
|
181 |
|
gmap[i] = clrtab[i][GRN]; |
182 |
|
bmap[i] = clrtab[i][BLU]; |
183 |
|
} |
184 |
+ |
if (dither && (pixscan = (BYTE *)malloc(xmax)) == NULL) { |
185 |
+ |
fprintf(stderr, "%s: out of memory\n", progname); |
186 |
+ |
exit(1); |
187 |
+ |
} |
188 |
|
} |
189 |
|
|
190 |
|
|
210 |
|
getrow(y); |
211 |
|
if (greyscale) |
212 |
|
return(normbright(scanln[x])); |
213 |
+ |
if (pixscan != NULL) |
214 |
+ |
return(pixscan[x]); |
215 |
|
return(map_pixel(scanln[x])); |
216 |
|
} |
217 |
|
|