blob: 691c96ae5a3142263f0a569cd22cd5e0ea70cad5 [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.
anthonyaa6b0842012-03-22 00:25:25 +000050 FUTURE: are these needed any more - they are more like hacks
51 SyncChannels for example is NOT a real channel but a 'flag'
52 It really says -- "User has not defined channels"
cristyc8d63672012-01-11 13:03:13 +000053 */
54 TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
55 RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */
56 GrayChannels = 0x0400,
anthonyaa6b0842012-03-22 00:25:25 +000057 SyncChannels = 0x20000, /* channels modified as a single unit */
cristyc8d63672012-01-11 13:03:13 +000058 DefaultChannels = ((AllChannels | SyncChannels) &~ AlphaChannel)
59} ChannelType; /* must correspond to PixelChannel */
60
61typedef enum
62{
cristy4c08aed2011-07-01 19:47:50 +000063 UndefinedInterpolatePixel,
64 AverageInterpolatePixel,
65 BicubicInterpolatePixel,
66 BilinearInterpolatePixel,
67 FilterInterpolatePixel,
68 IntegerInterpolatePixel,
69 MeshInterpolatePixel,
70 NearestNeighborInterpolatePixel,
71 SplineInterpolatePixel
cristy5c4e2582011-09-11 19:21:03 +000072} PixelInterpolateMethod;
cristy4c08aed2011-07-01 19:47:50 +000073
74typedef enum
75{
cristy6dcb9b82011-10-23 23:21:25 +000076 UndefinedPixelChannel = 0,
cristyed231572011-07-14 02:18:59 +000077 RedPixelChannel = 0,
78 CyanPixelChannel = 0,
79 GrayPixelChannel = 0,
80 YPixelChannel = 0,
81 GreenPixelChannel = 1,
82 MagentaPixelChannel = 1,
83 CbPixelChannel = 1,
84 BluePixelChannel = 2,
85 YellowPixelChannel = 2,
86 CrPixelChannel = 2,
cristye2a912b2011-12-05 20:02:07 +000087 BlackPixelChannel = 3,
88 AlphaPixelChannel = 4,
89 IndexPixelChannel = 5,
anthonyaa6b0842012-03-22 00:25:25 +000090 MaskPixelChannel = 6, /* Image Write Mask */
91 MetaPixelChannel = 7, /* ??? */
92 IntensityPixelChannel = MaxPixelChannels, /* what are these ??? */
cristy5f95f4f2011-10-23 01:01:01 +000093 CompositePixelChannel = MaxPixelChannels,
cristy2bddff82011-07-25 18:39:12 +000094 SyncPixelChannel = MaxPixelChannels+1
cristyc8d63672012-01-11 13:03:13 +000095} PixelChannel; /* must correspond to ChannelType */
cristy4c08aed2011-07-01 19:47:50 +000096
97typedef enum
98{
cristy94bc3bf2011-07-04 18:55:37 +000099 UndefinedPixelTrait = 0x000000,
cristyed231572011-07-14 02:18:59 +0000100 CopyPixelTrait = 0x000001,
101 UpdatePixelTrait = 0x000002,
102 BlendPixelTrait = 0x000004
cristy94bc3bf2011-07-04 18:55:37 +0000103} PixelTrait;
cristy4c08aed2011-07-01 19:47:50 +0000104
cristyed231572011-07-14 02:18:59 +0000105typedef struct _PixelChannelMap
106{
107 PixelChannel
108 channel;
109
110 PixelTrait
111 traits;
cristye2a912b2011-12-05 20:02:07 +0000112
cristyd26338f2011-12-14 02:39:30 +0000113 ssize_t
cristye2a912b2011-12-05 20:02:07 +0000114 offset;
cristyed231572011-07-14 02:18:59 +0000115} PixelChannelMap;
116
cristy4c08aed2011-07-01 19:47:50 +0000117typedef struct _PixelInfo
118{
119 ClassType
120 storage_class;
121
122 ColorspaceType
123 colorspace;
124
125 MagickBooleanType
126 matte;
127
128 double
129 fuzz;
130
131 size_t
132 depth;
133
cristy3094b7f2011-10-01 23:18:02 +0000134 MagickSizeType
135 count;
136
137 double
cristy4c08aed2011-07-01 19:47:50 +0000138 red,
139 green,
140 blue,
cristy4c08aed2011-07-01 19:47:50 +0000141 black,
cristy3094b7f2011-10-01 23:18:02 +0000142 alpha,
cristy4c08aed2011-07-01 19:47:50 +0000143 index;
144} PixelInfo;
145
cristy101ab702011-10-13 13:06:32 +0000146typedef struct _PixelPacket
cristy5c4e2582011-09-11 19:21:03 +0000147{
148 unsigned int
149 red,
150 green,
151 blue,
152 alpha,
153 black;
cristy4c08aed2011-07-01 19:47:50 +0000154} PixelPacket;
155
cristy3f858f42012-01-07 00:03:25 +0000156typedef enum
157{
158 UndefinedPixel,
159 CharPixel,
160 DoublePixel,
161 FloatPixel,
cristy3f858f42012-01-07 00:03:25 +0000162 LongPixel,
cristy6c9e1682012-01-07 21:37:44 +0000163 LongLongPixel,
cristy3f858f42012-01-07 00:03:25 +0000164 QuantumPixel,
165 ShortPixel
166} StorageType;
167
cristy4c08aed2011-07-01 19:47:50 +0000168typedef struct _CacheView
169 CacheView_;
170
cristybd5a96c2011-08-21 00:04:26 +0000171extern MagickExport ChannelType
172 SetPixelChannelMask(Image *,const ChannelType);
173
cristy4c08aed2011-07-01 19:47:50 +0000174extern MagickExport MagickBooleanType
175 ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
176 const size_t,const char *,const StorageType,void *,ExceptionInfo *),
177 ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
cristy018f07f2011-09-04 21:15:19 +0000178 const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
cristya085a432011-07-30 01:39:32 +0000179 InterpolatePixelChannel(const Image *,const CacheView_ *,
cristy5c4e2582011-09-11 19:21:03 +0000180 const PixelChannel,const PixelInterpolateMethod,const double,const double,
cristya085a432011-07-30 01:39:32 +0000181 double *,ExceptionInfo *),
cristy5c4e2582011-09-11 19:21:03 +0000182 InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
183 const PixelInterpolateMethod,const double,const double,Quantum *,
184 ExceptionInfo *),
cristy4c08aed2011-07-01 19:47:50 +0000185 InterpolatePixelInfo(const Image *,const CacheView_ *,
cristy5c4e2582011-09-11 19:21:03 +0000186 const PixelInterpolateMethod,const double,const double,PixelInfo *,
cristy4c08aed2011-07-01 19:47:50 +0000187 ExceptionInfo *),
cristye4a40472011-12-22 02:56:19 +0000188 IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *,
cristy4c08aed2011-07-01 19:47:50 +0000189 const Quantum *),
cristy322d07d2012-03-18 21:17:23 +0000190 IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *),
191 SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *);
cristy4c08aed2011-07-01 19:47:50 +0000192
cristyed231572011-07-14 02:18:59 +0000193extern MagickExport PixelChannelMap
cristybd5a96c2011-08-21 00:04:26 +0000194 *AcquirePixelChannelMap(void),
195 *ClonePixelChannelMap(PixelChannelMap *),
196 *DestroyPixelChannelMap(PixelChannelMap *);
cristy4c08aed2011-07-01 19:47:50 +0000197
198extern MagickExport PixelInfo
199 *ClonePixelInfo(const PixelInfo *);
200
201extern MagickExport void
cristybd5a96c2011-08-21 00:04:26 +0000202 InitializePixelChannelMap(Image *),
cristy2b9582a2011-07-04 17:38:56 +0000203 GetPixelInfo(const Image *,PixelInfo *),
cristye2a912b2011-12-05 20:02:07 +0000204 SetPixelChannelMapMask(Image *,const ChannelType);
cristy4c08aed2011-07-01 19:47:50 +0000205
206#if defined(__cplusplus) || defined(c_plusplus)
207}
208#endif
209
210#endif