18 #ifndef _MAGICKCORE_GEM_PRIVATE_H
19 #define _MAGICKCORE_GEM_PRIVATE_H
21 #if defined(__cplusplus) || defined(c_plusplus)
30 #define CIEEpsilon (216.0/24389.0)
31 #define CIEK (24389.0/27.0)
34 double *X,
double *Y,
double *Z)
41 assert(X != (
double *) NULL);
42 assert(Y != (
double *) NULL);
43 assert(Z != (
double *) NULL);
50 x=(116.0*x-16.0)/
CIEK;
58 z=(116.0*z-16.0)/
CIEK;
65 double *L,
double *u,
double *v)
70 assert(L != (
double *) NULL);
71 assert(u != (
double *) NULL);
72 assert(v != (
double *) NULL);
74 *L=(double) (116.0*pow(Y/
D65Y,1.0/3.0)-16.0);
86 const Quantum blue,
double *X,
double *Y,
double *Z)
93 assert(X != (
double *) NULL);
94 assert(Y != (
double *) NULL);
95 assert(Z != (
double *) NULL);
99 *X=0.41239558896741421610*r+0.35758343076371481710*g+0.18049264738170157350*b;
100 *Y=0.21258623078559555160*r+0.71517030370341084990*g+0.07220049864333622685*b;
101 *Z=0.01929721549174694484*r+0.11918386458084853180*g+0.95049712513157976600*b;
105 double *L,
double *a,
double *b)
112 assert(L != (
double *) NULL);
113 assert(a != (
double *) NULL);
114 assert(b != (
double *) NULL);
116 x=pow(X/
D65X,1.0/3.0);
120 y=pow(Y/
D65Y,1.0/3.0);
124 z=pow(Z/
D65Z,1.0/3.0);
127 *L=((116.0*y)-16.0)/100.0;
128 *a=(500.0*(x-y))/255.0+0.5;
129 *b=(200.0*(y-z))/255.0+0.5;
133 double *X,
double *Y,
double *Z)
135 assert(X != (
double *) NULL);
136 assert(Y != (
double *) NULL);
137 assert(Z != (
double *) NULL);
139 *Y=(double) pow((L+16.0)/116.0,3.0);
143 5.0*(*Y))/((((52.0f*L/(u+13.0*L*(4.0*
D65X/(
D65X+15.0*
D65Y+3.0*
D65Z))))-1.0)/
145 *Z=(*X*(((52.0f*L/(u+13.0*L*(4.0*
D65X/(
D65X+15.0*
D65Y+3.0*
D65Z))))-1.0)/3.0))-
157 assert(red != (
Quantum *) NULL);
158 assert(green != (
Quantum *) NULL);
159 assert(blue != (
Quantum *) NULL);
160 r=3.2406*X-1.5372*Y-0.4986*Z;
161 g=(-0.9689)*X+1.8758*Y+0.0415*Z;
162 b=0.0557*X-0.2040*Y+1.0570*Z;
169 #if defined(__cplusplus) || defined(c_plusplus)