MagickCore  7.0.7
Convert, Edit, Or Compose Bitmap Images
pixel.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2018 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.
6  obtain a copy of the License at
7 
8  https://www.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, /* ???? */
51  AllChannels = 0x7ffffff,
52  /*
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
58  */
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 */
64 } ChannelType; /* must correspond to PixelChannel */
65 
66 typedef enum
67 {
91  SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
92 } PixelChannel; /* must correspond to ChannelType */
93 
94 typedef enum
95 {
107 
108 typedef enum
109 {
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) */
124 
125 typedef enum
126 {
127  UndefinedPixelMask = 0x000000,
128  ReadPixelMask = 0x000001,
129  WritePixelMask = 0x000002
130 } PixelMask;
131 
132 typedef enum
133 {
135  CopyPixelTrait = 0x000001,
136  UpdatePixelTrait = 0x000002,
137  BlendPixelTrait = 0x000004
138 } PixelTrait;
139 
140 typedef enum
141 {
150 } StorageType;
151 
152 /*
153  Pixel typedef declarations.
154 */
155 typedef struct _PixelChannelMap
156 {
157  PixelChannel
159 
160  PixelTrait
162 
163  ssize_t
166 
167 typedef struct _PixelInfo
168 {
169  ClassType
171 
174 
175  PixelTrait
177 
178  double
180 
181  size_t
183 
186 
189  green,
190  blue,
191  black,
192  alpha,
193  index;
194 } PixelInfo;
195 
196 typedef struct _PixelPacket
197 {
198  unsigned int
200  green,
201  blue,
202  alpha,
203  black;
204 } PixelPacket;
205 
206 typedef struct _CacheView
207  CacheView_;
208 
209 /*
210  Pixel method declarations.
211 */
212 extern MagickExport ChannelType
213  SetPixelChannelMask(Image *,const ChannelType);
214 
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 *,
225  ExceptionInfo *),
226  InterpolatePixelInfo(const Image *,const CacheView_ *,
227  const PixelInterpolateMethod,const double,const double,PixelInfo *,
228  ExceptionInfo *),
229  IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
230  const Quantum *),
232  SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *);
233 
236  const PixelInfo *magick_restrict) magick_hot_spot,
238  const Quantum *magick_restrict) magick_hot_spot;
239 
241  *AcquirePixelChannelMap(void),
244 
245 extern MagickExport PixelInfo
246  *ClonePixelInfo(const PixelInfo *);
247 
251 
252 extern MagickExport void
254  GetPixelInfo(const Image *,PixelInfo *),
256 
257 #if defined(__cplusplus) || defined(c_plusplus)
258 }
259 #endif
260 
261 #endif
PixelChannel channel
Definition: pixel.h:158
#define magick_restrict
Definition: MagickCore.h:41
MagickDoubleType MagickRealType
Definition: magick-type.h:118
double fuzz
Definition: pixel.h:179
PixelTrait alpha_trait
Definition: pixel.h:176
PixelInterpolateMethod
Definition: pixel.h:108
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:140
PixelIntensityMethod
Definition: pixel.h:94
MagickRealType red
Definition: pixel.h:188
ClassType storage_class
Definition: pixel.h:170
MagickSizeType count
Definition: pixel.h:185
ssize_t offset
Definition: pixel.h:164
Definition: image.h:151
MagickExport MagickRealType DecodePixelGamma(const MagickRealType) magick_hot_spot
MagickBooleanType
Definition: magick-type.h:156
ClassType
Definition: magick-type.h:149
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:128
MagickExport MagickBooleanType IsFuzzyEquivalencePixelInfo(const PixelInfo *, const PixelInfo *)
ChannelType
Definition: pixel.h:33
MagickExport MagickBooleanType InterpolatePixelChannels(const Image *, const CacheView_ *, const Image *, const PixelInterpolateMethod, const double, const double, Quantum *, ExceptionInfo *)
MagickExport void ConformPixelInfo(Image *, const PixelInfo *, PixelInfo *, ExceptionInfo *)
PixelChannel
Definition: pixel.h:66
MagickExport MagickBooleanType InterpolatePixelChannel(const Image *, const CacheView_ *, const PixelChannel, const PixelInterpolateMethod, const double, const double, double *, ExceptionInfo *)
size_t depth
Definition: pixel.h:182
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:82
unsigned int red
Definition: pixel.h:199
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:4316
MagickExport MagickRealType GetPixelInfoIntensity(const Image *magick_restrict, const PixelInfo *magick_restrict) magick_hot_spot
#define MagickExport
PixelTrait traits
Definition: pixel.h:161
ColorspaceType colorspace
Definition: pixel.h:173
PixelMask
Definition: pixel.h:125
PixelTrait
Definition: pixel.h:132
MagickExport ChannelType SetPixelChannelMask(Image *, const ChannelType)
Definition: pixel.c:6258
MagickExport MagickBooleanType SetPixelMetaChannels(Image *, const size_t, ExceptionInfo *)
Definition: pixel.c:6340
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 MagickBooleanType IsFuzzyEquivalencePixel(const Image *, const Quantum *, const Image *, const Quantum *)
MagickExport PixelInfo * ClonePixelInfo(const PixelInfo *)
Definition: pixel.c:170
MagickExport MagickRealType EncodePixelGamma(const MagickRealType) magick_hot_spot
Definition: pixel.c:446