Y,
Z;
- ConvertLabToXYZ(L,a,b,&X,&Y,&Z);
+ ConvertLabToXYZ(100.0*L,255.0*(a-0.5),255.0*(b-0.5),&X,&Y,&Z);
ConvertXYZToRGB(X,Y,Z,red,green,blue);
}
assert(X != (double *) NULL);
assert(Y != (double *) NULL);
assert(Z != (double *) NULL);
- y=(100.0*L+16.0)/116.0;
- x=y+255.0*(a-0.5)/500.0;
- z=y-255.0*(b-0.5)/200.0;
+ y=(L+16.0)/116.0;
+ x=y+a/500.0;
+ z=y-b/200.0;
if ((x*x*x) > CIEEpsilon)
x=(x*x*x);
else
if ((y*y*y) > CIEEpsilon)
y=(y*y*y);
else
- y=(100.0*L)/CIEK;
+ y=L/CIEK;
if ((z*z*z) > CIEEpsilon)
z=(z*z*z);
else
% o red, green, blue: A pointer to a pixel component of type Quantum.
%
*/
+
+static inline void ConvertLCHabToXYZ(const double luma,const double chroma,
+ const double hue,double *X,double *Y,double *Z)
+{
+ ConvertLabToXYZ(luma,chroma*cos(hue*MagickPI/180.0),chroma*
+ sin(hue*MagickPI/180.0),X,Y,Z);
+}
+
MagickPrivate void ConvertLCHabToRGB(const double luma,const double chroma,
const double hue,double *red,double *green,double *blue)
{
double
- a,
- b,
- C,
- H,
- L,
X,
Y,
Z;
assert(red != (double *) NULL);
assert(green != (double *) NULL);
assert(blue != (double *) NULL);
- L=luma;
- C=chroma;
- H=hue;
- a=C*cos(360.0*H*MagickPI/180.0);
- b=C*sin(360.0*H*MagickPI/180.0);
- ConvertLabToXYZ(((116.0*L)-16.0)/100.0,(500.0*a)/255.0+0.5,(200.0*b)/255.0+
- 0.5,&X,&Y,&Z);
+ ConvertLCHabToXYZ(luma*100.0,255.0*(chroma-0.5),255.0*(hue-0.5),&X,&Y,&Z);
ConvertXYZToRGB(X,Y,Z,red,green,blue);
}
\f