]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/xwindow-private.h
(no commit message)
[imagemagick] / MagickCore / xwindow-private.h
index 4133f538fbbee39f2c325dca004e50037d48efdb..91a4ae3f898a41de32ba1ed09ff8575b27b26c90 100644 (file)
@@ -33,6 +33,7 @@ extern "C" {
 #include <X11/Xutil.h>
 #include "MagickCore/exception.h"
 #include "MagickCore/geometry.h"
+#include "MagickCore/pixel-accessor.h"
 #include "MagickCore/quantize.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
@@ -595,13 +596,17 @@ extern MagickExport void
 extern MagickExport XrmDatabase
   XGetResourceDatabase(Display *,const char *);
 
-static inline MagickRealType XPixelIntensity(const XColor *pixel)
+static inline double XPixelIntensity(const XColor *pixel)
 {
-  MagickRealType
-    intensity;
-
-  intensity=0.298839*pixel->red+0.586811*pixel->green+0.114350*pixel->blue;
-  return(intensity);
+  double
+    blue,
+    green,
+    red;
+
+  red=DecodesRGBGamma((double) pixel->red);
+  green=DecodesRGBGamma((double) pixel->green);
+  blue=DecodesRGBGamma((double) pixel->blue);
+  return(0.298839*red+0.586811*green+0.114350*blue);
 }
 
 #endif