--- ray/src/px/ra_gif.c 1994/11/21 15:55:59 2.5 +++ ray/src/px/ra_gif.c 2003/06/05 19:29:34 2.8 @@ -1,26 +1,19 @@ -/* Copyright (c) 1994 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: ra_gif.c,v 2.8 2003/06/05 19:29:34 schorsch Exp $"; #endif - /* * Convert from Radiance picture file to Compuserve GIF. * Currently, we don't know how to get back. */ #include +#include +#include +#include "platform.h" #include "color.h" - #include "resolu.h" -#ifdef MSDOS -#include -#endif - -#include - #define MAXCOLORS 256 int rmap[MAXCOLORS]; @@ -52,6 +45,8 @@ int dither = 1; /* dither colors? */ int bradj = 0; /* brightness adjustment */ +int ncolors = 0; /* number of colors requested */ + char *progname; @@ -59,15 +54,11 @@ main(argc, argv) int argc; char *argv[]; { - int ncolors = 0; int bitsperpix; int i; -#ifdef MSDOS - extern int _fmode; - _fmode = O_BINARY; - setmode(fileno(stdin), O_BINARY); - setmode(fileno(stdout), O_BINARY); -#endif + SET_DEFAULT_BINARY(); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); progname = argv[0]; samplefac = 0; @@ -228,7 +219,7 @@ int x, y; getrow(y); if (greyscale) - return(normbright(scanln[x])); + return((normbright(scanln[x])*ncolors)>>8); if (pixscan != NULL) return(pixscan[x]); return(samplefac ? neu_map_pixel(scanln[x]) : map_pixel(scanln[x]));