--- ray/src/px/ra_gif.c 1994/03/30 14:24:52 2.1 +++ ray/src/px/ra_gif.c 1994/05/03 10:06:32 2.2 @@ -38,6 +38,7 @@ extern BYTE clrtab[][3]; extern int getgifpix(); COLR *scanln; +BYTE *pixscan; int xmax, ymax; /* picture size */ @@ -45,6 +46,8 @@ double gamv = 2.2; /* gamma correction */ int greyscale = 0; /* convert to B&W? */ +int dither = 1; /* dither colors? */ + int bradj = 0; /* brightness adjustment */ char *progname; @@ -74,6 +77,9 @@ char *argv[]; case 'b': greyscale = 1; break; + case 'd': + dither = !dither; + break; case 'c': ncolors = atoi(argv[++i]); break; @@ -154,6 +160,8 @@ int y; if (bradj) shiftcolrs(scanln, xmax, bradj); colrs_gambs(scanln, xmax); + if (pixscan != NULL) + dith_colrs(pixscan, scanln, xmax); } @@ -173,6 +181,10 @@ int nc; gmap[i] = clrtab[i][GRN]; bmap[i] = clrtab[i][BLU]; } + if (dither && (pixscan = (BYTE *)malloc(xmax)) == NULL) { + fprintf(stderr, "%s: out of memory\n", progname); + exit(1); + } } @@ -198,6 +210,8 @@ int x, y; getrow(y); if (greyscale) return(normbright(scanln[x])); + if (pixscan != NULL) + return(pixscan[x]); return(map_pixel(scanln[x])); }