112 |
|
return(xyz[1]); |
113 |
|
} |
114 |
|
|
115 |
< |
/* assign arbitrary spectrum */ |
115 |
> |
/* assign arbitrary spectrum and return Y value */ |
116 |
|
double |
117 |
|
c_sset(C_COLOR *clr, double wlmin, double wlmax, const float spec[], int nwl) |
118 |
|
{ |
134 |
|
wlmax -= wlstep; |
135 |
|
--nwl; |
136 |
|
} |
137 |
+ |
if ((nwl <= 1) | (wlmin >= wlmax)) |
138 |
+ |
return(0.); |
139 |
|
imax = nwl; /* box filter if necessary */ |
140 |
|
boxpos = 0; |
141 |
|
boxstep = 1; |
231 |
|
clr->cx = x / z; |
232 |
|
clr->cy = y / z; |
233 |
|
clr->flags |= C_CSXY; |
234 |
< |
} else if (fl & C_CSSPEC) { /* cxy -> cspec */ |
234 |
> |
} |
235 |
> |
if (fl & C_CSSPEC) { /* cxy -> cspec */ |
236 |
|
x = clr->cx; |
237 |
|
y = clr->cy; |
238 |
|
z = 1. - x - y; |
334 |
|
cres->ssum += cres->ssamp[i] = cmix[i] / cmax; |
335 |
|
cres->flags = C_CDSPEC|C_CSSPEC; |
336 |
|
|
337 |
< |
c_ccvt(cres, C_CSEFF); /* don't touch below */ |
337 |
> |
c_ccvt(cres, C_CSEFF); /* below is correct */ |
338 |
|
yres = y1 * y2 * c_y31.ssum * C_CLPWM / |
339 |
|
(c1->eff*c1->ssum * c2->eff*c2->ssum) * |
340 |
|
cres->eff*( cres->ssum*(double)cmax + |