38 |
|
#define INCWL 10 /* wavelength increment */ |
39 |
|
#define NINC 40 /* # of values */ |
40 |
|
|
41 |
< |
static BYTE chroma[3][NINC] = { |
41 |
> |
static uby8 chroma[3][NINC] = { |
42 |
|
{ /* X */ |
43 |
|
0, 0, 0, 2, 6, 13, 22, 30, 36, 41, |
44 |
|
42, 43, 43, 44, 46, 52, 60, 71, 87, 106, |
111 |
|
int e |
112 |
|
) |
113 |
|
{ |
114 |
< |
register int i, d, r; |
114 |
> |
int i, d, r; |
115 |
|
|
116 |
|
s -= STARTWL; |
117 |
|
if (s < 0) |
164 |
|
int rflags = 0; |
165 |
|
double brtmin, brtmax, v, vv; |
166 |
|
COLOR cgry; |
167 |
< |
register int i; |
167 |
> |
int i; |
168 |
|
/* check for no check */ |
169 |
|
if (gamut == 0) return(0); |
170 |
|
/* check brightness limits */ |
202 |
|
|
203 |
|
void |
204 |
|
colortrans( /* convert c1 by mat and put into c2 */ |
205 |
< |
register COLOR c2, |
206 |
< |
register COLORMAT mat, |
207 |
< |
register COLOR c1 |
205 |
> |
COLOR c2, |
206 |
> |
COLORMAT mat, |
207 |
> |
COLOR c1 |
208 |
|
) |
209 |
|
{ |
210 |
|
COLOR cout; |
225 |
|
) |
226 |
|
{ |
227 |
|
COLORMAT mt; |
228 |
< |
register int i, j; |
228 |
> |
int i, j; |
229 |
|
|
230 |
|
for (i = 0; i < 3; i++) |
231 |
|
for (j = 0; j < 3; j++) |
241 |
|
RGBPRIMS pr |
242 |
|
) |
243 |
|
{ |
244 |
< |
int i; |
244 |
> |
int i, j; |
245 |
|
|
246 |
< |
for (i = 0; i < 4; i++) { |
247 |
< |
if ((pr[i][CIEX] <= CEPS) | (pr[i][CIEY] <= CEPS)) |
246 |
> |
for (i = 0; i < 3; i++) { |
247 |
> |
if ((pr[i][CIEX] <= -2.) | (pr[i][CIEY] <= -2.)) |
248 |
|
return(0); |
249 |
< |
if ((pr[i][CIEX] >= 1.-CEPS) | (pr[i][CIEY] >= 1.-CEPS)) |
249 |
> |
if ((pr[i][CIEX] >= 3.) | (pr[i][CIEY] >= 3.)) |
250 |
|
return(0); |
251 |
+ |
if (pr[i][CIEX] + pr[i][CIEY] <= -2.) |
252 |
+ |
return(0); |
253 |
+ |
if (pr[i][CIEX] + pr[i][CIEY] >= 3.) |
254 |
+ |
return(0); |
255 |
|
} |
256 |
+ |
if ((pr[3][CIEX] <= 0.) | (pr[3][CIEX] >= 1.) | |
257 |
+ |
(pr[3][CIEY] <= 0.) | (pr[3][CIEY] >= 1.)) |
258 |
+ |
return(0); |
259 |
+ |
for (i = 0; i < 4; i++) |
260 |
+ |
for (j = i+1; j < 4; j++) |
261 |
+ |
if (CEQ(pr[i][CIEX],pr[j][CIEX]) && |
262 |
+ |
CEQ(pr[i][CIEY],pr[j][CIEY])) |
263 |
+ |
return(0); |
264 |
|
return(1); |
265 |
|
} |
266 |
|
|
269 |
|
int |
270 |
|
compxyz2rgbmat( /* compute conversion from CIE to RGB space */ |
271 |
|
COLORMAT mat, |
272 |
< |
register RGBPRIMS pr |
272 |
> |
RGBPRIMS pr |
273 |
|
) |
274 |
|
{ |
275 |
|
double C_rD, C_gD, C_bD; |
276 |
|
|
277 |
|
if (pr == stdprims) { /* can use xyz2rgbmat */ |
278 |
|
cpcolormat(mat, xyz2rgbmat); |
279 |
< |
return; |
279 |
> |
return(1); |
280 |
|
} |
281 |
|
if (CEQ(pr[WHT][CIEX],0.) | CEQ(pr[WHT][CIEY],0.)) |
282 |
|
return(0); |
329 |
|
int |
330 |
|
comprgb2xyzmat( /* compute conversion from RGB to CIE space */ |
331 |
|
COLORMAT mat, |
332 |
< |
register RGBPRIMS pr |
332 |
> |
RGBPRIMS pr |
333 |
|
) |
334 |
|
{ |
335 |
|
double C_rD, C_gD, C_bD, D; |
336 |
|
|
337 |
|
if (pr == stdprims) { /* can use rgb2xyzmat */ |
338 |
|
cpcolormat(mat, rgb2xyzmat); |
339 |
< |
return; |
339 |
> |
return(1); |
340 |
|
} |
341 |
|
if (CEQ(pr[WHT][CIEX],0.) | CEQ(pr[WHT][CIEY],0.)) |
342 |
|
return(0); |
383 |
|
mat[0][0] = mat[1][1] = mat[2][2] = 1.0; |
384 |
|
mat[0][1] = mat[0][2] = mat[1][0] = |
385 |
|
mat[1][2] = mat[2][0] = mat[2][1] = 0.0; |
386 |
< |
return; |
386 |
> |
return(1); |
387 |
|
} |
388 |
|
if (!comprgb2xyzmat(pr1toxyz, pr1)) |
389 |
|
return(0); |