(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 24 Jun 2013 16:09:41 +0000 (16:09 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 24 Jun 2013 16:09:41 +0000 (16:09 +0000)
MagickCore/fx.c
MagickCore/pixel-accessor.h
MagickCore/xwindow-private.h
MagickCore/xwindow.c

index 9e1f0eafb735f03181df9e23e1576adea38e88ac..8a85db5cdb36c1b6d8abbbfc3e76d5664158a04e 100644 (file)
@@ -1708,12 +1708,20 @@ static double FxGetSymbol(FxInfo *fx_info,const PixelChannel channel,
             &lightness);
           return(lightness);
         }
+      if (LocaleCompare(symbol,"luma") == 0)
+        {
+          double
+            luma;
+
+          luma=0.212656*pixel.red+0.715158*pixel.green+0.072186*pixel.blue;
+          return(QuantumScale*luma);
+        }
       if (LocaleCompare(symbol,"luminance") == 0)
         {
           double
             luminence;
 
-          luminence=0.21267f*pixel.red+0.71516f*pixel.green+0.07217f*pixel.blue;
+          luminence=0.212656*pixel.red+0.715158*pixel.green+0.072186*pixel.blue;
           return(QuantumScale*luminence);
         }
       break;
index 5cfb82b71cff15bbbb2b6e2eb501510828b76729..5c6cf47fe744773d45155f00d970447f28f430c4 100644 (file)
@@ -197,40 +197,45 @@ static inline MagickRealType GetPixelInfoChannel(
 
 static inline MagickRealType GetPixelInfoIntensity(
   const PixelInfo *restrict pixel_info)
+{
+  if (pixel_info->colorspace == GRAYColorspace)
+    return(pixel_info->red);
+  return(0.212656*pixel_info->red+0.715158*pixel_info->green+0.072186*pixel_info->blue);
+}
+
+static inline MagickRealType GetPixelInfoLuma(const PixelInfo *restrict pixel)
 {
   MagickRealType
     blue,
     green,
     red;
 
-  if (pixel_info->colorspace == GRAYColorspace)
-    return(pixel_info->red);
-  if (pixel_info->colorspace != sRGBColorspace)
-    return(0.298839*pixel_info->red+0.586811*pixel_info->green+
-      0.114350*pixel_info->blue);
-  red=DecodePixelGamma(pixel_info->red);
-  green=DecodePixelGamma(pixel_info->green);
-  blue=DecodePixelGamma(pixel_info->blue);
-  return(0.298839*red+0.586811*green+0.114350*blue);
+  if (pixel->colorspace == GRAYColorspace)
+    return(pixel->red);
+  if (pixel->colorspace == sRGBColorspace)
+    return(0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue);
+  red=EncodePixelGamma(pixel->red);
+  green=EncodePixelGamma(pixel->green);
+  blue=EncodePixelGamma(pixel->blue);
+  return(0.212656*red+0.715158*green+0.072186*blue);
 }
 
 static inline MagickRealType GetPixelInfoLuminance(
-  const PixelInfo *restrict pixel_info)
+  const PixelInfo *restrict pixel)
 {
   MagickRealType
     blue,
     green,
     red;
 
-  if (pixel_info->colorspace == GRAYColorspace)
-    return(pixel_info->red);
-  if (pixel_info->colorspace != sRGBColorspace)
-    return(0.21267f*pixel_info->red+0.71516f*pixel_info->green+
-      0.07217f*pixel_info->blue);
-  red=DecodePixelGamma(pixel_info->red);
-  green=DecodePixelGamma(pixel_info->green);
-  blue=DecodePixelGamma(pixel_info->blue);
-  return(0.21267f*red+0.71516f*green+0.07217f*blue);
+  if (pixel->colorspace == GRAYColorspace)
+    return(pixel->red);
+  if (pixel->colorspace != sRGBColorspace)
+    return(0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue);
+  red=DecodePixelGamma(pixel->red);
+  green=DecodePixelGamma(pixel->green);
+  blue=DecodePixelGamma(pixel->blue);
+  return(0.212656*red+0.715158*green+0.072186*blue);
 }
 
 static inline Quantum GetPixelL(const Image *restrict image,
@@ -244,9 +249,9 @@ static inline MagickRealType GetPixelLuma(const Image *restrict image,
 {
   if (image->colorspace == GRAYColorspace)
     return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
-  return(0.21267f*pixel[image->channel_map[RedPixelChannel].offset]+
-    0.71516f*pixel[image->channel_map[GreenPixelChannel].offset]+
-    0.07217f*pixel[image->channel_map[BluePixelChannel].offset]);  /* Rec709 */
+  return(0.212656f*pixel[image->channel_map[RedPixelChannel].offset]+
+    0.715158f*pixel[image->channel_map[GreenPixelChannel].offset]+
+    0.072186f*pixel[image->channel_map[BluePixelChannel].offset]);  /* Rec709 */
 }
 
 static inline MagickRealType GetPixelLuminance(const Image *restrict image,
@@ -260,16 +265,16 @@ static inline MagickRealType GetPixelLuminance(const Image *restrict image,
   if (image->colorspace == GRAYColorspace)
     return((MagickRealType) pixel[image->channel_map[GrayPixelChannel].offset]);
   if (image->colorspace != sRGBColorspace)
-    return(0.21267f*pixel[image->channel_map[RedPixelChannel].offset]+
-      0.71516f*pixel[image->channel_map[GreenPixelChannel].offset]+
-      0.07217f*pixel[image->channel_map[BluePixelChannel].offset]);
+    return(0.212656*pixel[image->channel_map[RedPixelChannel].offset]+
+      0.715158*pixel[image->channel_map[GreenPixelChannel].offset]+
+      0.072186*pixel[image->channel_map[BluePixelChannel].offset]);
   red=DecodePixelGamma((MagickRealType)
     pixel[image->channel_map[RedPixelChannel].offset]);
   green=DecodePixelGamma((MagickRealType)
     pixel[image->channel_map[GreenPixelChannel].offset]);
   blue=DecodePixelGamma((MagickRealType)
     pixel[image->channel_map[BluePixelChannel].offset]);
-  return(0.21267f*red+0.71516f*green+0.07217f*blue);  /* Rec709 */
+  return(0.212656*red+0.715158*green+0.072186*blue);  /* Rec709 */
 }
 
 static inline Quantum GetPixelMagenta(const Image *restrict image,
index 5f854d74f86722c66b96b0360fbb5061b37b2900..f82f8383f97d24f669fb226887ac26c7c32f0128 100644 (file)
@@ -601,14 +601,12 @@ extern MagickExport XrmDatabase
 static inline double XPixelIntensity(const XColor *pixel)
 {
   double
-    blue,
-    green,
-    red;
-
-  red=DecodePixelGamma((MagickRealType) pixel->red);
-  green=DecodePixelGamma((MagickRealType) pixel->green);
-  blue=DecodePixelGamma((MagickRealType) pixel->blue);
-  return(0.298839*red+0.586811*green+0.114350*blue);
+    intensity;
+
+  if ((pixel->red  == pixel->green) && (pixel->green == pixel->blue))
+    return((double) pixel->red);
+  intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
+  return(intensity);
 }
 
 #endif
index e1bd10d3987dd0cd83403c5484709552d91a9761..7be1ff7fa83e0998953b94d52ab7bb3b16ee98bc 100644 (file)
@@ -7681,7 +7681,7 @@ static inline double DiversityPixelIntensity(
   double
     intensity;
 
-  intensity=0.298839*pixel->red+0.586811*pixel->green+0.114350*pixel->blue;
+  intensity=0.212656*pixel->red+0.715158*pixel->green+0.072186*pixel->blue;
   return(intensity);
 }