--- ray/src/px/ra_pr.c 1991/08/07 08:36:31 1.11 +++ ray/src/px/ra_pr.c 1992/10/30 09:08:31 2.4 @@ -13,10 +13,14 @@ static char SCCSid[] = "$SunId$ LBL"; #include +#include + #include "rasterfile.h" #include "color.h" +#include "resolu.h" + #include "pic.h" /* descriptor for a picture file or frame buffer */ @@ -37,10 +41,8 @@ extern char *ecalloc(), *emalloc(); extern long ftell(); -extern double atof(), pow(); +double gamcor = 2.2; /* gamma correction */ -double gamma = 2.0; /* gamma correction */ - int bradj = 0; /* brightness adjustment */ pic *inpic, *outpic; @@ -75,7 +77,7 @@ char *argv[]; dither = !dither; break; case 'g': - gamma = atof(argv[++i]); + gamcor = atof(argv[++i]); break; case 'b': greyscale = !greyscale; @@ -123,7 +125,7 @@ char *argv[]; printargs(i, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); - fputresolu(YMAJOR|YDECR, xmax, ymax, stdout); + fprtresolu(xmax, ymax, stdout); /* convert file */ pr2ra(&head); } else { @@ -195,7 +197,7 @@ register struct rasterfile *h; return(NULL); /* check header */ if (checkheader(p->fp, COLRFMT, NULL) < 0 || - fgetresolu(&xmax, &ymax, p->fp) != (YMAJOR|YDECR)) + fgetresolu(&xmax, &ymax, p->fp) < 0) quiterr("bad picture format"); p->nexty = 0; p->bytes_line = 0; /* variable length lines */ @@ -256,9 +258,9 @@ struct rasterfile *h; /* convert table */ for (i = 0; i < h->ras_maplength/3; i++) setcolr(ctab[i], - pow((cmap[0][i]+.5)/256.,gamma), - pow((cmap[1][i]+.5)/256.,gamma), - pow((cmap[2][i]+.5)/256.,gamma)); + pow((cmap[0][i]+.5)/256.,gamcor), + pow((cmap[1][i]+.5)/256.,gamcor), + pow((cmap[2][i]+.5)/256.,gamcor)); if (bradj) shiftcolrs(ctab, 256, bradj); /* convert file */ @@ -359,7 +361,7 @@ colormap map; register int i, val; for (i = 0; i < 256; i++) { - val = pow((i+0.5)/256.0, 1.0/gamma) * 256.0; + val = pow((i+0.5)/256.0, 1.0/gamcor) * 256.0; map[0][i] = map[1][i] = map[2][i] = val; } }