00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MAGICKWAND_MOGRIFY_PRIVATE_H
00019 #define _MAGICKWAND_MOGRIFY_PRIVATE_H
00020
00021 #if defined(__cplusplus) || defined(c_plusplus)
00022 extern "C" {
00023 #endif
00024
00025 #define MaxImageStackDepth 32
00026 #define MogrifyImageStack(image,advance,fire) \
00027 if ((j <= i) && (i < argc)) \
00028 { \
00029 if ((image) == (Image *) NULL) \
00030 status&=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **) \
00031 argv+j,exception); \
00032 else \
00033 if ((fire) != MagickFalse) \
00034 { \
00035 status&=MogrifyImages(image_info,(int) (i-j+1),(const char **) \
00036 argv+j,&(image),exception); \
00037 if ((advance) != MagickFalse) \
00038 j=i+1; \
00039 pend=MagickFalse; \
00040 } \
00041 }
00042 #define DegreesToRadians(x) (MagickPI*(x)/180.0)
00043 #define MagickPI 3.14159265358979323846264338327950288419716939937510
00044 #define QuantumScale ((MagickRealType) 1.0/(MagickRealType) QuantumRange)
00045 #define QuantumTick(i,span) ((MagickBooleanType) ((((i) & ((i)-1)) == 0) || \
00046 (((i) & 0xfff) == 0) || \
00047 ((MagickOffsetType) (i) == ((MagickOffsetType) (span)-1))))
00048 #define RadiansToDegrees(x) (180.0*(x)/MagickPI)
00049
00050 static inline MagickRealType MagickPixelIntensity(
00051 const MagickPixelPacket *pixel)
00052 {
00053 MagickRealType
00054 intensity;
00055
00056 intensity=0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue;
00057 return(intensity);
00058 }
00059
00060 static inline Quantum MagickPixelIntensityToQuantum(
00061 const MagickPixelPacket *pixel)
00062 {
00063 MagickRealType
00064 intensity;
00065
00066 intensity=0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue;
00067 return((Quantum) (intensity+0.5));
00068 }
00069
00070 static inline MagickRealType PixelIntensity(const PixelPacket *pixel)
00071 {
00072 MagickRealType
00073 intensity;
00074
00075 intensity=(MagickRealType) (0.299*pixel->red+0.587*pixel->green+
00076 0.114*pixel->blue);
00077 return(intensity);
00078 }
00079
00080 static inline Quantum PixelIntensityToQuantum(const PixelPacket *pixel)
00081 {
00082 MagickRealType
00083 intensity;
00084
00085 intensity=(MagickRealType) (0.299*pixel->red+0.587*pixel->green+
00086 0.114*pixel->blue);
00087 #if !defined(MAGICKCORE_HDRI_SUPPORT)
00088 return((Quantum) (intensity+0.5));
00089 #else
00090 return((Quantum) intensity);
00091 #endif
00092 }
00093
00094 static inline void SetMagickPixelPacket(const Image *image,
00095 const PixelPacket *color,const IndexPacket *index,MagickPixelPacket *pixel)
00096 {
00097 pixel->red=(MagickRealType) color->red;
00098 pixel->green=(MagickRealType) color->green;
00099 pixel->blue=(MagickRealType) color->blue;
00100 if (image->matte != MagickFalse)
00101 pixel->opacity=(MagickRealType) color->opacity;
00102 if (((image->colorspace == CMYKColorspace) ||
00103 (image->storage_class == PseudoClass)) &&
00104 (index != (const IndexPacket *) NULL))
00105 pixel->index=(MagickRealType) *index;
00106 }
00107
00108 #if defined(__cplusplus) || defined(c_plusplus)
00109 }
00110 #endif
00111
00112 #endif