2 Copyright 1999-2014 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 pixel methods.
18 #ifndef _MAGICKCORE_PIXEL_H
19 #define _MAGICKCORE_PIXEL_H
21 #include "MagickCore/colorspace.h"
23 #if defined(__cplusplus) || defined(c_plusplus)
27 #define MaxPixelChannels 32
31 Pixel enum declarations.
35 UndefinedChannel = 0x0000,
39 GreenChannel = 0x0002,
40 MagentaChannel = 0x0002,
42 YellowChannel = 0x0004,
43 BlackChannel = 0x0008,
44 AlphaChannel = 0x0010,
45 OpacityChannel = 0x0010,
46 IndexChannel = 0x0020, /* Color Index Table? */
47 ReadMaskChannel = 0x0040, /* Pixel is Not Readable? */
48 WriteMaskChannel = 0x0080, /* Pixel is Write Protected? */
49 MetaChannel = 0x0100, /* ???? */
50 CompositeChannels = 0x002F,
51 AllChannels = 0x7ffffff,
53 Special purpose channel types.
54 FUTURE: are these needed any more - they are more like hacks
55 SyncChannels for example is NOT a real channel but a 'flag'
56 It really says -- "User has not defined channels"
57 Though it does have extra meaning in the "-auto-level" operator
59 TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
60 RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */
61 GrayChannels = 0x0400,
62 SyncChannels = 0x20000, /* channels modified as a single unit */
63 DefaultChannels = ((AllChannels | SyncChannels) &~ AlphaChannel)
64 } ChannelType; /* must correspond to PixelChannel */
68 UndefinedPixelChannel = 0,
75 GreenPixelChannel = 1,
76 MagentaPixelChannel = 1,
80 YellowPixelChannel = 2,
82 BlackPixelChannel = 3,
83 AlphaPixelChannel = 4,
84 IndexPixelChannel = 5,
85 ReadMaskPixelChannel = 6,
86 WriteMaskPixelChannel = 7,
88 IntensityPixelChannel = MaxPixelChannels, /* ???? */
89 CompositePixelChannel = MaxPixelChannels, /* ???? */
90 SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
91 } PixelChannel; /* must correspond to ChannelType */
95 UndefinedPixelIntensityMethod = 0,
96 AveragePixelIntensityMethod,
97 BrightnessPixelIntensityMethod,
98 LightnessPixelIntensityMethod,
99 MSPixelIntensityMethod,
100 Rec601LumaPixelIntensityMethod,
101 Rec601LuminancePixelIntensityMethod,
102 Rec709LumaPixelIntensityMethod,
103 Rec709LuminancePixelIntensityMethod,
104 RMSPixelIntensityMethod
105 } PixelIntensityMethod;
109 UndefinedInterpolatePixel,
110 AverageInterpolatePixel, /* Average 4 nearest neighbours */
111 Average9InterpolatePixel, /* Average 9 nearest neighbours */
112 Average16InterpolatePixel, /* Average 16 nearest neighbours */
113 BackgroundInterpolatePixel, /* Just return background color */
114 BilinearInterpolatePixel, /* Triangular filter interpolation */
115 BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */
116 CatromInterpolatePixel, /* Catmull-Rom interpolation */
117 IntegerInterpolatePixel, /* Integer (floor) interpolation */
118 MeshInterpolatePixel, /* Triangular Mesh interpolation */
119 NearestInterpolatePixel, /* Nearest Neighbour Only */
120 SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */
121 /* FilterInterpolatePixel, ** Use resize filter - (very slow) */
122 } PixelInterpolateMethod;
126 UndefinedPixelMask = 0x000000,
127 ReadPixelMask = 0x000001,
128 WritePixelMask = 0x000002
133 UndefinedPixelTrait = 0x000000,
134 CopyPixelTrait = 0x000001,
135 UpdatePixelTrait = 0x000002,
136 BlendPixelTrait = 0x000004
152 Pixel typedef declarations.
154 typedef struct _PixelChannelMap
166 typedef struct _PixelInfo
195 typedef struct _PixelPacket
205 typedef struct _CacheView
209 Pixel method declarations.
211 extern MagickExport MagickBooleanType
212 ExportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
213 const size_t,const char *,const StorageType,void *,ExceptionInfo *),
214 ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
215 const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
216 InterpolatePixelChannel(const Image *,const CacheView_ *,
217 const PixelChannel,const PixelInterpolateMethod,const double,const double,
218 double *,ExceptionInfo *),
219 InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
220 const PixelInterpolateMethod,const double,const double,Quantum *,
222 InterpolatePixelInfo(const Image *,const CacheView_ *,
223 const PixelInterpolateMethod,const double,const double,PixelInfo *,
225 IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
227 IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *),
228 SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *);
230 extern MagickExport MagickRealType
231 GetPixelIntensity(const Image *restrict,const Quantum *restrict)
234 extern MagickExport PixelChannelMap
235 *AcquirePixelChannelMap(void),
236 *ClonePixelChannelMap(PixelChannelMap *),
237 *DestroyPixelChannelMap(PixelChannelMap *);
239 extern MagickExport PixelInfo
240 *ClonePixelInfo(const PixelInfo *);
242 extern MagickExport MagickRealType
243 DecodePixelGamma(const MagickRealType) magick_hot_spot,
244 EncodePixelGamma(const MagickRealType) magick_hot_spot;
246 extern MagickExport void
247 InitializePixelChannelMap(Image *),
248 GetPixelInfo(const Image *,PixelInfo *),
249 SetPixelChannelMask(Image *,const ChannelType);
251 #if defined(__cplusplus) || defined(c_plusplus)