| 5 |
|
* General matrix operations. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
– |
#include <stdio.h> |
| 8 |
|
#include <stdlib.h> |
| 10 |
– |
#include <string.h> |
| 11 |
– |
#include <fcntl.h> |
| 9 |
|
#include <errno.h> |
| 10 |
|
#include "rtio.h" |
| 11 |
|
#include "platform.h" |
| 29 |
|
return(NULL); |
| 30 |
|
dnew->nrows = nr; dnew->ncols = nc; dnew->ncomp = n; |
| 31 |
|
dnew->dtype = DTdouble; |
| 32 |
+ |
dnew->swapin = 0; |
| 33 |
|
dnew->info = NULL; |
| 34 |
|
return(dnew); |
| 35 |
|
} |
| 100 |
|
ip->swapin = (nativebigendian() != i); |
| 101 |
|
return(0); |
| 102 |
|
} |
| 103 |
+ |
if (isexpos(s)) { |
| 104 |
+ |
double d = exposval(s); |
| 105 |
+ |
scalecolor(ip->mtx, d); |
| 106 |
+ |
return(0); |
| 107 |
+ |
} |
| 108 |
+ |
if (iscolcor(s)) { |
| 109 |
+ |
COLOR ctmp; |
| 110 |
+ |
colcorval(ctmp, s); |
| 111 |
+ |
multcolor(ip->mtx, ctmp); |
| 112 |
+ |
return(0); |
| 113 |
+ |
} |
| 114 |
|
if (!formatval(fmt, s)) { |
| 115 |
|
rmx_addinfo(ip, s); |
| 116 |
|
return(0); |
| 210 |
|
} else if (inspec[0] == '!') { |
| 211 |
|
if (!(fp = popen(inspec+1, "r"))) |
| 212 |
|
return(NULL); |
| 213 |
< |
SET_FILE_BINARY(stdin); |
| 213 |
> |
SET_FILE_BINARY(fp); |
| 214 |
|
} else { |
| 215 |
|
const char *sp = inspec; /* check suffix */ |
| 216 |
|
while (*sp) |
| 237 |
|
dinfo.dtype = DTascii; /* assumed w/o FORMAT */ |
| 238 |
|
dinfo.swapin = 0; |
| 239 |
|
dinfo.info = NULL; |
| 240 |
+ |
dinfo.mtx[0] = dinfo.mtx[1] = dinfo.mtx[2] = 1.; |
| 241 |
|
if (getheader(fp, get_dminfo, &dinfo) < 0) { |
| 242 |
|
fclose(fp); |
| 243 |
|
return(NULL); |
| 263 |
|
dnew->info = dinfo.info; |
| 264 |
|
switch (dinfo.dtype) { |
| 265 |
|
case DTascii: |
| 266 |
< |
SET_FILE_TEXT(stdin); |
| 266 |
> |
SET_FILE_TEXT(fp); |
| 267 |
|
if (!rmx_load_ascii(dnew, fp)) |
| 268 |
|
goto loaderr; |
| 269 |
|
dnew->dtype = DTascii; /* should leave double? */ |
| 284 |
|
case DTxyze: |
| 285 |
|
if (!rmx_load_rgbe(dnew, fp)) |
| 286 |
|
goto loaderr; |
| 287 |
< |
dnew->dtype = dinfo.dtype; |
| 287 |
> |
dnew->dtype = dinfo.dtype; /* undo exposure? */ |
| 288 |
> |
if ((dinfo.mtx[0] != 1.) | (dinfo.mtx[1] != 1.) | |
| 289 |
> |
(dinfo.mtx[2] != 1.)) { |
| 290 |
> |
dinfo.mtx[0] = 1./dinfo.mtx[0]; |
| 291 |
> |
dinfo.mtx[1] = 1./dinfo.mtx[1]; |
| 292 |
> |
dinfo.mtx[2] = 1./dinfo.mtx[2]; |
| 293 |
> |
rmx_scale(dnew, dinfo.mtx); |
| 294 |
> |
} |
| 295 |
|
break; |
| 296 |
|
default: |
| 297 |
|
goto loaderr; |
| 671 |
|
return(NULL); |
| 672 |
|
if (msrc->info) { |
| 673 |
|
char buf[128]; |
| 674 |
< |
sprintf(buf, "Applied %dx%d matrix transform\n", |
| 674 |
> |
sprintf(buf, "Applied %dx%d component transform\n", |
| 675 |
|
dnew->ncomp, msrc->ncomp); |
| 676 |
|
rmx_addinfo(dnew, msrc->info); |
| 677 |
|
rmx_addinfo(dnew, buf); |