MagickCore  6.9.11
colorspace.c File Reference
Include dependency graph for colorspace.c:

Go to the source code of this file.

Data Structures

struct  _TransformPacket
 

Macros

#define RGBTransformImageTag   "RGBTransform/Image"
 
#define DisplayGamma   (1.0/1.7)
 
#define FilmGamma   0.6
 
#define ReferenceBlack   95.0
 
#define ReferenceWhite   685.0
 
#define TransformRGBImageTag   "Transform/Image"
 

Typedefs

typedef struct _TransformPacket TransformPacket
 

Functions

MagickExport ColorspaceType GetImageColorspaceType (const Image *image, ExceptionInfo *exception)
 
static void ConvertRGBToCMY (const Quantum red, const Quantum green, const Quantum blue, double *cyan, double *magenta, double *yellow)
 
static void ConvertRGBToLab (const Quantum red, const Quantum green, const Quantum blue, double *L, double *a, double *b)
 
static void ConvertXYZToLMS (const double x, const double y, const double z, double *L, double *M, double *S)
 
static void ConvertRGBToLMS (const Quantum red, const Quantum green, const Quantum blue, double *L, double *M, double *S)
 
static void ConvertRGBToLuv (const Quantum red, const Quantum green, const Quantum blue, double *L, double *u, double *v)
 
static void ConvertRGBToxyY (const Quantum red, const Quantum green, const Quantum blue, double *low_x, double *low_y, double *cap_Y)
 
static void ConvertRGBToYPbPr (const Quantum red, const Quantum green, const Quantum blue, double *Y, double *Pb, double *Pr)
 
static void ConvertRGBToYCbCr (const Quantum red, const Quantum green, const Quantum blue, double *Y, double *Cb, double *Cr)
 
static void ConvertRGBToYUV (const Quantum red, const Quantum green, const Quantum blue, double *Y, double *U, double *V)
 
static void ConvertRGBToYDbDr (const Quantum red, const Quantum green, const Quantum blue, double *Y, double *Db, double *Dr)
 
static void ConvertRGBToYIQ (const Quantum red, const Quantum green, const Quantum blue, double *Y, double *I, double *Q)
 
MagickExport MagickBooleanType RGBTransformImage (Image *image, const ColorspaceType colorspace)
 
MagickExport MagickBooleanType SetImageColorspace (Image *image, const ColorspaceType colorspace)
 
MagickExport MagickBooleanType SetImageGray (Image *image, ExceptionInfo *exception)
 
MagickExport MagickBooleanType SetImageMonochrome (Image *image, ExceptionInfo *exception)
 
MagickExport MagickBooleanType TransformImageColorspace (Image *image, const ColorspaceType colorspace)
 
