68 |
|
tmnew->inpsf = WHTEFFICACY; |
69 |
|
tmnew->cmat[0][1] = tmnew->cmat[0][2] = tmnew->cmat[1][0] = |
70 |
|
tmnew->cmat[1][2] = tmnew->cmat[2][0] = tmnew->cmat[2][1] = 0.; |
71 |
+ |
tmnew->inpdat = NULL; |
72 |
|
tmnew->hbrmin = 10; tmnew->hbrmax = -10; |
73 |
|
tmnew->histo = NULL; |
74 |
|
tmnew->mbrmin = 10; tmnew->mbrmax = -10; |
87 |
|
tmSetSpace( /* set input color space for conversions */ |
88 |
|
TMstruct *tms, |
89 |
|
RGBPRIMP pri, |
90 |
< |
double sf |
90 |
> |
double sf, |
91 |
> |
MEM_PTR dat |
92 |
|
) |
93 |
|
{ |
94 |
|
static const char funcName[] = "tmSetSpace"; |
99 |
|
if (sf <= 1e-12) |
100 |
|
returnErr(TM_E_ILLEGAL); |
101 |
|
/* check if no change */ |
102 |
< |
if (pri == tms->inppri && FEQ(sf, tms->inpsf)) |
102 |
> |
if (pri == tms->inppri && FEQ(sf, tms->inpsf) && dat == tms->inpdat) |
103 |
|
returnOK; |
104 |
|
tms->inppri = pri; /* let's set it */ |
105 |
|
tms->inpsf = sf; |
106 |
+ |
tms->inpdat = dat; |
107 |
|
|
108 |
|
if (tms->flags & TM_F_BW) { /* color doesn't matter */ |
109 |
|
tms->monpri = tms->inppri; /* eliminate xform */ |
236 |
|
(int)(256.*pow(d, 1./tms->mongam)); |
237 |
|
} |
238 |
|
returnOK; |
239 |
+ |
} |
240 |
+ |
|
241 |
+ |
|
242 |
+ |
TMbright |
243 |
+ |
tmCvLuminance( /* convert a single luminance */ |
244 |
+ |
double lum |
245 |
+ |
) |
246 |
+ |
{ |
247 |
+ |
double d; |
248 |
+ |
|
249 |
+ |
if (lum <= TM_NOLUM) |
250 |
+ |
return(TM_NOBRT); |
251 |
+ |
d = TM_BRTSCALE*log(lum); |
252 |
+ |
if (d > 0.) |
253 |
+ |
return((TMbright)(d+.5)); |
254 |
+ |
return((TMbright)(d-.5)); |
255 |
|
} |
256 |
|
|
257 |
|
|