1 |
< |
/* Copyright (c) 1994 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1997 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
177 |
|
if (!isflt(av[1])) |
178 |
|
return(MG_ETYPE); |
179 |
|
wsum = atof(av[1]); |
180 |
– |
if (wsum < 0.) |
181 |
– |
return(MG_EILL); |
180 |
|
if ((lp = lu_find(&clr_tab, av[2])) == NULL) |
181 |
|
return(MG_EMEM); |
182 |
|
if (lp->data == NULL) |
186 |
|
if (!isflt(av[i])) |
187 |
|
return(MG_ETYPE); |
188 |
|
w = atof(av[i]); |
191 |
– |
if (w < 0.) |
192 |
– |
return(MG_EILL); |
189 |
|
if ((lp = lu_find(&clr_tab, av[i+1])) == NULL) |
190 |
|
return(MG_EMEM); |
191 |
|
if (lp->data == NULL) |
194 |
|
w, (C_COLOR *)lp->data); |
195 |
|
wsum += w; |
196 |
|
} |
197 |
+ |
if (wsum <= 0.) |
198 |
+ |
return(MG_EILL); |
199 |
|
c_ccolor->clock++; |
200 |
|
return(MG_OK); |
201 |
|
} |
604 |
|
} |
605 |
|
if (n > 1) |
606 |
|
va[i] /= (double)n; |
609 |
– |
if (va[i] < 0.) |
610 |
– |
return(MG_EILL); |
607 |
|
if (va[i] > scale) |
608 |
|
scale = va[i]; |
609 |
+ |
else if (va[i] < -scale) |
610 |
+ |
scale = -va[i]; |
611 |
|
} |
612 |
|
if (scale <= FTINY) |
613 |
|
return(MG_EILL); |
665 |
|
} else { /* CIE xy mixing */ |
666 |
|
c_ccvt(c1, C_CSXY); |
667 |
|
c_ccvt(c2, C_CSXY); |
668 |
< |
scale = 1. / (w1/c1->cy + w2/c2->cy); |
668 |
> |
scale = w1/c1->cy + w2/c2->cy; |
669 |
> |
if (scale == 0.) |
670 |
> |
return; |
671 |
> |
scale = 1. / scale; |
672 |
|
cres->cx = (c1->cx*w1/c1->cy + c2->cx*w2/c2->cy) * scale; |
673 |
|
cres->cy = (w1 + w2) * scale; |
674 |
|
cres->flags = C_CDXY|C_CSXY; |