| 32 |
|
dnew->nrows = nr; |
| 33 |
|
dnew->ncols = nc; |
| 34 |
|
dnew->ncomp = n; |
| 35 |
+ |
setcolor(dnew->cexp, 1.f, 1.f, 1.f); |
| 36 |
|
} |
| 37 |
|
return(dnew); |
| 38 |
|
} |
| 119 |
|
char fmt[MAXFMTLEN]; |
| 120 |
|
int i; |
| 121 |
|
|
| 122 |
< |
if (headidval(fmt, s)) |
| 122 |
> |
if (headidval(NULL, s)) |
| 123 |
|
return(0); |
| 124 |
|
if (!strncmp(s, "NCOMP=", 6)) { |
| 125 |
|
ip->ncomp = atoi(s+6); |
| 302 |
|
return(NULL); |
| 303 |
|
} |
| 304 |
|
dnew->dtype = DTascii; /* assumed w/o FORMAT */ |
| 304 |
– |
dnew->cexp[0] = dnew->cexp[1] = dnew->cexp[2] = 1.f; |
| 305 |
|
if (getheader(fp, get_dminfo, dnew) < 0) { |
| 306 |
|
fclose(fp); |
| 307 |
|
return(NULL); |
| 338 |
|
case DTxyze: |
| 339 |
|
if (!rmx_load_rgbe(dnew, fp)) |
| 340 |
|
goto loaderr; |
| 341 |
– |
/* undo exposure? */ |
| 342 |
– |
if ((dnew->cexp[0] != 1.f) | (dnew->cexp[1] != 1.f) | |
| 343 |
– |
(dnew->cexp[2] != 1.f)) { |
| 344 |
– |
double cmlt[3]; |
| 345 |
– |
cmlt[0] = 1./dnew->cexp[0]; |
| 346 |
– |
cmlt[1] = 1./dnew->cexp[1]; |
| 347 |
– |
cmlt[2] = 1./dnew->cexp[2]; |
| 348 |
– |
rmx_scale(dnew, cmlt); |
| 349 |
– |
} |
| 350 |
– |
dnew->swapin = 0; |
| 341 |
|
break; |
| 342 |
|
default: |
| 343 |
|
goto loaderr; |
| 352 |
|
else |
| 353 |
|
funlockfile(fp); |
| 354 |
|
#endif |
| 355 |
+ |
/* undo exposure? */ |
| 356 |
+ |
if (dnew->ncomp == 3 && (dnew->cexp[0] != 1.f) | |
| 357 |
+ |
(dnew->cexp[1] != 1.f) | (dnew->cexp[2] != 1.f)) { |
| 358 |
+ |
double cmlt[3]; |
| 359 |
+ |
cmlt[0] = 1./dnew->cexp[0]; |
| 360 |
+ |
cmlt[1] = 1./dnew->cexp[1]; |
| 361 |
+ |
cmlt[2] = 1./dnew->cexp[2]; |
| 362 |
+ |
rmx_scale(dnew, cmlt); |
| 363 |
+ |
setcolor(dnew->cexp, 1.f, 1.f, 1.f); |
| 364 |
+ |
} |
| 365 |
|
return(dnew); |
| 366 |
|
loaderr: /* should report error? */ |
| 367 |
|
if (inspec[0] == '!') |
| 488 |
|
dtype = DTxyze; |
| 489 |
|
else if ((dtype == DTxyze) & (rm->dtype == DTrgbe)) |
| 490 |
|
dtype = DTrgbe; |
| 491 |
+ |
if (rm->ncomp == 3) { /* write exposure? */ |
| 492 |
+ |
if ((rm->cexp[RED] != rm->cexp[GRN]) | |
| 493 |
+ |
(rm->cexp[GRN] != rm->cexp[BLU])) |
| 494 |
+ |
fputcolcor(rm->cexp, fp); |
| 495 |
+ |
else if (rm->cexp[GRN] != 1.f) |
| 496 |
+ |
fputexpos(rm->cexp[GRN], fp); |
| 497 |
+ |
} |
| 498 |
|
if ((dtype != DTrgbe) & (dtype != DTxyze)) { |
| 499 |
|
fprintf(fp, "NROWS=%d\n", rm->nrows); |
| 500 |
|
fprintf(fp, "NCOLS=%d\n", rm->ncols); |