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