]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/colorspace-private.h
Update web pages
[imagemagick] / MagickCore / colorspace-private.h
index 6576f95f855f9bcd456e9b4435e860e9894cc09c..79fd6621f31e080d3148858fc393232c5eb0f3c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
+  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization
   dedicated to making software imaging solutions freely available.
   
   You may not use this file except in compliance with the License.
 #ifndef _MAGICKCORE_COLORSPACE_PRIVATE_H
 #define _MAGICKCORE_COLORSPACE_PRIVATE_H
 
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
 #include "MagickCore/image.h"
 #include "MagickCore/image-private.h"
 #include "MagickCore/pixel.h"
 #include "MagickCore/pixel-accessor.h"
 
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+static inline void ConvertCMYKToRGB(PixelInfo *pixel)
+{
+  pixel->red=((QuantumRange-(QuantumScale*pixel->red*(QuantumRange-
+    pixel->black)+pixel->black)));
+  pixel->green=((QuantumRange-(QuantumScale*pixel->green*(QuantumRange-
+    pixel->black)+pixel->black)));
+  pixel->blue=((QuantumRange-(QuantumScale*pixel->blue*(QuantumRange-
+    pixel->black)+pixel->black)));
+}
+
 static inline void ConvertRGBToCMYK(PixelInfo *pixel)
 {
   MagickRealType
@@ -37,7 +47,7 @@ static inline void ConvertRGBToCMYK(PixelInfo *pixel)
     magenta,
     red,
     yellow;
-                                                                                
+
   if (pixel->colorspace != sRGBColorspace)
     {
       red=QuantumScale*pixel->red;
@@ -46,12 +56,13 @@ static inline void ConvertRGBToCMYK(PixelInfo *pixel)
     }
   else
     {
-      red=DecodePixelGamma(pixel->red);
-      green=DecodePixelGamma(pixel->green);
-      blue=DecodePixelGamma(pixel->blue);
+      red=QuantumScale*DecodePixelGamma(pixel->red);
+      green=QuantumScale*DecodePixelGamma(pixel->green);
+      blue=QuantumScale*DecodePixelGamma(pixel->blue);
     }
-  if ((fabs(red) < MagickEpsilon) && (fabs(green) < MagickEpsilon) &&
-      (fabs(blue) < MagickEpsilon))
+  if ((fabs((double) red) < MagickEpsilon) &&
+      (fabs((double) green) < MagickEpsilon) &&
+      (fabs((double) blue) < MagickEpsilon))
     {
       pixel->black=(MagickRealType) QuantumRange;
       return;
@@ -92,8 +103,7 @@ static inline MagickBooleanType IsGrayColorspace(
 
 static inline MagickBooleanType IsRGBColorspace(const ColorspaceType colorspace)
 {
-  if ((colorspace == RGBColorspace) || (colorspace == scRGBColorspace) ||
-      (colorspace == XYZColorspace))
+  if ((colorspace == RGBColorspace) || (colorspace == scRGBColorspace))
     return(MagickTrue);
   return(MagickFalse);
 }