2 Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 http://www.imagemagick.org/script/license.php
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 MagickCore image constitute methods.
18 #ifndef _MAGICKCORE_PIXEL_H
19 #define _MAGICKCORE_PIXEL_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #include <magick/colorspace.h>
26 #include <magick/constitute.h>
28 #define ClampRedPixelComponent(pixel) ClampToQuantum((pixel)->red)
29 #define ClampGreenPixelComponent(pixel) ClampToQuantum((pixel)->green)
30 #define ClampBluePixelComponent(pixel) ClampToQuantum((pixel)->blue)
31 #define ClampIndexPixelComponent(indexes) ClampToQuantum(*(indexes))
32 #define ClampOpacityPixelComponent(pixel) ClampToQuantum((pixel)->opacity)
33 #define GetAlphaPixelComponent(pixel) (QuantumRange-(pixel)->opacity)
34 #define GetBlackPixelComponent(index) (*(index))
35 #define GetBluePixelComponent(pixel) ((pixel)->blue)
36 #define GetCbPixelComponent(pixel) ((pixel)->green)
37 #define GetCrPixelComponent(pixel) ((pixel)->blue)
38 #define GetCyanPixelComponent(pixel) ((pixel)->red)
39 #define GetGrayPixelComponent(pixel) ((pixel)->red)
40 #define GetGreenPixelComponent(pixel) ((pixel)->green)
41 #define GetIndexPixelComponent(indexes) (*(indexes))
42 #define GetMagentaPixelComponent(pixel) ((pixel)->green)
43 #define GetNextPixel(pixel) ((pixel)+1)
44 #define GetOpacityPixelComponent(pixel) ((pixel)->opacity)
45 #define GetRedPixelComponent(pixel) ((pixel)->red)
46 #define GetYPixelComponent(pixel) ((pixel)->red)
47 #define GetYellowPixelComponent(pixel) ((pixel)->blue)
48 #define SetAlphaPixelComponent(pixel,value) \
49 ((pixel)->opacity=(Quantum) (QuantumRange-(value)))
50 #define SetBlackPixelComponent(index,value) (*(index)=(Quantum) (value))
51 #define SetBluePixelComponent(pixel,value) ((pixel)->blue=(Quantum) (value))
52 #define SetCbPixelComponent(pixel,value) ((pixel)->green=(Quantum) (value))
53 #define SetCrPixelComponent(pixel,value) ((pixel)->blue=(Quantum) (value))
54 #define SetCyanPixelComponent(pixel,value) ((pixel)->red=(Quantum) (value))
55 #define SetGrayPixelComponent(pixel,value) \
56 ((pixel)->red=(pixel)->green=(pixel)->blue=(Quantum) (value))
57 #define SetGreenPixelComponent(pixel,value) ((pixel)->green=(Quantum) (value))
58 #define SetIndexPixelComponent(indexes,value) (*(indexes)=(IndexPacket) (value))
59 #define SetMagentaPixelComponent(pixel,value) ((pixel)->green=(Quantum) (value))
60 #define SetOpacityPixelComponent(pixel,value) \
61 ((pixel)->opacity=(Quantum) (value))
62 #define SetRedPixelComponent(pixel,value) ((pixel)->red=(Quantum) (value))
63 #define SetYellowPixelComponent(pixel,value) ((pixel)->blue=(Quantum) (value))
64 #define SetYPixelComponent(pixel,value) ((pixel)->red=(Quantum) (value))
68 UndefinedInterpolatePixel,
69 AverageInterpolatePixel,
70 BicubicInterpolatePixel,
71 BilinearInterpolatePixel,
72 FilterInterpolatePixel,
73 IntegerInterpolatePixel,
75 NearestNeighborInterpolatePixel,
76 SplineInterpolatePixel
77 } InterpolatePixelMethod;
81 RedPixelComponent = 0,
82 CyanPixelComponent = 0,
83 GrayPixelComponent = 0,
85 GreenPixelComponent = 1,
86 MagentaPixelComponent = 1,
88 BluePixelComponent = 2,
89 YellowPixelComponent = 2,
91 AlphaPixelComponent = 3,
92 BlackPixelComponent = 4,
93 IndexPixelComponent = 4,
94 MaskPixelComponent = 5
97 typedef struct _DoublePixelPacket
107 typedef struct _LongPixelPacket
117 typedef struct _MagickPixelPacket
142 typedef Quantum IndexPacket;
144 typedef struct _PixelPacket
146 #if defined(MAGICKCORE_WORDS_BIGENDIAN)
147 #define MAGICK_PIXEL_RGBA 1
154 #define MAGICK_PIXEL_BGRA 1
163 typedef struct _CacheView
166 extern MagickExport MagickBooleanType
167 ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
168 const size_t,const char *,const StorageType,void *,ExceptionInfo *),
169 ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
170 const size_t,const char *,const StorageType,const void *),
171 InterpolateMagickPixelPacket(const Image *,const CacheView_ *,
172 const InterpolatePixelMethod,const double,const double,MagickPixelPacket *,
175 extern MagickExport void
176 GetMagickPixelPacket(const Image *,MagickPixelPacket *);
178 #if defined(__cplusplus) || defined(c_plusplus)