134 |
|
if (tms->inppri != tms->monpri && |
135 |
|
PRIMEQ(tms->inppri, tms->monpri)) |
136 |
|
tms->inppri = tms->monpri; /* no xform */ |
137 |
< |
comprgb2rgbWBmat(tms->cmat, tms->inppri, tms->monpri); |
137 |
> |
if (!comprgb2rgbWBmat(tms->cmat, tms->inppri, tms->monpri)) |
138 |
> |
returnErr(TM_E_ILLEGAL); |
139 |
|
} |
140 |
|
for (i = 0; i < 3; i++) |
141 |
|
for (j = 0; j < 3; j++) |
142 |
|
tms->cmat[i][j] *= tms->inpsf; |
143 |
|
/* set color divisors */ |
144 |
|
for (i = 0; i < 3; i++) |
145 |
< |
if (tms->clf[i] > .001) |
146 |
< |
tms->cdiv[i] = |
146 |
< |
256.*pow(tms->clf[i], 1./tms->mongam); |
147 |
< |
else |
148 |
< |
tms->cdiv[i] = 1; |
145 |
> |
tms->cdiv[i] = 256.*pow(tms->clf[i] < .001 ? .001 : |
146 |
> |
tms->clf[i], 1./tms->mongam); |
147 |
|
/* notify packages */ |
148 |
|
for (i = tmNumPkgs; i--; ) |
149 |
|
if (tms->pd[i] != NULL && tmPkg[i]->NewSpace != NULL) |
252 |
|
tmCvColors( /* convert float colors */ |
253 |
|
TMstruct *tms, |
254 |
|
TMbright *ls, |
255 |
< |
BYTE *cs, |
255 |
> |
uby8 *cs, |
256 |
|
COLOR *scan, |
257 |
|
int len |
258 |
|
) |
259 |
|
{ |
260 |
|
static const char funcName[] = "tmCvColors"; |
261 |
< |
static BYTE gamtab[1024]; |
261 |
> |
static uby8 gamtab[1024]; |
262 |
|
static double curgam = .0; |
263 |
|
COLOR cmon; |
264 |
|
float lum, slum, d; |
555 |
|
int |
556 |
|
tmMapPixels( /* apply tone-mapping to pixel(s) */ |
557 |
|
TMstruct *tms, |
558 |
< |
BYTE *ps, |
558 |
> |
uby8 *ps, |
559 |
|
TMbright *ls, |
560 |
< |
BYTE *cs, |
560 |
> |
uby8 *cs, |
561 |
|
int len |
562 |
|
) |
563 |
|
{ |
651 |
|
|
652 |
|
/******************** Shared but Private library routines *********************/ |
653 |
|
|
654 |
< |
BYTE tmMesofact[BMESUPPER-BMESLOWER]; |
654 |
> |
uby8 tmMesofact[BMESUPPER-BMESLOWER]; |
655 |
|
|
656 |
|
void |
657 |
|
tmMkMesofact() /* build mesopic lookup factor table */ |