]> granicus.if.org Git - imagemagick/blob - MagickCore/pixel.h
(no commit message)
[imagemagick] / MagickCore / pixel.h
1 /*
2   Copyright 1999-2012 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     http://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 constitute methods.
17 */
18 #ifndef _MAGICKCORE_PIXEL_H
19 #define _MAGICKCORE_PIXEL_H
20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 #include <MagickCore/colorspace.h>
26
27 #define MaxPixelChannels  32
28 #undef index
29
30 typedef enum
31 {
32   UndefinedChannel = 0x0000,
33   RedChannel = 0x0001,
34   GrayChannel = 0x0001,
35   CyanChannel = 0x0001,
36   GreenChannel = 0x0002,
37   MagentaChannel = 0x0002,
38   BlueChannel = 0x0004,
39   YellowChannel = 0x0004,
40   BlackChannel = 0x0008,
41   AlphaChannel = 0x0010,
42   OpacityChannel = 0x0010,
43   IndexChannel = 0x0020,
44   MaskChannel = 0x0040,
45   MetaChannel = 0x0080,
46   CompositeChannels = 0x002F,
47   AllChannels = 0x7ffffff,
48   /*
49     Special purpose channel types.
50   */
51   TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
52   RGBChannels = 0x0200,      /* set alpha from grayscale mask in RGB */
53   GrayChannels = 0x0400,
54   SyncChannels = 0x1000,     /* channels should be modified equally */
55   DefaultChannels = ((AllChannels | SyncChannels) &~ AlphaChannel)
56 } ChannelType;  /* must correspond to PixelChannel */
57
58 typedef enum
59 {
60   UndefinedInterpolatePixel,
61   AverageInterpolatePixel,
62   BicubicInterpolatePixel,
63   BilinearInterpolatePixel,
64   FilterInterpolatePixel,
65   IntegerInterpolatePixel,
66   MeshInterpolatePixel,
67   NearestNeighborInterpolatePixel,
68   SplineInterpolatePixel
69 } PixelInterpolateMethod;
70
71 typedef enum
72 {
73   UndefinedPixelChannel = 0,
74   RedPixelChannel = 0,
75   CyanPixelChannel = 0,
76   GrayPixelChannel = 0,
77   YPixelChannel = 0,
78   GreenPixelChannel = 1,
79   MagentaPixelChannel = 1,
80   CbPixelChannel = 1,
81   BluePixelChannel = 2,
82   YellowPixelChannel = 2,
83   CrPixelChannel = 2,
84   BlackPixelChannel = 3,
85   AlphaPixelChannel = 4,
86   IndexPixelChannel = 5,
87   MaskPixelChannel = 6,
88   MetaPixelChannel = 7,
89   IntensityPixelChannel = MaxPixelChannels,
90   CompositePixelChannel = MaxPixelChannels,
91   SyncPixelChannel = MaxPixelChannels+1
92 } PixelChannel;  /* must correspond to ChannelType */
93
94 typedef enum
95 {
96   UndefinedPixelTrait = 0x000000,
97   CopyPixelTrait = 0x000001,
98   UpdatePixelTrait = 0x000002,
99   BlendPixelTrait = 0x000004
100 } PixelTrait;
101
102 typedef struct _PixelChannelMap
103 {
104   PixelChannel
105     channel;
106
107   PixelTrait
108     traits;
109
110   ssize_t
111     offset;
112 } PixelChannelMap;
113
114 typedef struct _PixelInfo
115 {
116   ClassType
117     storage_class;
118
119   ColorspaceType
120     colorspace;
121
122   MagickBooleanType
123     matte;
124
125   double
126     fuzz;
127
128   size_t
129     depth;
130
131   MagickSizeType
132     count;
133
134   double
135     red,
136     green,
137     blue,
138     black,
139     alpha,
140     index;
141 } PixelInfo;
142
143 typedef struct _PixelPacket
144 {
145   unsigned int
146     red,
147     green,
148     blue,
149     alpha,
150     black;
151 } PixelPacket;
152
153 typedef enum
154 {
155   UndefinedPixel,
156   CharPixel,
157   DoublePixel,
158   FloatPixel,
159   LongPixel,
160   LongLongPixel,
161   QuantumPixel,
162   ShortPixel
163 } StorageType;
164
165 typedef struct _CacheView
166   CacheView_;
167
168 extern MagickExport ChannelType
169   SetPixelChannelMask(Image *,const ChannelType);
170
171 extern MagickExport MagickBooleanType
172   ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
173     const size_t,const char *,const StorageType,void *,ExceptionInfo *),
174   ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
175     const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
176   InterpolatePixelChannel(const Image *,const CacheView_ *,
177     const PixelChannel,const PixelInterpolateMethod,const double,const double,
178     double *,ExceptionInfo *),
179   InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
180     const PixelInterpolateMethod,const double,const double,Quantum *,
181     ExceptionInfo *),
182   InterpolatePixelInfo(const Image *,const CacheView_ *,
183     const PixelInterpolateMethod,const double,const double,PixelInfo *,
184     ExceptionInfo *),
185   IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
186     const Quantum *),
187   IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *);
188
189 extern MagickExport PixelChannelMap
190   *AcquirePixelChannelMap(void),
191   *ClonePixelChannelMap(PixelChannelMap *),
192   *DestroyPixelChannelMap(PixelChannelMap *);
193
194 extern MagickExport PixelInfo
195   *ClonePixelInfo(const PixelInfo *);
196
197 extern MagickExport void
198   InitializePixelChannelMap(Image *),
199   GetPixelInfo(const Image *,PixelInfo *),
200   SetPixelChannelMapMask(Image *,const ChannelType);
201
202 #if defined(__cplusplus) || defined(c_plusplus)
203 }
204 #endif
205
206 #endif