14 |
|
#include "calcomp.h" |
15 |
|
#include "view.h" |
16 |
|
|
17 |
< |
#define MAXINP 32 /* maximum number of input files */ |
17 |
> |
#define MAXINP 512 /* maximum number of input files */ |
18 |
|
#define WINSIZ 64 /* scanline window size */ |
19 |
|
#define MIDSCN ((WINSIZ-1)/2+1) |
20 |
|
|
68 |
|
|
69 |
|
char *progname; /* global argv[0] */ |
70 |
|
|
71 |
+ |
int echoheader = 1; |
72 |
|
int wrongformat = 0; |
73 |
|
int gotview; |
74 |
|
|
75 |
|
|
76 |
< |
static gethfunc tabputs; |
76 |
> |
static gethfunc headline; |
77 |
|
static void checkfile(void); |
78 |
|
static double rgb_bright(COLOR clr); |
79 |
|
static double xyz_bright(COLOR clr); |
111 |
|
case 'w': |
112 |
|
nowarn = !nowarn; |
113 |
|
continue; |
114 |
+ |
case 'h': |
115 |
+ |
echoheader = !echoheader; |
116 |
+ |
continue; |
117 |
|
case 'f': |
118 |
|
case 'e': |
119 |
|
a++; |
232 |
|
eputs("Usage: "); |
233 |
|
eputs(argv[0]); |
234 |
|
eputs( |
235 |
< |
" [-w][-x xr][-y yr][-e expr][-f file] [ [-o][-s f][-c r g b] pic ..]\n"); |
235 |
> |
" [-w][-h][-x xr][-y yr][-e expr][-f file] [ [-o][-s f][-c r g b] pic ..]\n"); |
236 |
|
quit(1); |
237 |
|
return 1; /* pro forma return */ |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
static int |
242 |
< |
tabputs( /* put out string preceded by a tab */ |
242 |
> |
headline( /* check header line & echo if requested */ |
243 |
|
char *s, |
244 |
|
void *p |
245 |
|
) |
268 |
|
input[nfiles].pa *= aspectval(s); |
269 |
|
else if (isview(s) && sscanview(&input[nfiles].vw, s) > 0) |
270 |
|
gotview++; |
271 |
< |
/* echo line */ |
272 |
< |
putchar('\t'); |
273 |
< |
return(fputs(s, stdout)); |
271 |
> |
|
272 |
> |
if (echoheader) { /* echo line */ |
273 |
> |
putchar('\t'); |
274 |
> |
return(fputs(s, stdout)); |
275 |
> |
} |
276 |
> |
return(0); |
277 |
|
} |
278 |
|
|
279 |
|
|
283 |
|
register int i; |
284 |
|
/* process header */ |
285 |
|
gotview = 0; |
286 |
< |
fputs(input[nfiles].name, stdout); |
287 |
< |
fputs(":\n", stdout); |
288 |
< |
getheader(input[nfiles].fp, tabputs, NULL); |
286 |
> |
if (echoheader) { |
287 |
> |
fputs(input[nfiles].name, stdout); |
288 |
> |
fputs(":\n", stdout); |
289 |
> |
} |
290 |
> |
getheader(input[nfiles].fp, headline, NULL); |
291 |
|
if (wrongformat < 0) { |
292 |
|
eputs(input[nfiles].name); |
293 |
|
eputs(": not a Radiance picture\n"); |
448 |
|
eputs(": read error\n"); |
449 |
|
quit(1); |
450 |
|
} |
451 |
< |
if (fabs(colval(input[i].coef,RED)-1.0) > 1e-3 || |
452 |
< |
fabs(colval(input[i].coef,GRN)-1.0) > 1e-3 || |
444 |
< |
fabs(colval(input[i].coef,BLU)-1.0) > 1e-3) |
445 |
< |
for (j = 0; j < xmax; j++) /* adjust color */ |
446 |
< |
multcolor(st[j], input[i].coef); |
451 |
> |
for (j = 0; j < xmax; j++) /* adjust color */ |
452 |
> |
multcolor(st[j], input[i].coef); |
453 |
|
} |
454 |
|
} |
455 |
|
|
607 |
|
if (input[fn].vw.type == 0) |
608 |
|
errno = EDOM; |
609 |
|
else if (input[fn].vw.type != VT_PAR && |
610 |
< |
funvalue(vray[6], 1, &d) > FTINY) { |
610 |
> |
funvalue(vray[6], 1, &d) >= -FTINY) { |
611 |
|
for (i = 0; i < 3; i++) |
612 |
|
dir0[i] = funvalue(vray[3+i], 1, &d); |
613 |
|
pix2loc(locx, &input[fn].rs, xscan+1, ymax-1-yscan); |