51 |
|
(CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r)/CIE_C_bD} |
52 |
|
}; |
53 |
|
|
54 |
+ |
static float rgb2xyzmat[3][3] = { /* RGB to XYZ */ |
55 |
+ |
{CIE_x_r*CIE_C_rD/CIE_D,CIE_x_g*CIE_C_gD/CIE_D,CIE_x_b*CIE_C_bD/CIE_D}, |
56 |
+ |
{CIE_y_r*CIE_C_rD/CIE_D,CIE_y_g*CIE_C_gD/CIE_D,CIE_y_b*CIE_C_bD/CIE_D}, |
57 |
+ |
{(1.-CIE_x_r-CIE_y_r)*CIE_C_rD/CIE_D, |
58 |
+ |
(1.-CIE_x_g-CIE_y_g)*CIE_C_gD/CIE_D, |
59 |
+ |
(1.-CIE_x_b-CIE_y_b)*CIE_C_bD/CIE_D} |
60 |
+ |
}; |
61 |
|
|
62 |
|
|
63 |
+ |
|
64 |
|
spec_rgb(col, s, e) /* compute RGB color from spectral range */ |
65 |
|
COLOR col; |
66 |
|
int s, e; |
118 |
|
if (rgbcolor[i] < 0.0) |
119 |
|
rgbcolor[i] = 0.0; |
120 |
|
} |
121 |
+ |
} |
122 |
+ |
|
123 |
+ |
|
124 |
+ |
rgb_cie(ciecolor, rgbcolor) /* convert RGB to CIE */ |
125 |
+ |
register COLOR ciecolor, rgbcolor; |
126 |
+ |
{ |
127 |
+ |
register int i; |
128 |
+ |
|
129 |
+ |
for (i = 0; i < 3; i++) |
130 |
+ |
ciecolor[i] = rgb2xyzmat[i][0]*rgbcolor[0] + |
131 |
+ |
rgb2xyzmat[i][1]*rgbcolor[1] + |
132 |
+ |
rgb2xyzmat[i][2]*rgbcolor[2] ; |
133 |
|
} |