| 255 |
|
return(1); |
| 256 |
|
} |
| 257 |
|
|
| 258 |
+ |
#if DTrmx_native==DTfloat |
| 259 |
+ |
#define rmx_load_spec(dp,rm,fp) (freadsscan(dp,(rm)->ncomp,(rm)->ncols,fp) >= 0) |
| 260 |
+ |
#else |
| 261 |
|
static int |
| 259 |
– |
rmx_load_rgbe(rmx_dtype *drp, const RMATRIX *rm, FILE *fp) |
| 260 |
– |
{ |
| 261 |
– |
COLR *scan; |
| 262 |
– |
COLOR col; |
| 263 |
– |
int j; |
| 264 |
– |
|
| 265 |
– |
if (rm->ncomp != 3) |
| 266 |
– |
return(0); |
| 267 |
– |
scan = (COLR *)tempbuffer(sizeof(COLR)*rm->ncols); |
| 268 |
– |
if (!scan) |
| 269 |
– |
return(0); |
| 270 |
– |
if (freadcolrs(scan, rm->ncols, fp) < 0) |
| 271 |
– |
return(0); |
| 272 |
– |
for (j = 0; j < rm->ncols; j++) { |
| 273 |
– |
colr_color(col, scan[j]); |
| 274 |
– |
*drp++ = colval(col,RED); |
| 275 |
– |
*drp++ = colval(col,GRN); |
| 276 |
– |
*drp++ = colval(col,BLU); |
| 277 |
– |
} |
| 278 |
– |
return(1); |
| 279 |
– |
} |
| 280 |
– |
|
| 281 |
– |
static int |
| 262 |
|
rmx_load_spec(rmx_dtype *drp, const RMATRIX *rm, FILE *fp) |
| 263 |
|
{ |
| 264 |
|
COLRV *scan; |
| 279 |
|
} |
| 280 |
|
return(1); |
| 281 |
|
} |
| 282 |
+ |
#endif |
| 283 |
|
|
| 284 |
|
/* Read matrix header from input stream (cannot be XML) */ |
| 285 |
|
int |
| 326 |
|
return(rmx_load_double(drp, rm, fp)); |
| 327 |
|
case DTrgbe: |
| 328 |
|
case DTxyze: |
| 348 |
– |
return(rmx_load_rgbe(drp, rm, fp)); |
| 329 |
|
case DTspec: |
| 330 |
|
return(rmx_load_spec(drp, rm, fp)); |
| 331 |
|
default: |
| 498 |
|
return(fwritecolrs(scan, len, fp) >= 0); |
| 499 |
|
} |
| 500 |
|
|
| 501 |
+ |
#if DTrmx_native==DTfloat |
| 502 |
+ |
#define rmx_write_spec(dp,nc,ln,fp) (fwritesscan(dp,nc,ln,fp) >= 0) |
| 503 |
+ |
#else |
| 504 |
|
static int |
| 505 |
|
rmx_write_spec(const rmx_dtype *dp, int ncomp, int len, FILE *fp) |
| 506 |
|
{ |
| 518 |
|
} |
| 519 |
|
return(fwritescolrs(scan, ncomp, len, fp) >= 0); |
| 520 |
|
} |
| 521 |
+ |
#endif |
| 522 |
|
|
| 523 |
|
/* Check if CIE XYZ primaries were specified */ |
| 524 |
|
static int |