| 42 |
|
|
| 43 |
|
int nowarn = 0; /* no warning messages? */ |
| 44 |
|
|
| 45 |
+ |
int original = 0; /* origninal values? */ |
| 46 |
+ |
|
| 47 |
|
int xres=0, yres=0; /* picture resolution */ |
| 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 |
< |
putchar('\t'); |
| 58 |
< |
fputs(s, stdout); |
| 57 |
> |
char fmt[32]; |
| 58 |
> |
double d; |
| 59 |
> |
COLOR ctmp; |
| 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 (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 |
|
|
| 85 |
|
double f; |
| 86 |
|
int a; |
| 87 |
|
|
| 88 |
< |
funset(vcolin[RED], 1, l_redin); |
| 89 |
< |
funset(vcolin[GRN], 1, l_grnin); |
| 90 |
< |
funset(vcolin[BLU], 1, l_bluin); |
| 91 |
< |
funset(vbrtin, 1, l_brtin); |
| 88 |
> |
funset(vcolin[RED], 1, '=', l_redin); |
| 89 |
> |
funset(vcolin[GRN], 1, '=', l_grnin); |
| 90 |
> |
funset(vcolin[BLU], 1, '=', l_bluin); |
| 91 |
> |
funset(vbrtin, 1, '=', l_brtin); |
| 92 |
|
|
| 93 |
|
for (a = 1; a < argc; a++) |
| 94 |
|
if (argv[a][0] == '-') |
| 106 |
|
case 'w': |
| 107 |
|
nowarn = !nowarn; |
| 108 |
|
break; |
| 109 |
+ |
case 'o': |
| 110 |
+ |
original = !original; |
| 111 |
+ |
break; |
| 112 |
|
case 'f': |
| 113 |
|
fcompile(argv[++a]); |
| 114 |
|
break; |
| 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(); |
| 190 |
|
usage: |
| 191 |
|
eputs("Usage: "); |
| 192 |
|
eputs(argv[0]); |
| 193 |
< |
eputs(" [-w][-x xr][-y yr][-e expr][-f file] [ [-s f][-c r g b] picture ..]\n"); |
| 193 |
> |
eputs( |
| 194 |
> |
" [-w][-h][-x xr][-y yr][-e expr][-f file] [ [-s f][-c r g b] pic ..]\n"); |
| 195 |
|
quit(1); |
| 196 |
|
} |
| 197 |
|
|
| 214 |
|
else |
| 215 |
|
brtdef = NULL; |
| 216 |
|
/* predefine variables */ |
| 217 |
< |
varset(vnfiles, (double)nfiles); |
| 218 |
< |
varset(vxres, (double)xres); |
| 219 |
< |
varset(vyres, (double)yres); |
| 217 |
> |
varset(vnfiles, '=', (double)nfiles); |
| 218 |
> |
varset(vxres, '=', (double)xres); |
| 219 |
> |
varset(vyres, '=', (double)yres); |
| 220 |
|
/* allocate scanline */ |
| 221 |
|
scanout = (COLOR *)emalloc(xres*sizeof(COLOR)); |
| 222 |
|
/* combine files */ |
| 227 |
|
eputs(": read error\n"); |
| 228 |
|
quit(1); |
| 229 |
|
} |
| 230 |
< |
varset(vypos, (double)ypos); |
| 230 |
> |
varset(vypos, '=', (double)ypos); |
| 231 |
|
for (xpos = 0; xpos < xres; xpos++) { |
| 232 |
< |
varset(vxpos, (double)xpos); |
| 232 |
> |
for (i = 0; i < nfiles; i++) |
| 233 |
> |
multcolor(input[i].scan[xpos],input[i].coef); |
| 234 |
> |
varset(vxpos, '=', (double)xpos); |
| 235 |
|
eclock++; |
| 236 |
|
if (brtdef != NULL) { |
| 237 |
|
d = evalue(brtdef); |
| 246 |
|
colval(scanout[xpos],j) = 0.0; |
| 247 |
|
for (i = 0; i < nfiles; i++) |
| 248 |
|
colval(scanout[xpos],j) += |
| 215 |
– |
colval(input[i].coef,j) * |
| 249 |
|
colval(input[i].scan[xpos],j); |
| 250 |
|
} |
| 251 |
|
if (colval(scanout[xpos],j) < 0.0) |