| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1 | /* |
| cristy | 45ef08f | 2012-12-07 13:13:34 +0000 | [diff] [blame] | 2 | Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 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 | |
| cristy | d04e7bf | 2012-03-03 19:19:12 +0000 | [diff] [blame] | 16 | MagickCore image pixel methods. |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 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 | |
| cristy | f697adb | 2013-01-11 12:20:05 +0000 | [diff] [blame] | 25 | #include "MagickCore/colorspace.h" |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 26 | |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 27 | #define MaxPixelChannels 32 |
| cristy | 4af4a77 | 2011-09-07 21:40:44 +0000 | [diff] [blame] | 28 | #undef index |
| cristy | 490408a | 2011-07-07 14:42:05 +0000 | [diff] [blame] | 29 | |
| cristy | 8dfe0cb | 2013-03-27 22:27:53 +0000 | [diff] [blame] | 30 | /* |
| 31 | Pixel enum declarations. |
| 32 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 33 | typedef enum |
| 34 | { |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 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, |
| cristy | 883fde1 | 2013-04-08 00:50:13 +0000 | [diff] [blame] | 47 | ReadMaskChannel = 0x0040, |
| 48 | WriteMaskChannel = 0x0080, |
| 49 | MetaChannel = 0x0100, |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 50 | CompositeChannels = 0x002F, |
| 51 | AllChannels = 0x7ffffff, |
| 52 | /* |
| 53 | Special purpose channel types. |
| anthony | aa6b084 | 2012-03-22 00:25:25 +0000 | [diff] [blame] | 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" |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 57 | */ |
| 58 | TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */ |
| 59 | RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */ |
| 60 | GrayChannels = 0x0400, |
| anthony | aa6b084 | 2012-03-22 00:25:25 +0000 | [diff] [blame] | 61 | SyncChannels = 0x20000, /* channels modified as a single unit */ |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 62 | DefaultChannels = ((AllChannels | SyncChannels) &~ AlphaChannel) |
| 63 | } ChannelType; /* must correspond to PixelChannel */ |
| 64 | |
| 65 | typedef enum |
| 66 | { |
| cristy | 6dcb9b8 | 2011-10-23 23:21:25 +0000 | [diff] [blame] | 67 | UndefinedPixelChannel = 0, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 68 | RedPixelChannel = 0, |
| 69 | CyanPixelChannel = 0, |
| 70 | GrayPixelChannel = 0, |
| cristy | b564954 | 2012-06-30 22:46:15 +0000 | [diff] [blame] | 71 | LPixelChannel = 0, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 72 | YPixelChannel = 0, |
| cristy | b564954 | 2012-06-30 22:46:15 +0000 | [diff] [blame] | 73 | aPixelChannel = 1, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 74 | GreenPixelChannel = 1, |
| 75 | MagentaPixelChannel = 1, |
| 76 | CbPixelChannel = 1, |
| cristy | b564954 | 2012-06-30 22:46:15 +0000 | [diff] [blame] | 77 | bPixelChannel = 2, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 78 | BluePixelChannel = 2, |
| 79 | YellowPixelChannel = 2, |
| 80 | CrPixelChannel = 2, |
| cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 81 | BlackPixelChannel = 3, |
| 82 | AlphaPixelChannel = 4, |
| 83 | IndexPixelChannel = 5, |
| cristy | 883fde1 | 2013-04-08 00:50:13 +0000 | [diff] [blame] | 84 | ReadMaskPixelChannel = 6, |
| 85 | WriteMaskPixelChannel = 7, |
| 86 | MetaPixelChannel = 8, |
| 87 | IntensityPixelChannel = MaxPixelChannels, |
| cristy | 5f95f4f | 2011-10-23 01:01:01 +0000 | [diff] [blame] | 88 | CompositePixelChannel = MaxPixelChannels, |
| cristy | 2bddff8 | 2011-07-25 18:39:12 +0000 | [diff] [blame] | 89 | SyncPixelChannel = MaxPixelChannels+1 |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 90 | } PixelChannel; /* must correspond to ChannelType */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 91 | |
| 92 | typedef enum |
| 93 | { |
| cristy | ac73d1f | 2013-03-12 00:51:09 +0000 | [diff] [blame] | 94 | UndefinedPixelIntensityMethod = 0, |
| 95 | AveragePixelIntensityMethod, |
| 96 | BrightnessPixelIntensityMethod, |
| 97 | LightnessPixelIntensityMethod, |
| cristy | b04db12 | 2013-04-11 10:26:01 +0000 | [diff] [blame^] | 98 | MSPixelIntensityMethod, |
| cristy | ac73d1f | 2013-03-12 00:51:09 +0000 | [diff] [blame] | 99 | Rec601LumaPixelIntensityMethod, |
| cristy | 2cf5d37 | 2013-03-13 12:03:11 +0000 | [diff] [blame] | 100 | Rec601LuminancePixelIntensityMethod, |
| cristy | ac73d1f | 2013-03-12 00:51:09 +0000 | [diff] [blame] | 101 | Rec709LumaPixelIntensityMethod, |
| cristy | 2cf5d37 | 2013-03-13 12:03:11 +0000 | [diff] [blame] | 102 | Rec709LuminancePixelIntensityMethod, |
| cristy | ac73d1f | 2013-03-12 00:51:09 +0000 | [diff] [blame] | 103 | RMSPixelIntensityMethod |
| 104 | } PixelIntensityMethod; |
| 105 | |
| 106 | typedef enum |
| 107 | { |
| 108 | UndefinedInterpolatePixel, |
| 109 | AverageInterpolatePixel, /* Average 4 nearest neighbours */ |
| 110 | Average9InterpolatePixel, /* Average 9 nearest neighbours */ |
| 111 | Average16InterpolatePixel, /* Average 16 nearest neighbours */ |
| 112 | BackgroundInterpolatePixel, /* Just return background color */ |
| 113 | BilinearInterpolatePixel, /* Triangular filter interpolation */ |
| 114 | BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */ |
| 115 | CatromInterpolatePixel, /* Catmull-Rom interpolation */ |
| 116 | IntegerInterpolatePixel, /* Integer (floor) interpolation */ |
| 117 | MeshInterpolatePixel, /* Triangular Mesh interpolation */ |
| 118 | NearestInterpolatePixel, /* Nearest Neighbour Only */ |
| 119 | SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */ |
| 120 | /* FilterInterpolatePixel, ** Use resize filter - (very slow) */ |
| 121 | } PixelInterpolateMethod; |
| 122 | |
| 123 | typedef enum |
| 124 | { |
| cristy | cf5acb3 | 2013-03-22 01:11:49 +0000 | [diff] [blame] | 125 | UndefinedPixelMask = 0x000000, |
| 126 | ReadPixelMask = 0x000001, |
| 127 | WritePixelMask = 0x000002 |
| 128 | } PixelMask; |
| 129 | |
| 130 | typedef enum |
| 131 | { |
| cristy | 94bc3bf | 2011-07-04 18:55:37 +0000 | [diff] [blame] | 132 | UndefinedPixelTrait = 0x000000, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 133 | CopyPixelTrait = 0x000001, |
| 134 | UpdatePixelTrait = 0x000002, |
| 135 | BlendPixelTrait = 0x000004 |
| cristy | 94bc3bf | 2011-07-04 18:55:37 +0000 | [diff] [blame] | 136 | } PixelTrait; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 137 | |
| cristy | 8dfe0cb | 2013-03-27 22:27:53 +0000 | [diff] [blame] | 138 | typedef enum |
| 139 | { |
| 140 | UndefinedPixel, |
| 141 | CharPixel, |
| 142 | DoublePixel, |
| 143 | FloatPixel, |
| 144 | LongPixel, |
| 145 | LongLongPixel, |
| 146 | QuantumPixel, |
| 147 | ShortPixel |
| 148 | } StorageType; |
| 149 | |
| 150 | /* |
| 151 | Pixel typedef declarations. |
| 152 | */ |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 153 | typedef struct _PixelChannelMap |
| 154 | { |
| 155 | PixelChannel |
| 156 | channel; |
| 157 | |
| 158 | PixelTrait |
| 159 | traits; |
| cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 160 | |
| cristy | d26338f | 2011-12-14 02:39:30 +0000 | [diff] [blame] | 161 | ssize_t |
| cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 162 | offset; |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 163 | } PixelChannelMap; |
| 164 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 165 | typedef struct _PixelInfo |
| 166 | { |
| 167 | ClassType |
| 168 | storage_class; |
| 169 | |
| 170 | ColorspaceType |
| 171 | colorspace; |
| 172 | |
| cristy | 8a46d82 | 2012-08-28 23:32:39 +0000 | [diff] [blame] | 173 | PixelTrait |
| 174 | alpha_trait; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 175 | |
| 176 | double |
| 177 | fuzz; |
| 178 | |
| 179 | size_t |
| 180 | depth; |
| 181 | |
| cristy | 3094b7f | 2011-10-01 23:18:02 +0000 | [diff] [blame] | 182 | MagickSizeType |
| 183 | count; |
| 184 | |
| cristy | c44100b | 2012-10-08 12:34:07 +0000 | [diff] [blame] | 185 | MagickRealType |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 186 | red, |
| 187 | green, |
| 188 | blue, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 189 | black, |
| cristy | 3094b7f | 2011-10-01 23:18:02 +0000 | [diff] [blame] | 190 | alpha, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 191 | index; |
| 192 | } PixelInfo; |
| 193 | |
| cristy | 101ab70 | 2011-10-13 13:06:32 +0000 | [diff] [blame] | 194 | typedef struct _PixelPacket |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 195 | { |
| 196 | unsigned int |
| 197 | red, |
| 198 | green, |
| 199 | blue, |
| 200 | alpha, |
| 201 | black; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 202 | } PixelPacket; |
| 203 | |
| 204 | typedef struct _CacheView |
| 205 | CacheView_; |
| 206 | |
| cristy | 8dfe0cb | 2013-03-27 22:27:53 +0000 | [diff] [blame] | 207 | /* |
| 208 | Pixel method declarations. |
| 209 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 210 | extern MagickExport MagickBooleanType |
| cristy | 2dc655d | 2012-07-05 13:16:28 +0000 | [diff] [blame] | 211 | ExportImagePixels(Image *,const ssize_t,const ssize_t,const size_t, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 212 | const size_t,const char *,const StorageType,void *,ExceptionInfo *), |
| 213 | ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t, |
| cristy | 018f07f | 2011-09-04 21:15:19 +0000 | [diff] [blame] | 214 | const size_t,const char *,const StorageType,const void *,ExceptionInfo *), |
| cristy | a085a43 | 2011-07-30 01:39:32 +0000 | [diff] [blame] | 215 | InterpolatePixelChannel(const Image *,const CacheView_ *, |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 216 | const PixelChannel,const PixelInterpolateMethod,const double,const double, |
| cristy | a085a43 | 2011-07-30 01:39:32 +0000 | [diff] [blame] | 217 | double *,ExceptionInfo *), |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 218 | InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *, |
| 219 | const PixelInterpolateMethod,const double,const double,Quantum *, |
| 220 | ExceptionInfo *), |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 221 | InterpolatePixelInfo(const Image *,const CacheView_ *, |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 222 | const PixelInterpolateMethod,const double,const double,PixelInfo *, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 223 | ExceptionInfo *), |
| cristy | e4a4047 | 2011-12-22 02:56:19 +0000 | [diff] [blame] | 224 | IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 225 | const Quantum *), |
| cristy | 322d07d | 2012-03-18 21:17:23 +0000 | [diff] [blame] | 226 | IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *), |
| 227 | SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 228 | |
| cristy | 9731df7 | 2013-03-12 16:31:13 +0000 | [diff] [blame] | 229 | extern MagickExport MagickRealType |
| 230 | GetPixelIntensity(const Image *restrict,const Quantum *restrict) |
| 231 | magick_hot_spot; |
| 232 | |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 233 | extern MagickExport PixelChannelMap |
| cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 234 | *AcquirePixelChannelMap(void), |
| 235 | *ClonePixelChannelMap(PixelChannelMap *), |
| 236 | *DestroyPixelChannelMap(PixelChannelMap *); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 237 | |
| 238 | extern MagickExport PixelInfo |
| 239 | *ClonePixelInfo(const PixelInfo *); |
| 240 | |
| cristy | c8aff84 | 2012-12-24 16:59:46 +0000 | [diff] [blame] | 241 | extern MagickExport MagickRealType |
| cristy | 1205954 | 2012-12-24 18:45:40 +0000 | [diff] [blame] | 242 | DecodePixelGamma(const MagickRealType) magick_hot_spot, |
| 243 | EncodePixelGamma(const MagickRealType) magick_hot_spot; |
| cristy | c8aff84 | 2012-12-24 16:59:46 +0000 | [diff] [blame] | 244 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 245 | extern MagickExport void |
| cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 246 | InitializePixelChannelMap(Image *), |
| cristy | 2b9582a | 2011-07-04 17:38:56 +0000 | [diff] [blame] | 247 | GetPixelInfo(const Image *,PixelInfo *), |
| cristy | cf1296e | 2012-08-26 23:40:49 +0000 | [diff] [blame] | 248 | SetPixelChannelMask(Image *,const ChannelType); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 249 | |
| 250 | #if defined(__cplusplus) || defined(c_plusplus) |
| 251 | } |
| 252 | #endif |
| 253 | |
| 254 | #endif |