static void ConvertCMYToRGB (const double cyan, const double magenta, const double yellow, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertLMSToXYZ (const double L, const double M, const double S, double *X, double *Y, double *Z)
 
static void ConvertLMSToRGB (const double L, const double M, const double S, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertLuvToRGB (const double L, const double u, const double v, Quantum *red, Quantum *green, Quantum *blue)
 
static ssize_t RoundToYCC (const MagickRealType value)
 
static void ConvertLabToRGB (const double L, const double a, const double b, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertxyYToRGB (const double low_x, const double low_y, const double cap_Y, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertYPbPrToRGB (const double Y, const double Pb, const double Pr, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertYCbCrToRGB (const double Y, const double Cb, const double Cr, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertYDbDrToRGB (const double Y, const double Db, const double Dr, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertYIQToRGB (const double Y, const double I, const double Q, Quantum *red, Quantum *green, Quantum *blue)
 
static void ConvertYUVToRGB (const double Y, const double U, const double V, Quantum *red, Quantum *green, Quantum *blue)
 
MagickExport MagickBooleanType TransformRGBImage (Image *image, const ColorspaceType colorspace)
 

Macro Definition Documentation

◆ DisplayGamma

#define DisplayGamma   (1.0/1.7)

◆ FilmGamma

#define FilmGamma   0.6

◆ ReferenceBlack

#define ReferenceBlack   95.0

◆ ReferenceWhite

#define ReferenceWhite   685.0

◆ RGBTransformImageTag

#define RGBTransformImageTag   "RGBTransform/Image"

Referenced by RGBTransformImage().

◆ TransformRGBImageTag

#define TransformRGBImageTag   "Transform/Image"

Referenced by TransformRGBImage().

Typedef Documentation

◆ TransformPacket

Function Documentation

◆ ConvertCMYToRGB()

static void ConvertCMYToRGB ( const double  cyan,
const double  magenta,
const double  yellow,
Quantum red,
Quantum green,
Quantum blue 
)
inlinestatic

Definition at line 1572 of file colorspace.c.

References ClampToQuantum(), and QuantumRange.

Referenced by TransformRGBImage().

◆ ConvertLabToRGB()

static void ConvertLabToRGB ( const double  L,
const double  a,
const double  b,
Quantum red,
Quantum green,
Quantum blue 
)
inlinestatic

Definition at line 1621 of file colorspace.c.

References ConvertLabToXYZ(), and ConvertXYZToRGB().

Referenced by TransformRGBImage().

◆ ConvertLMSToRGB()

static void ConvertLMSToRGB ( const double  L,
const double  M,
const double  S,
Quantum red,
Quantum green,
Quantum blue 
)
inlinestatic

Definition at line 1588 of file colorspace.c.

References ConvertLMSToXYZ(), and ConvertXYZToRGB().

Referenced by TransformRGBImage().

◆ ConvertLMSToXYZ()

static void ConvertLMSToXYZ ( const double  L,
const double  M,
const double  S,
double *  X,
double *  Y,
double *  Z 
)
inlinestatic

Definition at line 1580 of file colorspace.c.

Referenced by ConvertLMSToRGB().

◆ ConvertLuvToRGB()

static void ConvertLuvToRGB ( const double  L,
const double  u,
const double  v,
Quantum red,
Quantum green,
Quantum blue 
)
inlinestatic

Definition at line 1600 of file colorspace.c.

References ConvertLuvToXYZ(), and ConvertXYZToRGB().

Referenced by TransformRGBImage().

◆ ConvertRGBToCMY()

static void ConvertRGBToCMY ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  cyan,
double *  magenta,
double *  yellow 
)
inlinestatic

Definition at line 162 of file colorspace.c.

References QuantumRange, and QuantumScale.

Referenced by RGBTransformImage().

◆ ConvertRGBToLab()

static void ConvertRGBToLab ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  L,
double *  a,
double *  b 
)
static

Definition at line 170 of file colorspace.c.

References ConvertRGBToXYZ(), and ConvertXYZToLab().

Referenced by RGBTransformImage().

◆ ConvertRGBToLMS()

static void ConvertRGBToLMS ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  L,
double *  M,
double *  S 
)
static

Definition at line 190 of file colorspace.c.

References ConvertRGBToXYZ(), and ConvertXYZToLMS().

Referenced by RGBTransformImage().

◆ ConvertRGBToLuv()

static void ConvertRGBToLuv ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  L,
double *  u,
double *  v 
)
static

Definition at line 202 of file colorspace.c.

References ConvertRGBToXYZ(), and ConvertXYZToLuv().

Referenced by RGBTransformImage().

◆ ConvertRGBToxyY()

static void ConvertRGBToxyY ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  low_x,
double *  low_y,
double *  cap_Y 
)
static

Definition at line 214 of file colorspace.c.

References ConvertRGBToXYZ(), and PerceptibleReciprocal().

Referenced by RGBTransformImage().

◆ ConvertRGBToYCbCr()

static void ConvertRGBToYCbCr ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  Y,
double *  Cb,
double *  Cr 
)
static

Definition at line 238 of file colorspace.c.

References ConvertRGBToYPbPr().

Referenced by RGBTransformImage().

◆ ConvertRGBToYDbDr()

static void ConvertRGBToYDbDr ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  Y,
double *  Db,
double *  Dr 
)
static

Definition at line 252 of file colorspace.c.

References QuantumScale.

Referenced by RGBTransformImage().

◆ ConvertRGBToYIQ()

static void ConvertRGBToYIQ ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  Y,
double *  I,
double *  Q 
)
static

Definition at line 260 of file colorspace.c.

References QuantumScale.

Referenced by RGBTransformImage().

◆ ConvertRGBToYPbPr()

static void ConvertRGBToYPbPr ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  Y,
double *  Pb,
double *  Pr 
)
static

Definition at line 230 of file colorspace.c.

References QuantumScale.

Referenced by ConvertRGBToYCbCr(), and RGBTransformImage().

◆ ConvertRGBToYUV()

static void ConvertRGBToYUV ( const Quantum  red,
const Quantum  green,
const Quantum  blue,
double *  Y,
double *  U,
double *  V 
)
static

Definition at line 244 of file colorspace.c.

References QuantumScale.

Referenced by RGBTransformImage().

◆ ConvertxyYToRGB()

static void ConvertxyYToRGB ( const double  low_x,
const double  low_y,
const double  cap_Y,
Quantum red,
Quantum green,
Quantum blue 
)
inlinestatic

Definition at line 1633 of file colorspace.c.

