--- ray/src/px/ra_t16.c 1991/05/17 08:41:52 1.12 +++ ray/src/px/ra_t16.c 1991/12/19 14:52:20 2.2 @@ -15,6 +15,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" +#include "resolu.h" + #include "random.h" #include "targa.h" @@ -32,10 +34,12 @@ static char SCCSid[] = "$SunId$ LBL"; extern char *ecalloc(), *emalloc(); -extern double atof(), pow(); +extern double pow(); -double gamma = 2.0; /* gamma correction */ +double gamma = 2.2; /* gamma correction */ +int bradj = 0; /* brightness adjustment */ + char *progname; char msg[128]; @@ -67,6 +71,11 @@ char *argv[]; case '3': head.dataBits = 24; break; + case 'e': + if (argv[i+1][0] != '+' && argv[i+1][0] != '-') + goto userr; + bradj = atoi(argv[++i]); + break; default: goto userr; } @@ -98,12 +107,12 @@ char *argv[]; printargs(i, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); - fputresolu(YMAJOR|YDECR, head.x, head.y, stdout); + fprtresolu(head.x, head.y, stdout); /* convert file */ tg2ra(&head); } else { if (checkheader(stdin, COLRFMT, NULL) < 0 || - fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR)) + fgetresolu(&head.x, &head.y, stdin) < 0) quiterr("bad picture file"); /* assign header */ head.textSize = 0; @@ -119,7 +128,7 @@ char *argv[]; } exit(0); userr: - fprintf(stderr, "Usage: %s [-2|-3|-r][-g gamma] [input [output]]\n", + fprintf(stderr, "Usage: %s [-2|-3|-r][-g gamma][-e +/-stops] [input [output]]\n", progname); exit(1); } @@ -267,6 +276,8 @@ struct hdStruct *hp; } } gambs_colrs(scanline, hp->x); + if (bradj) + shiftcolrs(scanline, hp->x, bradj); if (fwritecolrs(scanline, hp->x, stdout) < 0) quiterr("error writing RADIANCE file"); } @@ -288,6 +299,8 @@ struct hdStruct *hp; for (j = hp->y-1; j >= 0; j--) { if (freadcolrs(inl, hp->x, stdin) < 0) quiterr("error reading RADIANCE file"); + if (bradj) + shiftcolrs(inl, hp->x, bradj); colrs_gambs(inl, hp->x); if (hp->dataBits == 16) { register unsigned short *dp;