36 |
|
|
37 |
|
int nfiles; /* number of input files */ |
38 |
|
|
39 |
+ |
char ourfmt[LPICFMT+1] = PICFMT; /* input picture format */ |
40 |
+ |
|
41 |
|
char Command[] = "<Command>"; |
42 |
|
char vcolin[3][4] = {"ri", "gi", "bi"}; |
43 |
|
char vcolout[3][4] = {"ro", "go", "bo"}; |
205 |
|
} |
206 |
|
/* complete header */ |
207 |
|
printargs(argc, argv, stdout); |
208 |
< |
fputformat(COLRFMT, stdout); |
208 |
> |
if (strcmp(ourfmt, PICFMT)) |
209 |
> |
fputformat(ourfmt, stdout); /* print format if known */ |
210 |
|
putchar('\n'); |
211 |
|
fprtresolu(xres, yres, stdout); |
212 |
|
/* combine pictures */ |
231 |
|
if (isheadid(s)) /* header id */ |
232 |
|
return; /* don't echo */ |
233 |
|
if (formatval(fmt, s)) { /* check format */ |
234 |
< |
wrongformat = strcmp(fmt, COLRFMT); |
234 |
> |
if (globmatch(ourfmt, fmt)) { |
235 |
> |
wrongformat = 0; |
236 |
> |
strcpy(ourfmt, fmt); |
237 |
> |
} else |
238 |
> |
wrongformat = 1; |
239 |
|
return; /* don't echo */ |
240 |
|
} |
241 |
|
if (isexpos(s)) { /* exposure */ |
287 |
|
} |
288 |
|
|
289 |
|
|
290 |
+ |
double |
291 |
+ |
rgb_bright(clr) |
292 |
+ |
COLOR clr; |
293 |
+ |
{ |
294 |
+ |
return(bright(clr)); |
295 |
+ |
} |
296 |
+ |
|
297 |
+ |
|
298 |
+ |
double |
299 |
+ |
xyz_bright(clr) |
300 |
+ |
COLOR clr; |
301 |
+ |
{ |
302 |
+ |
return(clr[CIEY]); |
303 |
+ |
} |
304 |
+ |
|
305 |
+ |
|
306 |
+ |
double (*ourbright)() = rgb_bright; |
307 |
+ |
|
308 |
+ |
|
309 |
|
init() /* perform final setup */ |
310 |
|
{ |
311 |
|
double l_colin(), l_expos(), l_ray(); |
323 |
|
funset(vbrtin, 1, '=', l_colin); |
324 |
|
for (i = 0; i < 6; i++) |
325 |
|
funset(vray[i], 1, '=', l_ray); |
326 |
+ |
/* set brightness function */ |
327 |
+ |
if (!strcmp(ourfmt, CIEFMT)) |
328 |
+ |
ourbright = xyz_bright; |
329 |
|
} |
330 |
|
|
331 |
|
|
425 |
|
if (fn < 0 || fn >= nfiles) |
426 |
|
return(1.0); |
427 |
|
if (nam == vbrtexp) |
428 |
< |
return(bright(input[fn].expos)); |
428 |
> |
return((*ourbright)(input[fn].expos)); |
429 |
|
n = 3; |
430 |
|
while (n--) |
431 |
|
if (nam == vcolexp[n]) |
482 |
|
} |
483 |
|
} |
484 |
|
if (nam == vbrtin) |
485 |
< |
return(bright(input[fn].scan[MIDSCN+yoff][xscan+xoff])); |
485 |
> |
return((*ourbright)(input[fn].scan[MIDSCN+yoff][xscan+xoff])); |
486 |
|
n = 3; |
487 |
|
while (n--) |
488 |
|
if (nam == vcolin[n]) |