References ConvertXYZToRGB(), and PerceptibleReciprocal().

Referenced by TransformRGBImage().

◆ ConvertXYZToLMS()

static void ConvertXYZToLMS ( const double  x,
const double  y,
const double  z,
double *  L,
double *  M,
double *  S 
)
inlinestatic

Definition at line 182 of file colorspace.c.

Referenced by ConvertRGBToLMS().

◆ ConvertYCbCrToRGB()

static void ConvertYCbCrToRGB ( const double  Y,
const double  Cb,
const double  Cr,
Quantum red,
Quantum green,
Quantum blue 
)
static

Definition at line 1660 of file colorspace.c.

References ConvertYPbPrToRGB().

Referenced by TransformRGBImage().

◆ ConvertYDbDrToRGB()

static void ConvertYDbDrToRGB ( const double  Y,
const double  Db,
const double  Dr,
Quantum red,
Quantum green,
Quantum blue 
)
static

Definition at line 1666 of file colorspace.c.

References ClampToQuantum(), and QuantumRange.

Referenced by TransformRGBImage().

◆ ConvertYIQToRGB()

static void ConvertYIQToRGB ( const double  Y,
const double  I,
const double  Q,
Quantum red,
Quantum green,
Quantum blue 
)
static

Definition at line 1677 of file colorspace.c.

References ClampToQuantum(), and QuantumRange.

Referenced by TransformRGBImage().

◆ ConvertYPbPrToRGB()

static void ConvertYPbPrToRGB ( const double  Y,
const double  Pb,
const double  Pr,
Quantum red,
Quantum green,
Quantum blue 
)
static

Definition at line 1649 of file colorspace.c.

References ClampToQuantum(), and QuantumRange.

Referenced by ConvertYCbCrToRGB(), and TransformRGBImage().

◆ ConvertYUVToRGB()

static void ConvertYUVToRGB ( const double  Y,
const double  U,
const double  V,
Quantum red,
Quantum green,
Quantum blue 
)
static

Definition at line 1688 of file colorspace.c.

References ClampToQuantum(), and QuantumRange.

Referenced by TransformRGBImage().

◆ GetImageColorspaceType()

◆ RGBTransformImage()

MagickExport MagickBooleanType RGBTransformImage ( Image image,
const ColorspaceType  colorspace 
)

Definition at line 268 of file colorspace.c.

References AcquireAuthenticCacheView(), AcquireQuantumMemory(), _MagickPixelPacket::blue, _PixelPacket::blue, ClampToQuantum(), CMYColorspace, CMYKColorspace, _Image::colormap, _Image::colors, ColorSeparationMatteType, ColorSeparationType, _Image::columns, ConvertRGBToCMY(), ConvertRGBToCMYK(), ConvertRGBToHCL(), ConvertRGBToHCLp(), ConvertRGBToHSB(), ConvertRGBToHSI(), ConvertRGBToHSL(), ConvertRGBToHSV(), ConvertRGBToHWB(), ConvertRGBToLab(), ConvertRGBToLCHab(), ConvertRGBToLCHuv(), ConvertRGBToLMS(), ConvertRGBToLuv(), ConvertRGBToxyY(), ConvertRGBToXYZ(), ConvertRGBToYCbCr(), ConvertRGBToYDbDr(), ConvertRGBToYIQ(), ConvertRGBToYPbPr(), ConvertRGBToYUV(), _Image::debug, DecodePixelGamma(), DestroyCacheView(), DirectClass, DisplayGamma, _Image::exception, _Image::filename, FilmGamma, GetCacheViewAuthenticIndexQueue(), GetCacheViewAuthenticPixels(), GetImageProperty(), GetMagickModule, GetMagickPixelPacket(), GetPixelBlue, GetPixelGreen, GetPixelRed, GRAYColorspace, GrayscaleType, _MagickPixelPacket::green, _PixelPacket::green, HCLColorspace, HCLpColorspace, HSBColorspace, HSIColorspace, HSLColorspace, HSVColorspace, HWBColorspace, LabColorspace, LCHabColorspace, LCHColorspace, LCHuvColorspace, LinearGRAYColorspace, LMSColorspace, LogColorspace, LogMagickEvent(), LuvColorspace, magick_restrict, MagickCoreSignature, MagickFalse, MagickTrue, _Image::matte, MaxMap, OHTAColorspace, PerceptibleReciprocal(), _Image::progress_monitor, PseudoClass, QuantumRange, QuantumScale, Rec601LumaColorspace, Rec601YCbCrColorspace, Rec709LumaColorspace, Rec709YCbCrColorspace, _MagickPixelPacket::red, _PixelPacket::red, ReferenceBlack, ReferenceWhite, RelinquishMagickMemory(), ResourceLimitError, RGBColorspace, RGBTransformImageTag, _Image::rows, scRGBColorspace, SetImageColorspace(), SetImageProgress(), SetImageStorageClass(), SetMagickPixelPacket(), SetPixelBlue, SetPixelGray, SetPixelGreen, SetPixelPacket(), SetPixelRed, _Image::signature, sRGBColorspace, _Image::storage_class, StringToDouble(), SyncCacheViewAuthenticPixels(), SyncImage(), ThrowBinaryException, TraceEvent, TransparentColorspace, _Image::type, UndefinedColorspace, _TransformPacket::x, _PrimaryInfo::x, xyYColorspace, XYZColorspace, _TransformPacket::y, _PrimaryInfo::y, YCbCrColorspace, YCCColorspace, YDbDrColorspace, YIQColorspace, YPbPrColorspace, YUVColorspace, _TransformPacket::z, and _PrimaryInfo::z.

