48 |
|
|
49 |
|
int xpos, ypos; /* picture position */ |
50 |
|
|
51 |
+ |
int wrongformat = 0; |
52 |
|
|
53 |
+ |
|
54 |
|
tputs(s) /* put out string preceded by a tab */ |
55 |
|
char *s; |
56 |
|
{ |
57 |
+ |
char fmt[32]; |
58 |
|
double d; |
59 |
|
COLOR ctmp; |
60 |
< |
/* echo header line */ |
61 |
< |
putchar('\t'); |
62 |
< |
fputs(s, stdout); |
63 |
< |
if (!original) |
64 |
< |
return; |
62 |
< |
/* check for exposure */ |
63 |
< |
if (isexpos(s)) { |
60 |
> |
|
61 |
> |
if (isformat(s)) { /* check format */ |
62 |
> |
formatval(fmt, s); |
63 |
> |
wrongformat = strcmp(fmt, COLRFMT); |
64 |
> |
} else if (original && isexpos(s)) { /* exposure */ |
65 |
|
d = 1.0/exposval(s); |
66 |
|
scalecolor(input[nfiles].coef, d); |
67 |
< |
} else if (iscolcor(s)) { |
67 |
> |
} else if (original && iscolcor(s)) { /* color correction */ |
68 |
|
colcorval(ctmp, s); |
69 |
|
colval(input[nfiles].coef,RED) /= colval(ctmp,RED); |
70 |
|
colval(input[nfiles].coef,GRN) /= colval(ctmp,GRN); |
71 |
|
colval(input[nfiles].coef,BLU) /= colval(ctmp,BLU); |
72 |
+ |
} else { /* echo unaffected line */ |
73 |
+ |
putchar('\t'); |
74 |
+ |
fputs(s, stdout); |
75 |
|
} |
76 |
+ |
|
77 |
|
} |
78 |
|
|
79 |
|
|
158 |
|
} |
159 |
|
fputs(input[nfiles].name, stdout); |
160 |
|
fputs(":\n", stdout); |
161 |
< |
getheader(input[nfiles].fp, tputs); |
161 |
> |
getheader(input[nfiles].fp, tputs, NULL); |
162 |
> |
if (wrongformat) { |
163 |
> |
eputs(input[nfiles].name); |
164 |
> |
eputs(": not in Radiance picture format\n"); |
165 |
> |
quit(1); |
166 |
> |
} |
167 |
|
if (fgetresolu(&xpos, &ypos, input[nfiles].fp) != |
168 |
|
(YMAJOR|YDECR)) { |
169 |
|
eputs(input[nfiles].name); |
182 |
|
nfiles++; |
183 |
|
} |
184 |
|
printargs(argc, argv, stdout); |
185 |
+ |
fputformat(COLRFMT, stdout); |
186 |
|
putchar('\n'); |
187 |
|
fputresolu(YMAJOR|YDECR, xres, yres, stdout); |
188 |
|
combine(); |