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] > cwhite[i]) |
153 |
+ |
gryc[i] = cwhite[i]; |
154 |
+ |
else if (gryc[i] < cblack[i]) |
155 |
+ |
gryc[i] = cblack[i]; |
156 |
+ |
return(bright(gryc)); |
157 |
+ |
} |
158 |
+ |
|
159 |
+ |
|
160 |
|
static void |
161 |
|
matscan( /* apply color matrix to scaline */ |
162 |
|
register COLOR *sl, |
164 |
|
COLORMAT mat |
165 |
|
) |
166 |
|
{ |
167 |
+ |
double gryv; |
168 |
+ |
|
169 |
|
while (len--) { |
170 |
+ |
gryv = greypoint(sl[0]); |
171 |
|
colortrans(sl[0], mat, sl[0]); |
172 |
< |
clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite); |
172 |
> |
clipgamut(sl[0], gryv, CGAMUT, cblack, cwhite); |
173 |
|
sl++; |
174 |
|
} |
175 |
|
} |
186 |
|
register int i, j; |
187 |
|
|
188 |
|
while (len--) { |
189 |
+ |
d = greypoint(sl[0]); |
190 |
|
colortrans(sl[0], mb->cmat, sl[0]); |
191 |
< |
clipgamut(sl[0], bright(sl[0]), CGAMUT, mb->cmin, mb->cmax); |
191 |
> |
clipgamut(sl[0], d, CGAMUT, mb->cmin, mb->cmax); |
192 |
|
for (i = 0; i < 3; i++) { |
193 |
|
d = colval(sl[0],i); |
194 |
|
for (j = 0; j < 4 && mb->xa[i][j+1] <= d; j++) |
210 |
|
) |
211 |
|
{ |
212 |
|
int rval; |
213 |
+ |
double gryv; |
214 |
|
|
215 |
|
while (len--) { |
216 |
+ |
gryv = greypoint(sl[0]); |
217 |
|
rval = warp3d(sl[0], sl[0], wp); |
218 |
|
if (rval & W3ERROR) |
219 |
|
syserror("warp3d"); |
222 |
|
progname, cwarpfile); |
223 |
|
exit(1); |
224 |
|
} |
225 |
< |
clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite); |
225 |
> |
clipgamut(sl[0], gryv, CGAMUT, cblack, cwhite); |
226 |
|
sl++; |
227 |
|
} |
228 |
|
} |