]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 6 May 2013 11:33:57 +0000 (11:33 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 6 May 2013 11:33:57 +0000 (11:33 +0000)
MagickCore/colorspace.c
MagickCore/gem-private.h
MagickCore/gem.c

index 2ccd725f8a6f854665d5af283857197627607e1d..61cc59ece3237ba21eb98017122114f9a52564f2 100644 (file)
@@ -1250,7 +1250,7 @@ static inline void ConvertLabToRGB(const double L,const double a,
     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);
 }
 
index 8f2fe592e921c5d8d05fda1600bcbdee7d479101..323f9ede56c273d0eb45290e13d4537fd866225d 100644 (file)
@@ -84,9 +84,9 @@ static inline void ConvertLabToXYZ(const double L,const double a,const double b,
   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
@@ -94,7 +94,7 @@ static inline void ConvertLabToXYZ(const double L,const double a,const double b,
   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
index ee3375855fabed50112c308b42313f5d07ef4b08..4b6b90518ce62698099668dc92ba27fbcfc21dc7 100644 (file)
@@ -737,15 +737,18 @@ MagickPrivate void ConvertHWBToRGB(const double hue,const double whiteness,
 %    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;
@@ -756,13 +759,7 @@ MagickPrivate void ConvertLCHabToRGB(const double luma,const double chroma,
   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