00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MAGICKCORE_PIXEL_PRIVATE_H
00019 #define _MAGICKCORE_PIXEL_PRIVATE_H
00020
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024
00025 #include <magick/exception-private.h>
00026 #include <magick/image.h>
00027 #include <magick/color.h>
00028 #include <magick/image-private.h>
00029 #include <magick/quantum-private.h>
00030
00031 typedef struct _RealPixelPacket
00032 {
00033 MagickRealType
00034 red,
00035 green,
00036 blue,
00037 opacity;
00038 } RealPixelPacket;
00039
00040 static inline MagickPixelPacket *CloneMagickPixelPacket(
00041 const MagickPixelPacket *pixel)
00042 {
00043 MagickPixelPacket
00044 *clone_pixel;
00045
00046 clone_pixel=(MagickPixelPacket *) AcquireMagickMemory(sizeof(*clone_pixel));
00047 if (clone_pixel == (MagickPixelPacket *) NULL)
00048 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
00049 *clone_pixel=(*pixel);
00050 return(clone_pixel);
00051 }
00052
00053 static inline void SetMagickPixelPacket(const Image *image,
00054 const PixelPacket *color,const IndexPacket *index,MagickPixelPacket *pixel)
00055 {
00056 pixel->red=(MagickRealType) color->red;
00057 pixel->green=(MagickRealType) color->green;
00058 pixel->blue=(MagickRealType) color->blue;
00059 pixel->opacity=(MagickRealType) color->opacity;
00060 if (((image->colorspace == CMYKColorspace) ||
00061 (image->storage_class == PseudoClass)) &&
00062 (index != (const IndexPacket *) NULL))
00063 pixel->index=(MagickRealType) *index;
00064 }
00065
00066 static inline void SetPixelPacket(const Image *image,
00067 const MagickPixelPacket *pixel,PixelPacket *color,IndexPacket *index)
00068 {
00069 color->red=RoundToQuantum(pixel->red);
00070 color->green=RoundToQuantum(pixel->green);
00071 color->blue=RoundToQuantum(pixel->blue);
00072 color->opacity=RoundToQuantum(pixel->opacity);
00073 if (((image->colorspace == CMYKColorspace) ||
00074 (image->storage_class == PseudoClass)) &&
00075 (index != (const IndexPacket *) NULL))
00076 *index=RoundToQuantum(pixel->index);
00077 }
00078
00079 #if defined(__cplusplus) || defined(c_plusplus)
00080 }
00081 #endif
00082
00083 #endif