MagickCore  7.1.1-43
Convert, Edit, Or Compose Bitmap Images
pixel.h
1 /*
2  Copyright @ 1999 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 #if defined(MAGICKCORE_64BIT_CHANNEL_MASK_SUPPORT)
34 typedef enum : MagickOffsetType
35 #else
36 typedef enum
37 #endif
38 {
39  UndefinedChannel = 0x0000,
40  RedChannel = 0x0001,
41  GrayChannel = 0x0001,
42  CyanChannel = 0x0001,
43  LChannel = 0x0001,
44  GreenChannel = 0x0002,
45  MagentaChannel = 0x0002,
46  aChannel = 0x0002,
47  BlueChannel = 0x0004,
48  bChannel = 0x0002,
49  YellowChannel = 0x0004,
50  BlackChannel = 0x0008,
51  AlphaChannel = 0x0010,
52  OpacityChannel = 0x0010,
53  IndexChannel = 0x0020, /* Color Index Table? */
54  ReadMaskChannel = 0x0040, /* Pixel is Not Readable? */
55  WriteMaskChannel = 0x0080, /* Pixel is Write Protected? */
56  MetaChannel = 0x0100, /* not used */
57  CompositeMaskChannel = 0x0200, /* SVG mask */
58  CompositeChannels = 0x001F,
59 #if defined(MAGICKCORE_64BIT_CHANNEL_MASK_SUPPORT)
60  AllChannels = MagickLLConstant(0x7FFFFFFFFFFFFFFF),
61 #else
62  AllChannels = 0X7FFFFFF,
63 #endif
64  /*
65  Special purpose channel types.
66  FUTURE: are these needed any more - they are more like hacks
67  SyncChannels for example is NOT a real channel but a 'flag'
68  It really says -- "User has not defined channels"
69  Though it does have extra meaning in the "-auto-level" operator
70  */
71  TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
72  RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */
73  GrayChannels = 0x0400,
74  SyncChannels = 0x20000, /* channels modified as a single unit */
75  DefaultChannels = AllChannels
76 } ChannelType; /* must correspond to PixelChannel */
77 
78 typedef enum
79 {
80  UndefinedPixelChannel = 0,
81  RedPixelChannel = 0,
82  CyanPixelChannel = 0,
83  GrayPixelChannel = 0,
84  LPixelChannel = 0,
85  LabelPixelChannel = 0,
86  YPixelChannel = 0,
87  aPixelChannel = 1,
88  GreenPixelChannel = 1,
89  MagentaPixelChannel = 1,
90  CbPixelChannel = 1,
91  bPixelChannel = 2,
92  BluePixelChannel = 2,
93  YellowPixelChannel = 2,
94  CrPixelChannel = 2,
95  BlackPixelChannel = 3,
96  AlphaPixelChannel = 4,
97  IndexPixelChannel = 5,
98  ReadMaskPixelChannel = 6,
99  WriteMaskPixelChannel = 7,
100  MetaPixelChannel = 8, /* deprecated */
101  CompositeMaskPixelChannel = 9,
102  MetaPixelChannels = 10,
103  IntensityPixelChannel = MaxPixelChannels, /* ???? */
104  CompositePixelChannel = MaxPixelChannels, /* ???? */
105  SyncPixelChannel = MaxPixelChannels+1 /* not a real channel */
106 } PixelChannel; /* must correspond to ChannelType */
107 
108 typedef enum
109 {
110  UndefinedPixelIntensityMethod = 0,
111  AveragePixelIntensityMethod,
112  BrightnessPixelIntensityMethod,
113  LightnessPixelIntensityMethod,
114  MSPixelIntensityMethod,
115  Rec601LumaPixelIntensityMethod,
116  Rec601LuminancePixelIntensityMethod,
117  Rec709LumaPixelIntensityMethod,
118  Rec709LuminancePixelIntensityMethod,
119  RMSPixelIntensityMethod
120 } PixelIntensityMethod;
121 
122 typedef enum
123 {
124  UndefinedInterpolatePixel,
125  AverageInterpolatePixel, /* Average 4 nearest neighbours */
126  Average9InterpolatePixel, /* Average 9 nearest neighbours */
127  Average16InterpolatePixel, /* Average 16 nearest neighbours */
128  BackgroundInterpolatePixel, /* Just return background color */
129  BilinearInterpolatePixel, /* Triangular filter interpolation */
130  BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */
131  CatromInterpolatePixel, /* Catmull-Rom interpolation */
132  IntegerInterpolatePixel, /* Integer (floor) interpolation */
133  MeshInterpolatePixel, /* Triangular Mesh interpolation */
134  NearestInterpolatePixel, /* Nearest Neighbour Only */
135  SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */
136 } PixelInterpolateMethod;
137 
138 typedef enum
139 {
140  UndefinedPixelMask = 0x000000,
141  ReadPixelMask = 0x000001,
142  WritePixelMask = 0x000002,
143  CompositePixelMask = 0x000004
144 } PixelMask;
145 
146 typedef enum
147 {
148  UndefinedPixelTrait = 0x000000,
149  CopyPixelTrait = 0x000001,
150  UpdatePixelTrait = 0x000002,
151  BlendPixelTrait = 0x000004
152 } PixelTrait;
153 
154 typedef enum
155 {
156  UndefinedPixel,
157  CharPixel,
158  DoublePixel,
159  FloatPixel,
160  LongPixel,
161  LongLongPixel,
162  QuantumPixel,
163  ShortPixel
164 } StorageType;
165 
166 /*
167  Pixel typedef declarations.
168 */
169 typedef struct _PixelChannelMap
170 {
171  PixelChannel
172  channel;
173 
174  PixelTrait
175  traits;
176 
177  ssize_t
178  offset;
180 
181 typedef struct _PixelInfo
182 {
183  ClassType
184  storage_class;
185 
186  ColorspaceType
187  colorspace;
188 
189  PixelTrait
190  alpha_trait;
191 
192  double
193  fuzz;
194 
195  size_t
196  depth;
197 
198  MagickSizeType
199  count;
200 
201  MagickRealType
202  red,
203  green,
204  blue,
205  black,
206  alpha,
207  index;
208 } PixelInfo;
209 
210 typedef struct _PixelPacket
211 {
212  unsigned int
213  red,
214  green,
215  blue,
216  alpha,
217  black;
218 } PixelPacket;
219 
220 typedef struct _CacheView
221  CacheView_;
222 
223 /*
224  Pixel method declarations.
225 */
226 extern MagickExport ChannelType
227  SetPixelChannelMask(Image *,const ChannelType);
228 
229 extern MagickExport MagickBooleanType
230  ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
231  const size_t,const char *,const StorageType,void *,ExceptionInfo *),
232  ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
233  const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
234  InterpolatePixelChannel(const Image *magick_restrict,const CacheView_ *,
235  const PixelChannel,const PixelInterpolateMethod,const double,const double,
236  double *,ExceptionInfo *),
237  InterpolatePixelChannels(const Image *magick_restrict,const CacheView_ *,
238  const Image * magick_restrict,const PixelInterpolateMethod,const double,
239  const double,Quantum *,ExceptionInfo *),
240  InterpolatePixelInfo(const Image *,const CacheView_ *,
241  const PixelInterpolateMethod,const double,const double,PixelInfo *,
242  ExceptionInfo *),
243  IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
244  const Quantum *) magick_attribute((__pure__)),
245  IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *)
246  magick_attribute((__pure__)),
247  SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *),
248  SortImagePixels(Image *,ExceptionInfo *);
249 
250 extern MagickExport MagickRealType
251  GetPixelInfoIntensity(const Image *magick_restrict,
252  const PixelInfo *magick_restrict) magick_hot_spot,
253  GetPixelIntensity(const Image *magick_restrict,
254  const Quantum *magick_restrict) magick_hot_spot;
255 
256 extern MagickExport PixelChannelMap
257  *AcquirePixelChannelMap(void),
258  *ClonePixelChannelMap(PixelChannelMap *),
259  *DestroyPixelChannelMap(PixelChannelMap *);
260 
261 extern MagickExport PixelInfo
262  *ClonePixelInfo(const PixelInfo *);
263 
264 extern MagickExport MagickRealType
265  DecodePixelGamma(const MagickRealType) magick_hot_spot,
266  EncodePixelGamma(const MagickRealType) magick_hot_spot;
267 
268 extern MagickExport void
269  ConformPixelInfo(Image *,const PixelInfo *,PixelInfo *,ExceptionInfo *),
270  GetPixelInfo(const Image *,PixelInfo *);
271 
272 #if defined(__cplusplus) || defined(c_plusplus)
273 }
274 #endif
275 
276 #endif
_CacheView
Definition: cache-view.c:65
_Image
Definition: image.h:131
_PixelInfo
Definition: pixel.h:181
_ExceptionInfo
Definition: exception.h:101
_PixelChannelMap
Definition: pixel.h:169
_PixelPacket
Definition: pixel.h:210