blob: 031d89ab29cd8b02bce561869e527e88cda0b239 [file] [log] [blame]
cristy4c08aed2011-07-01 19:47:50 +00001/*
cristy1454be72011-12-19 01:52:48 +00002 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
cristy4c08aed2011-07-01 19:47:50 +00003 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
cristyd04e7bf2012-03-03 19:19:12 +000016 MagickCore image pixel methods.
cristy4c08aed2011-07-01 19:47:50 +000017*/
18#ifndef _MAGICKCORE_PIXEL_H
19#define _MAGICKCORE_PIXEL_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25#include <MagickCore/colorspace.h>
cristy4c08aed2011-07-01 19:47:50 +000026
cristyed231572011-07-14 02:18:59 +000027#define MaxPixelChannels 32
cristy4af4a772011-09-07 21:40:44 +000028#undef index
cristy490408a2011-07-07 14:42:05 +000029
cristy4c08aed2011-07-01 19:47:50 +000030typedef enum
31{
cristyc8d63672012-01-11 13:03:13 +000032 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
58typedef enum
59{
cristy4c08aed2011-07-01 19:47:50 +000060 UndefinedInterpolatePixel,
61 AverageInterpolatePixel,
62 BicubicInterpolatePixel,
63 BilinearInterpolatePixel,
64 FilterInterpolatePixel,
65 IntegerInterpolatePixel,
66 MeshInterpolatePixel,
67 NearestNeighborInterpolatePixel,
68 SplineInterpolatePixel
cristy5c4e2582011-09-11 19:21:03 +000069} PixelInterpolateMethod;
cristy4c08aed2011-07-01 19:47:50 +000070
71typedef enum
72{
cristy6dcb9b82011-10-23 23:21:25 +000073 UndefinedPixelChannel = 0,
cristyed231572011-07-14 02:18:59 +000074 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,
cristye2a912b2011-12-05 20:02:07 +000084 BlackPixelChannel = 3,
85 AlphaPixelChannel = 4,
86 IndexPixelChannel = 5,
87 MaskPixelChannel = 6,
88 MetaPixelChannel = 7,
cristy2bddff82011-07-25 18:39:12 +000089 IntensityPixelChannel = MaxPixelChannels,
cristy5f95f4f2011-10-23 01:01:01 +000090 CompositePixelChannel = MaxPixelChannels,
cristy2bddff82011-07-25 18:39:12 +000091 SyncPixelChannel = MaxPixelChannels+1
cristyc8d63672012-01-11 13:03:13 +000092} PixelChannel; /* must correspond to ChannelType */
cristy4c08aed2011-07-01 19:47:50 +000093
94typedef enum
95{
cristy94bc3bf2011-07-04 18:55:37 +000096 UndefinedPixelTrait = 0x000000,
cristyed231572011-07-14 02:18:59 +000097 CopyPixelTrait = 0x000001,
98 UpdatePixelTrait = 0x000002,
99 BlendPixelTrait = 0x000004
cristy94bc3bf2011-07-04 18:55:37 +0000100} PixelTrait;
cristy4c08aed2011-07-01 19:47:50 +0000101
cristyed231572011-07-14 02:18:59 +0000102typedef struct _PixelChannelMap
103{
104 PixelChannel
105 channel;
106
107 PixelTrait
108 traits;
cristye2a912b2011-12-05 20:02:07 +0000109
cristyd26338f2011-12-14 02:39:30 +0000110 ssize_t
cristye2a912b2011-12-05 20:02:07 +0000111 offset;
cristyed231572011-07-14 02:18:59 +0000112} PixelChannelMap;
113
cristy4c08aed2011-07-01 19:47:50 +0000114typedef 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
cristy3094b7f2011-10-01 23:18:02 +0000131 MagickSizeType
132 count;
133
134 double
cristy4c08aed2011-07-01 19:47:50 +0000135 red,
136 green,
137 blue,
cristy4c08aed2011-07-01 19:47:50 +0000138 black,
cristy3094b7f2011-10-01 23:18:02 +0000139 alpha,
cristy4c08aed2011-07-01 19:47:50 +0000140 index;
141} PixelInfo;
142
cristy101ab702011-10-13 13:06:32 +0000143typedef struct _PixelPacket
cristy5c4e2582011-09-11 19:21:03 +0000144{
145 unsigned int
146 red,
147 green,
148 blue,
149 alpha,
150 black;
cristy4c08aed2011-07-01 19:47:50 +0000151} PixelPacket;
152
cristy3f858f42012-01-07 00:03:25 +0000153typedef enum
154{
155 UndefinedPixel,
156 CharPixel,
157 DoublePixel,
158 FloatPixel,
cristy3f858f42012-01-07 00:03:25 +0000159 LongPixel,
cristy6c9e1682012-01-07 21:37:44 +0000160 LongLongPixel,
cristy3f858f42012-01-07 00:03:25 +0000161 QuantumPixel,
162 ShortPixel
163} StorageType;
164
cristy4c08aed2011-07-01 19:47:50 +0000165typedef struct _CacheView
166 CacheView_;
167
cristybd5a96c2011-08-21 00:04:26 +0000168extern MagickExport ChannelType
169 SetPixelChannelMask(Image *,const ChannelType);
170
cristy4c08aed2011-07-01 19:47:50 +0000171extern 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,
cristy018f07f2011-09-04 21:15:19 +0000175 const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
cristya085a432011-07-30 01:39:32 +0000176 InterpolatePixelChannel(const Image *,const CacheView_ *,
cristy5c4e2582011-09-11 19:21:03 +0000177 const PixelChannel,const PixelInterpolateMethod,const double,const double,
cristya085a432011-07-30 01:39:32 +0000178 double *,ExceptionInfo *),
cristy5c4e2582011-09-11 19:21:03 +0000179 InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
180 const PixelInterpolateMethod,const double,const double,Quantum *,
181 ExceptionInfo *),
cristy4c08aed2011-07-01 19:47:50 +0000182 InterpolatePixelInfo(const Image *,const CacheView_ *,
cristy5c4e2582011-09-11 19:21:03 +0000183 const PixelInterpolateMethod,const double,const double,PixelInfo *,
cristy4c08aed2011-07-01 19:47:50 +0000184 ExceptionInfo *),
cristye4a40472011-12-22 02:56:19 +0000185 IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
cristy4c08aed2011-07-01 19:47:50 +0000186 const Quantum *),
cristy101ab702011-10-13 13:06:32 +0000187 IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *);
cristy4c08aed2011-07-01 19:47:50 +0000188
cristyed231572011-07-14 02:18:59 +0000189extern MagickExport PixelChannelMap
cristybd5a96c2011-08-21 00:04:26 +0000190 *AcquirePixelChannelMap(void),
191 *ClonePixelChannelMap(PixelChannelMap *),
192 *DestroyPixelChannelMap(PixelChannelMap *);
cristy4c08aed2011-07-01 19:47:50 +0000193
194extern MagickExport PixelInfo
195 *ClonePixelInfo(const PixelInfo *);
196
197extern MagickExport void
cristybd5a96c2011-08-21 00:04:26 +0000198 InitializePixelChannelMap(Image *),
cristy2b9582a2011-07-04 17:38:56 +0000199 GetPixelInfo(const Image *,PixelInfo *),
cristye2a912b2011-12-05 20:02:07 +0000200 SetPixelChannelMapMask(Image *,const ChannelType);
cristy4c08aed2011-07-01 19:47:50 +0000201
202#if defined(__cplusplus) || defined(c_plusplus)
203}
204#endif
205
206#endif