MagickCore  7.0.3
pixel.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2019 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 32
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  GreenChannel = 0x0002,
40  MagentaChannel = 0x0002,
41  BlueChannel = 0x0004,
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, /* not used */
50  CompositeMaskChannel = 0x0200, /* SVG mask */
52  AllChannels = 0x7ffffff,
53  /*
54  Special purpose channel types.
55  FUTURE: are these needed any more - they are more like hacks
56  SyncChannels for example is NOT a real channel but a 'flag'
57  It really says -- "User has not defined channels"
58  Though it does have extra meaning in the "-auto-level" operator
59  */
60  TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
61  RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */
62  GrayChannels = 0x0400,
63  SyncChannels = 0x20000, /* channels modified as a single unit */
65 } ChannelType; /* must correspond to PixelChannel */
66 
67 typedef enum
68 {
93  SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
94 } PixelChannel; /* must correspond to ChannelType */
95 
96 typedef enum
97 {
109 
110 typedef enum
111 {
113  AverageInterpolatePixel, /* Average 4 nearest neighbours */
114  Average9InterpolatePixel, /* Average 9 nearest neighbours */
115  Average16InterpolatePixel, /* Average 16 nearest neighbours */
116  BackgroundInterpolatePixel, /* Just return background color */
117  BilinearInterpolatePixel, /* Triangular filter interpolation */
118  BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */
119  CatromInterpolatePixel, /* Catmull-Rom interpolation */
120  IntegerInterpolatePixel, /* Integer (floor) interpolation */
121  MeshInterpolatePixel, /* Triangular Mesh interpolation */
122  NearestInterpolatePixel, /* Nearest Neighbour Only */
123  SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */
125 
126 typedef enum
127 {
128  UndefinedPixelMask = 0x000000,
129  ReadPixelMask = 0x000001,
130  WritePixelMask = 0x000002,
132 } PixelMask;
133 
134 typedef enum
135 {
137  CopyPixelTrait = 0x000001,
138  UpdatePixelTrait = 0x000002,
139  BlendPixelTrait = 0x000004
140 } PixelTrait;
141 
142 typedef enum
143 {
152 } StorageType;
153 
154 /*
155  Pixel typedef declarations.
156 */
157 typedef struct _PixelChannelMap
158 {
161 
162  PixelTrait
164 
165  ssize_t
168 
169 typedef struct _PixelInfo
170 {
171  ClassType
173 
176 
177  PixelTrait
179 
180  double
182 
183  size_t
185 
188 
191  green,
192  blue,
193  black,
194  alpha,
195  index;
196 } PixelInfo;
197 
198 typedef struct _PixelPacket
199 {
200  unsigned int
202  green,
203  blue,
204  alpha,
205  black;
206 } PixelPacket;
207 
208 typedef struct _CacheView
209  CacheView_;
210 
211 /*
212  Pixel method declarations.
213 */
216 
218  ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
219  const size_t,const char *,const StorageType,void *,ExceptionInfo *),
220  ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
221  const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
223  const PixelChannel,const PixelInterpolateMethod,const double,const double,
224  double *,ExceptionInfo *),
226  const Image * magick_restrict,const PixelInterpolateMethod,const double,
227  const double,Quantum *,ExceptionInfo *),
228  InterpolatePixelInfo(const Image *,const CacheView_ *,
229  const PixelInterpolateMethod,const double,const double,PixelInfo *,
230  ExceptionInfo *),
231  IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
232  const Quantum *) magick_attribute((__pure__)),
233  IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *)
234  magick_attribute((__pure__)),
235  SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *);
236 
239  const PixelInfo *magick_restrict) magick_hot_spot,
240  GetPixelIntensity(const Image *magick_restrict,
241  const Quantum *magick_restrict) magick_hot_spot;
242 
244  *AcquirePixelChannelMap(void),
246  *DestroyPixelChannelMap(PixelChannelMap *);
247 
248 extern MagickExport PixelInfo
249  *ClonePixelInfo(const PixelInfo *);
250 
252  DecodePixelGamma(const MagickRealType) magick_hot_spot,
253  EncodePixelGamma(const MagickRealType) magick_hot_spot;
254 
255 extern MagickExport void
256  ConformPixelInfo(Image *,const PixelInfo *,PixelInfo *,ExceptionInfo *),
257  GetPixelInfo(const Image *,PixelInfo *),
258  InitializePixelChannelMap(Image *);
259 
260 #if defined(__cplusplus) || defined(c_plusplus)
261 }
262 #endif
263 
264 #endif
PixelChannel channel
Definition: pixel.h:160
#define magick_restrict
Definition: MagickCore.h:41
MagickExport MagickRealType EncodePixelGamma(const MagickRealType pixel)
Definition: pixel.c:446
MagickDoubleType MagickRealType
Definition: magick-type.h:120
MagickExport void InitializePixelChannelMap(Image *image)
Definition: pixel.c:4328
double fuzz
Definition: pixel.h:181
MagickExport PixelChannelMap * AcquirePixelChannelMap(void)
Definition: pixel.c:93
unsigned int green
Definition: pixel.h:201
PixelTrait alpha_trait
Definition: pixel.h:178
PixelInterpolateMethod
Definition: pixel.h:110
StorageType
Definition: pixel.h:142
PixelIntensityMethod
Definition: pixel.h:96
MagickExport MagickBooleanType InterpolatePixelChannel(const Image *magick_restrict image, const CacheView_ *image_view, const PixelChannel channel, const PixelInterpolateMethod method, const double x, const double y, double *pixel, ExceptionInfo *exception)
Definition: pixel.c:4486
MagickExport MagickBooleanType InterpolatePixelChannels(const Image *magick_restrict source, const CacheView_ *source_view, const Image *magick_restrict destination, const PixelInterpolateMethod method, const double x, const double y, Quantum *pixel, ExceptionInfo *exception)
Definition: pixel.c:4911
MagickRealType red
Definition: pixel.h:190
ClassType storage_class
Definition: pixel.h:172
MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image, const CacheView_ *image_view, const PixelInterpolateMethod method, const double x, const double y, PixelInfo *pixel, ExceptionInfo *exception)
Definition: pixel.c:5477
MagickSizeType count
Definition: pixel.h:187
unsigned int blue
Definition: pixel.h:201
MagickRealType alpha
Definition: pixel.h:190
ssize_t offset
Definition: pixel.h:166
MagickExport void GetPixelInfo(const Image *image, PixelInfo *pixel)
Definition: pixel.c:2170
Definition: image.h:151
#define magick_attribute(x)
MagickExport MagickRealType DecodePixelGamma(const MagickRealType pixel)
Definition: pixel.c:319
MagickExport MagickBooleanType ImportImagePixels(Image *image, const ssize_t x, const ssize_t y, const size_t width, const size_t height, const char *map, const StorageType type, const void *pixels, ExceptionInfo *exception)
Definition: pixel.c:4132
MagickBooleanType
Definition: magick-type.h:158
MagickExport PixelChannelMap * ClonePixelChannelMap(PixelChannelMap *channel_map)
Definition: pixel.c:133
ClassType
Definition: magick-type.h:151
unsigned int black
Definition: pixel.h:201
struct _PixelInfo PixelInfo
struct _PixelChannelMap PixelChannelMap
size_t MagickSizeType
Definition: magick-type.h:130
MagickExport PixelChannelMap * DestroyPixelChannelMap(PixelChannelMap *channel_map)
Definition: pixel.c:350
MagickRealType blue
Definition: pixel.h:190
MagickExport ChannelType SetPixelChannelMask(Image *image, const ChannelType channel_mask)
Definition: pixel.c:6277
MagickExport MagickRealType GetPixelInfoIntensity(const Image *magick_restrict image, const PixelInfo *magick_restrict pixel)
Definition: pixel.c:2224
unsigned int alpha
Definition: pixel.h:201
ChannelType
Definition: pixel.h:33
PixelChannel
Definition: pixel.h:67
size_t depth
Definition: pixel.h:184
MagickExport PixelInfo * ClonePixelInfo(const PixelInfo *pixel)
Definition: pixel.c:170
MagickRealType index
Definition: pixel.h:190
MagickExport MagickBooleanType IsFuzzyEquivalencePixel(const Image *source, const Quantum *p, const Image *destination, const Quantum *q)
Definition: pixel.c:5950
MagickExport void ConformPixelInfo(Image *image, const PixelInfo *source, PixelInfo *destination, ExceptionInfo *exception)
Definition: pixel.c:212
MagickExport MagickBooleanType ExportImagePixels(const Image *image, const ssize_t x, const ssize_t y, const size_t width, const size_t height, const char *map, const StorageType type, void *pixels, ExceptionInfo *exception)
Definition: pixel.c:1964
struct _PixelPacket PixelPacket
unsigned short Quantum
Definition: magick-type.h:82
unsigned int red
Definition: pixel.h:201
MagickRealType black
Definition: pixel.h:190
MagickExport MagickBooleanType IsFuzzyEquivalencePixelInfo(const PixelInfo *p, const PixelInfo *q)
Definition: pixel.c:6061
ColorspaceType
Definition: colorspace.h:25
#define MaxPixelChannels
Definition: pixel.h:27
MagickRealType green
Definition: pixel.h:190
#define MagickExport
MagickExport MagickBooleanType SetPixelMetaChannels(Image *image, const size_t number_meta_channels, ExceptionInfo *exception)
Definition: pixel.c:6361
PixelTrait traits
Definition: pixel.h:163
ColorspaceType colorspace
Definition: pixel.h:175
MagickExport MagickBooleanType magick_hot_spot
Definition: cache-view.h:88
PixelMask
Definition: pixel.h:126
PixelTrait
Definition: pixel.h:134
MagickExport MagickRealType GetPixelIntensity(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
Definition: pixel.c:2358