--- ray/src/px/aedimage.c 1990/01/26 08:17:29 1.7 +++ ray/src/px/aedimage.c 1991/04/18 14:35:03 1.10 @@ -99,6 +99,7 @@ long scanpos[NROWS]; extern double atof(); double exposure = 1.0; +int wrong_fmt = 0; main(argc, argv) @@ -140,7 +141,9 @@ char *argv[]; quitmsg(errmsg); } /* get header */ - getheader(fin, checkhead); + getheader(fin, checkhead, NULL); + if (wrong_fmt) + quitmsg("input must be a Radiance picture"); /* get picture dimensions */ if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) quitmsg("bad picture size"); @@ -169,8 +172,14 @@ userr: checkhead(line) /* deal with line from header */ char *line; { + char fmt[32]; + if (isexpos(line)) exposure *= exposval(line); + else if (isformat(line)) { + formatval(fmt, line); + wrong_fmt = strcmp(fmt, COLRFMT); + } } @@ -315,7 +324,7 @@ loopcom() /* print pixel values interactively */ break; case 'l': case 'L': - printf("%-3gL", bright(cval)*683.0/exposure); + printf("%-3gL", luminance(cval)/exposure); break; case 'c': case 'C': @@ -515,7 +524,7 @@ colormap map; register int i, val; for (i = 0; i < 256; i++) { - val = pow(i/256.0, 1.0/GAMMA) * 256.0; + val = pow((i+0.5)/256.0, 1.0/GAMMA) * 256.0; map[0][i] = map[1][i] = map[2][i] = val; } }