2 Copyright 1999-2017 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 https://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 = 0x001F,
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
64 } ChannelType; /* must correspond to PixelChannel */
68 UndefinedPixelChannel = 0,
73 LabelPixelChannel = 0,
76 GreenPixelChannel = 1,
77 MagentaPixelChannel = 1,
81 YellowPixelChannel = 2,
83 BlackPixelChannel = 3,
84 AlphaPixelChannel = 4,
85 IndexPixelChannel = 5,
86 ReadMaskPixelChannel = 6,
87 WriteMaskPixelChannel = 7,
89 IntensityPixelChannel = MaxPixelChannels, /* ???? */
90 CompositePixelChannel = MaxPixelChannels, /* ???? */
91 SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
92 } PixelChannel; /* must correspond to ChannelType */
96 UndefinedPixelIntensityMethod = 0,
97 AveragePixelIntensityMethod,
98 BrightnessPixelIntensityMethod,
99 LightnessPixelIntensityMethod,
100 MSPixelIntensityMethod,
101 Rec601LumaPixelIntensityMethod,
102 Rec601LuminancePixelIntensityMethod,
103 Rec709LumaPixelIntensityMethod,
104 Rec709LuminancePixelIntensityMethod,
105 RMSPixelIntensityMethod
106 } PixelIntensityMethod;
110 UndefinedInterpolatePixel,
111 AverageInterpolatePixel, /* Average 4 nearest neighbours */
112 Average9InterpolatePixel, /* Average 9 nearest neighbours */
113 Average16InterpolatePixel, /* Average 16 nearest neighbours */
114 BackgroundInterpolatePixel, /* Just return background color */
115 BilinearInterpolatePixel, /* Triangular filter interpolation */
116 BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */
117 CatromInterpolatePixel, /* Catmull-Rom interpolation */
118 IntegerInterpolatePixel, /* Integer (floor) interpolation */
119 MeshInterpolatePixel, /* Triangular Mesh interpolation */
120 NearestInterpolatePixel, /* Nearest Neighbour Only */
121 SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */
122 /* FilterInterpolatePixel, ** Use resize filter - (very slow) */
123 } PixelInterpolateMethod;
127 UndefinedPixelMask = 0x000000,
128 ReadPixelMask = 0x000001,
129 WritePixelMask = 0x000002
134 UndefinedPixelTrait = 0x000000,
135 CopyPixelTrait = 0x000001,
136 UpdatePixelTrait = 0x000002,
137 BlendPixelTrait = 0x000004
153 Pixel typedef declarations.
155 typedef struct _PixelChannelMap
167 typedef struct _PixelInfo
196 typedef struct _PixelPacket
206 typedef struct _CacheView
210 Pixel method declarations.
212 extern MagickExport ChannelType
213 SetPixelChannelMask(Image *,const ChannelType);
215 extern MagickExport MagickBooleanType
216 ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
217 const size_t,const char *,const StorageType,void *,ExceptionInfo *),
218 ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
219 const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
220 InterpolatePixelChannel(const Image *,const CacheView_ *,
221 const PixelChannel,const PixelInterpolateMethod,const double,const double,
222 double *,ExceptionInfo *),
223 InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
224 const PixelInterpolateMethod,const double,const double,Quantum *,
226 InterpolatePixelInfo(const Image *,const CacheView_ *,
227 const PixelInterpolateMethod,const double,const double,PixelInfo *,
229 IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
231 IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *),
232 SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *);
234 extern MagickExport MagickRealType
235 GetPixelInfoIntensity(const Image *magick_restrict,
236 const PixelInfo *magick_restrict) magick_hot_spot,
237 GetPixelIntensity(const Image *magick_restrict,
238 const Quantum *magick_restrict) magick_hot_spot;
240 extern MagickExport PixelChannelMap
241 *AcquirePixelChannelMap(void),
242 *ClonePixelChannelMap(PixelChannelMap *),
243 *DestroyPixelChannelMap(PixelChannelMap *);
245 extern MagickExport PixelInfo
246 *ClonePixelInfo(const PixelInfo *);
248 extern MagickExport MagickRealType
249 DecodePixelGamma(const MagickRealType) magick_hot_spot,
250 EncodePixelGamma(const MagickRealType) magick_hot_spot;
252 extern MagickExport void
253 ConformPixelInfo(Image *,const PixelInfo *,PixelInfo *,ExceptionInfo *),
254 GetPixelInfo(const Image *,PixelInfo *),
255 InitializePixelChannelMap(Image *);
257 #if defined(__cplusplus) || defined(c_plusplus)