Referenced by TransformImageColorspace().

◆ RoundToYCC()

static ssize_t RoundToYCC ( const MagickRealType  value)
inlinestatic

Definition at line 1612 of file colorspace.c.

Referenced by TransformRGBImage().

◆ SetImageColorspace()

◆ SetImageGray()

◆ SetImageMonochrome()

◆ TransformImageColorspace()

◆ TransformRGBImage()

MagickExport MagickBooleanType TransformRGBImage ( Image image,
const ColorspaceType  colorspace 
)

Definition at line 1699 of file colorspace.c.

References AcquireAuthenticCacheView(), AcquireQuantumMemory(), _MagickPixelPacket::blue, _PixelPacket::blue, ClampToQuantum(), CMYColorspace, CMYKColorspace, _Image::colormap, _Image::colors, _Image::columns, ConvertCMYKToRGB(), ConvertCMYToRGB(), ConvertHCLpToRGB(), ConvertHCLToRGB(), ConvertHSBToRGB(), ConvertHSIToRGB(), ConvertHSLToRGB(), ConvertHSVToRGB(), ConvertHWBToRGB(), ConvertLabToRGB(), ConvertLCHabToRGB(), ConvertLCHuvToRGB(), ConvertLMSToRGB(), ConvertLuvToRGB(), ConvertxyYToRGB(), ConvertXYZToRGB(), ConvertYCbCrToRGB(), ConvertYDbDrToRGB(), ConvertYIQToRGB(), ConvertYPbPrToRGB(), ConvertYUVToRGB(), _Image::debug, DestroyCacheView(), DirectClass, DisplayGamma, EncodePixelGamma(), _Image::exception, _Image::filename, FilmGamma, GetCacheViewAuthenticIndexQueue(), GetCacheViewAuthenticPixels(), GetImageProperty(), GetMagickModule, GetMagickPixelPacket(), GetPixelBlue, GetPixelGreen, GetPixelRed, GRAYColorspace, _MagickPixelPacket::green, _PixelPacket::green, HCLColorspace, HCLpColorspace, HSBColorspace, HSIColorspace, HSLColorspace, HSVColorspace, HWBColorspace, LabColorspace, LCHabColorspace, LCHColorspace, LCHuvColorspace, LinearGRAYColorspace, LMSColorspace, LogColorspace, LogMagickEvent(), LuvColorspace, magick_restrict, MagickCoreSignature, MagickFalse, MagickTrue, MaxMap, OHTAColorspace, PerceptibleReciprocal(), _Image::progress_monitor, PseudoClass, QuantumRange, QuantumScale, Rec601LumaColorspace, Rec601YCbCrColorspace, Rec709LumaColorspace, Rec709YCbCrColorspace, _MagickPixelPacket::red, _PixelPacket::red, ReferenceBlack, ReferenceWhite, RelinquishMagickMemory(), ResourceLimitError, RGBColorspace, RoundToYCC(), _Image::rows, scRGBColorspace, SetImageColorspace(), SetImageProgress(), SetImageStorageClass(), SetMagickPixelPacket(), SetPixelBlue, SetPixelGreen, SetPixelPacket(), SetPixelRed, _Image::signature, sRGBColorspace, _Image::storage_class, StringToDouble(), SyncCacheViewAuthenticPixels(), SyncImage(), ThrowBinaryException, TraceEvent, TransformRGBImageTag, _TransformPacket::x, xyYColorspace, XYZColorspace, _TransformPacket::y, YCbCrColorspace, YCCColorspace, YDbDrColorspace, YIQColorspace, YPbPrColorspace, YUVColorspace, and _TransformPacket::z.

Referenced by TransformImageColorspace().