/*
- Copyright 1999-2012 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
+#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
-#include <MagickCore/image.h>
-#include <MagickCore/image-private.h>
-#include <MagickCore/pixel.h>
-#include <MagickCore/pixel-accessor.h>
+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 ConvertsRGBToCMYK(PixelInfo *pixel)
+static inline void ConvertRGBToCMYK(PixelInfo *pixel)
{
MagickRealType
black,
magenta,
red,
yellow;
-
- red=DecompandsRGB(QuantumScale*pixel->red);
- green=DecompandsRGB(QuantumScale*pixel->green);
- blue=DecompandsRGB(QuantumScale*pixel->blue);
- if ((fabs(red) < MagickEpsilon) && (fabs(green) < MagickEpsilon) &&
- (fabs(blue) < MagickEpsilon))
+
+ if (pixel->colorspace != sRGBColorspace)
+ {
+ red=QuantumScale*pixel->red;
+ green=QuantumScale*pixel->green;
+ blue=QuantumScale*pixel->blue;
+ }
+ else
+ {
+ red=QuantumScale*DecodePixelGamma(pixel->red);
+ green=QuantumScale*DecodePixelGamma(pixel->green);
+ blue=QuantumScale*DecodePixelGamma(pixel->blue);
+ }
+ if ((fabs((double) red) < MagickEpsilon) &&
+ (fabs((double) green) < MagickEpsilon) &&
+ (fabs((double) blue) < MagickEpsilon))
{
pixel->black=(MagickRealType) QuantumRange;
return;
static inline MagickBooleanType IsGrayColorspace(
const ColorspaceType colorspace)
{
- if ((colorspace == GRAYColorspace) || (colorspace == Rec601LumaColorspace) ||
- (colorspace == Rec709LumaColorspace))
+ if (colorspace == GRAYColorspace)
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IsRGBColorspace(const ColorspaceType colorspace)
{
- if (colorspace == RGBColorspace)
+ if ((colorspace == RGBColorspace) || (colorspace == scRGBColorspace))
return(MagickTrue);
return(MagickFalse);
}
static inline MagickBooleanType IssRGBCompatibleColorspace(
const ColorspaceType colorspace)
{
- if ((colorspace == sRGBColorspace) || (colorspace == TransparentColorspace) ||
- (colorspace == RGBColorspace) || (colorspace == GRAYColorspace))
+ if ((colorspace == sRGBColorspace) || (colorspace == RGBColorspace) ||
+ (colorspace == scRGBColorspace) ||
+ (IsGrayColorspace(colorspace) != MagickFalse))
return(MagickTrue);
return(MagickFalse);
}