| 145 |
|
{ |
| 146 |
|
double C_rD, C_gD, C_bD; |
| 147 |
|
|
| 148 |
+ |
if (pr == stdprims) { /* can use xyz2rgbmat */ |
| 149 |
+ |
cpcolormat(mat, xyz2rgbmat); |
| 150 |
+ |
return; |
| 151 |
+ |
} |
| 152 |
|
C_rD = (1./pr[WHT][CIEY]) * |
| 153 |
|
( pr[WHT][CIEX]*(pr[GRN][CIEY] - pr[BLU][CIEY]) - |
| 154 |
|
pr[WHT][CIEY]*(pr[GRN][CIEX] - pr[BLU][CIEX]) + |
| 195 |
|
{ |
| 196 |
|
double C_rD, C_gD, C_bD, D; |
| 197 |
|
|
| 198 |
+ |
if (pr == stdprims) { /* can use rgb2xyzmat */ |
| 199 |
+ |
cpcolormat(mat, rgb2xyzmat); |
| 200 |
+ |
return; |
| 201 |
+ |
} |
| 202 |
|
C_rD = (1./pr[WHT][CIEY]) * |
| 203 |
|
( pr[WHT][CIEX]*(pr[GRN][CIEY] - pr[BLU][CIEY]) - |
| 204 |
|
pr[WHT][CIEY]*(pr[GRN][CIEX] - pr[BLU][CIEX]) + |
| 232 |
|
{ |
| 233 |
|
COLORMAT pr1toxyz, xyztopr2; |
| 234 |
|
|
| 235 |
< |
if (pr1 == stdprims) /* can use rgb2xyzmat */ |
| 236 |
< |
cpcolormat(pr1toxyz, rgb2xyzmat); |
| 237 |
< |
else /* otherwise compute it */ |
| 238 |
< |
comprgb2xyzmat(pr1toxyz, pr1); |
| 239 |
< |
if (pr2 == stdprims) /* can use xyz2rgbmat */ |
| 240 |
< |
cpcolormat(xyztopr2, xyz2rgbmat); |
| 241 |
< |
else /* otherwise compute it */ |
| 242 |
< |
compxyz2rgbmat(xyztopr2, pr2); |
| 235 |
> |
if (pr1 == pr2) { |
| 236 |
> |
mat[0][0] = mat[1][1] = mat[2][2] = 1.0; |
| 237 |
> |
mat[0][1] = mat[0][2] = mat[1][0] = |
| 238 |
> |
mat[1][2] = mat[2][0] = mat[2][1] = 0.0; |
| 239 |
> |
return; |
| 240 |
> |
} |
| 241 |
> |
comprgb2xyzmat(pr1toxyz, pr1); |
| 242 |
> |
compxyz2rgbmat(xyztopr2, pr2); |
| 243 |
|
/* combine transforms */ |
| 244 |
|
multcolormat(mat, pr1toxyz, xyztopr2); |
| 245 |
|
} |