139 |
|
} |
140 |
|
|
141 |
|
|
142 |
+ |
static double |
143 |
+ |
greypoint( /* compute gamut mapping grey target */ |
144 |
+ |
COLOR col |
145 |
+ |
) |
146 |
+ |
{ |
147 |
+ |
COLOR gryc; |
148 |
+ |
int i; |
149 |
+ |
/* improves saturated color rendering */ |
150 |
+ |
copycolor(gryc, col); |
151 |
+ |
for (i = 3; i--; ) |
152 |
+ |
if (gryc[i] > 1) |
153 |
+ |
gryc[i] = 1; |
154 |
+ |
else if (gryc[i] < 0) |
155 |
+ |
gryc[i] = 0; |
156 |
+ |
return(bright(gryc)); |
157 |
+ |
} |
158 |
+ |
|
159 |
+ |
|
160 |
|
static void |
161 |
|
matscan( /* apply color matrix to scaline */ |
162 |
|
register COLOR *sl, |
166 |
|
{ |
167 |
|
while (len--) { |
168 |
|
colortrans(sl[0], mat, sl[0]); |
169 |
< |
clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite); |
169 |
> |
clipgamut(sl[0], greypoint(sl[0]), CGAMUT, cblack, cwhite); |
170 |
|
sl++; |
171 |
|
} |
172 |
|
} |
184 |
|
|
185 |
|
while (len--) { |
186 |
|
colortrans(sl[0], mb->cmat, sl[0]); |
187 |
< |
clipgamut(sl[0], bright(sl[0]), CGAMUT, mb->cmin, mb->cmax); |
187 |
> |
clipgamut(sl[0], greypoint(sl[0]), CGAMUT, mb->cmin, mb->cmax); |
188 |
|
for (i = 0; i < 3; i++) { |
189 |
|
d = colval(sl[0],i); |
190 |
|
for (j = 0; j < 4 && mb->xa[i][j+1] <= d; j++) |
216 |
|
progname, cwarpfile); |
217 |
|
exit(1); |
218 |
|
} |
219 |
< |
clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite); |
219 |
> |
clipgamut(sl[0], greypoint(sl[0]), CGAMUT, cblack, cwhite); |
220 |
|
sl++; |
221 |
|
} |
222 |
|
} |