MagickCore  7.1.0
pixel.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/script/license.php
9 
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.
15 
16  MagickCore image pixel methods.
17 */
18 #ifndef MAGICKCORE_PIXEL_H
19 #define MAGICKCORE_PIXEL_H
20 
21 #include "MagickCore/colorspace.h"
22 
23 #if defined(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
27 #define MaxPixelChannels 64
28 #undef index
29 
30 /*
31  Pixel enum declarations.
32 */
33 typedef enum
34 {
35  UndefinedChannel = 0x0000,
36  RedChannel = 0x0001,
37  GrayChannel = 0x0001,
38  CyanChannel = 0x0001,
39  LChannel = 0x0001,
40  GreenChannel = 0x0002,
41  MagentaChannel = 0x0002,
42  aChannel = 0x0002,
43  BlueChannel = 0x0004,
44  bChannel = 0x0002,
45  YellowChannel = 0x0004,
46  BlackChannel = 0x0008,
47  AlphaChannel = 0x0010,
48  OpacityChannel = 0x0010,
49  IndexChannel = 0x0020, /* Color Index Table? */
50  ReadMaskChannel = 0x0040, /* Pixel is Not Readable? */
51  WriteMaskChannel = 0x0080, /* Pixel is Write Protected? */
52  MetaChannel = 0x0100, /* not used */
53  CompositeMaskChannel = 0x0200, /* SVG mask */
55  AllChannels = 0x7ffffff,
56  /*
57  Special purpose channel types.
58  FUTURE: are these needed any more - they are more like hacks
59  SyncChannels for example is NOT a real channel but a 'flag'
60  It really says -- "User has not defined channels"
61  Though it does have extra meaning in the "-auto-level" operator
62  */
63  TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
64  RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */
65  GrayChannels = 0x0400,
66  SyncChannels = 0x20000, /* channels modified as a single unit */
68 } ChannelType; /* must correspond to PixelChannel */
69 
70 typedef enum
71 {
96  SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
97 } PixelChannel; /* must correspond to ChannelType */
98 
99 typedef enum
100 {
112 
113 typedef enum
114 {
116  AverageInterpolatePixel, /* Average 4 nearest neighbours */
117  Average9InterpolatePixel, /* Average 9 nearest neighbours */
118  Average16InterpolatePixel, /* Average 16 nearest neighbours */
119  BackgroundInterpolatePixel, /* Just return background color */
120  BilinearInterpolatePixel, /* Triangular filter interpolation */
121  BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */
122  CatromInterpolatePixel, /* Catmull-Rom interpolation */
123  IntegerInterpolatePixel, /* Integer (floor) interpolation */
124  MeshInterpolatePixel, /* Triangular Mesh interpolation */
125  NearestInterpolatePixel, /* Nearest Neighbour Only */
126  SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */
128 
129 typedef enum
130 {
131  UndefinedPixelMask = 0x000000,
132  ReadPixelMask = 0x000001,
133  WritePixelMask = 0x000002,
135 } PixelMask;
136 
137 typedef enum
138 {
140  CopyPixelTrait = 0x000001,
141  UpdatePixelTrait = 0x000002,
142  BlendPixelTrait = 0x000004
143 } PixelTrait;
144 
145 typedef enum
146 {
155 } StorageType;
156 
157 /*
158  Pixel typedef declarations.
159 */
160 typedef struct _PixelChannelMap
161 {
164 
165  PixelTrait
167 
168  ssize_t
171 
172 typedef struct _PixelInfo
173 {
174  ClassType
176 
179 
180  PixelTrait
182 
183  double
185 
186  size_t
188 
191 
194  green,
195  blue,
196  black,
197  alpha,
198  index;
199 } PixelInfo;
200 
201 typedef struct _PixelPacket
202 {
203  unsigned int
205  green,
206  blue,
207  alpha,
208  black;
209 } PixelPacket;
210 
211 typedef struct _CacheView
212  CacheView_;
213 
214 /*
215  Pixel method declarations.
216 */
219 
221  ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
222  const size_t,const char *,const StorageType,void *,ExceptionInfo *),
223  ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
224  const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
226  const PixelChannel,const PixelInterpolateMethod,const double,const double,
227  double *,ExceptionInfo *),
229  const Image * magick_restrict,const PixelInterpolateMethod,const double,
230  const double,Quantum *,ExceptionInfo *),
231  InterpolatePixelInfo(const Image *,const CacheView_ *,
232  const PixelInterpolateMethod,const double,const double,PixelInfo *,
233  ExceptionInfo *),
234  IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
235  const Quantum *) magick_attribute((__pure__)),
237  magick_attribute((__pure__)),
238  SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *),
240 
246 
248  *AcquirePixelChannelMap(void),
251 
252 extern MagickExport PixelInfo
253  *ClonePixelInfo(const PixelInfo *);
254 
258 
259 extern MagickExport void
261  GetPixelInfo(const Image *,PixelInfo *),
263 
264 #if defined(__cplusplus) || defined(c_plusplus)
265 }
266 #endif
267 
268 #endif
PixelChannel channel
Definition: pixel.h:163
#define magick_restrict
Definition: MagickCore.h:41
MagickExport MagickBooleanType InterpolatePixelChannel(const Image *magick_restrict, const CacheView_ *, const PixelChannel, const PixelInterpolateMethod, const double, const double, double *, ExceptionInfo *)
MagickDoubleType MagickRealType
Definition: magick-type.h:124
double fuzz
Definition: pixel.h:184
unsigned int green
Definition: pixel.h:204
PixelTrait alpha_trait
Definition: pixel.h:181
MagickExport MagickBooleanType IsFuzzyEquivalencePixel(const Image *, const Quantum *, const Image *, const Quantum *) magick_attribute((__pure__))
PixelInterpolateMethod
Definition: pixel.h:113
MagickExport MagickBooleanType ImportImagePixels(Image *, const ssize_t, const ssize_t, const size_t, const size_t, const char *, const StorageType, const void *, ExceptionInfo *)
MagickExport MagickRealType GetPixelIntensity(const Image *magick_restrict, const Quantum *magick_restrict) magick_hot_spot
StorageType
Definition: pixel.h:145
PixelIntensityMethod
Definition: pixel.h:99
MagickRealType red
Definition: pixel.h:193
ClassType storage_class
Definition: pixel.h:175
MagickSizeType count
Definition: pixel.h:190
unsigned int blue
Definition: pixel.h:204
Definition: pixel.h:44
MagickRealType alpha
Definition: pixel.h:193
MagickExport MagickBooleanType IsFuzzyEquivalencePixelInfo(const PixelInfo *, const PixelInfo *) magick_attribute((__pure__))
ssize_t offset
Definition: pixel.h:169
Definition: image.h:151
#define magick_attribute(x)
MagickExport MagickRealType DecodePixelGamma(const MagickRealType) magick_hot_spot
MagickBooleanType
Definition: magick-type.h:165
ClassType
Definition: magick-type.h:158
unsigned int black
Definition: pixel.h:204
struct _PixelInfo PixelInfo
#define magick_hot_spot
MagickExport PixelChannelMap * DestroyPixelChannelMap(PixelChannelMap *)
Definition: pixel.c:350
struct _PixelChannelMap PixelChannelMap
size_t MagickSizeType
Definition: magick-type.h:134
MagickRealType blue
Definition: pixel.h:193
unsigned int alpha
Definition: pixel.h:204
ChannelType
Definition: pixel.h:33
MagickExport void ConformPixelInfo(Image *, const PixelInfo *, PixelInfo *, ExceptionInfo *)
PixelChannel
Definition: pixel.h:70
size_t depth
Definition: pixel.h:187
MagickRealType index
Definition: pixel.h:193
MagickExport MagickBooleanType InterpolatePixelInfo(const Image *, const CacheView_ *, const PixelInterpolateMethod, const double, const double, PixelInfo *, ExceptionInfo *)
struct _PixelPacket PixelPacket
unsigned short Quantum
Definition: magick-type.h:86
unsigned int red
Definition: pixel.h:204
MagickRealType black
Definition: pixel.h:193
Definition: pixel.h:42
Definition: pixel.h:39
ColorspaceType
Definition: colorspace.h:25
#define MaxPixelChannels
Definition: pixel.h:27
MagickExport PixelChannelMap * AcquirePixelChannelMap(void)
MagickExport void GetPixelInfo(const Image *, PixelInfo *)
MagickExport void InitializePixelChannelMap(Image *)
Definition: pixel.c:4334
MagickRealType green
Definition: pixel.h:193
MagickExport MagickBooleanType SortImagePixels(Image *, ExceptionInfo *)
Definition: pixel.c:6386
MagickExport MagickRealType GetPixelInfoIntensity(const Image *magick_restrict, const PixelInfo *magick_restrict) magick_hot_spot
#define MagickExport
PixelTrait traits
Definition: pixel.h:166
ColorspaceType colorspace
Definition: pixel.h:178
PixelMask
Definition: pixel.h:129
MagickExport MagickBooleanType InterpolatePixelChannels(const Image *magick_restrict, const CacheView_ *, const Image *magick_restrict, const PixelInterpolateMethod, const double, const double, Quantum *, ExceptionInfo *)
PixelTrait
Definition: pixel.h:137
MagickExport ChannelType SetPixelChannelMask(Image *, const ChannelType)
Definition: pixel.c:6269
MagickExport MagickBooleanType SetPixelMetaChannels(Image *, const size_t, ExceptionInfo *)
MagickExport MagickBooleanType ExportImagePixels(const Image *, const ssize_t, const ssize_t, const size_t, const size_t, const char *, const StorageType, void *, ExceptionInfo *)
MagickExport PixelChannelMap * ClonePixelChannelMap(PixelChannelMap *)
MagickExport PixelInfo * ClonePixelInfo(const PixelInfo *)
Definition: pixel.c:170
MagickExport MagickRealType EncodePixelGamma(const MagickRealType) magick_hot_spot
Definition: pixel.c:446