--- ray/src/px/aedimage.c 1991/03/18 09:35:01 1.9 +++ ray/src/px/aedimage.c 1998/10/27 09:08:25 2.4 @@ -13,6 +13,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include +#include + #include #include @@ -97,8 +99,8 @@ FILE *fin; extern long ftell(); long scanpos[NROWS]; -extern double atof(); double exposure = 1.0; +int wrong_fmt = 0; main(argc, argv) @@ -140,9 +142,11 @@ 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)) + if (fgetresolu(&xmax, &ymax, fin) < 0) quitmsg("bad picture size"); if (xmax > NCOLS || ymax > NROWS) quitmsg("resolution mismatch"); @@ -166,11 +170,19 @@ userr: } +int 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); + } + return(0); } @@ -511,7 +523,6 @@ int offset[3]; picreadcm(map) /* do gamma correction */ colormap map; { - extern double pow(); register int i, val; for (i = 0; i < 256; i++) {