| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1 | /* |
| cristy | 1454be7 | 2011-12-19 01:52:48 +0000 | [diff] [blame] | 2 | Copyright 1999-2012 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 | |
| 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 | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 30 | typedef enum |
| 31 | { |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 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. |
| anthony | aa6b084 | 2012-03-22 00:25:25 +0000 | [diff] [blame] | 50 | 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" |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 53 | */ |
| 54 | TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */ |
| 55 | RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */ |
| 56 | GrayChannels = 0x0400, |
| anthony | aa6b084 | 2012-03-22 00:25:25 +0000 | [diff] [blame] | 57 | SyncChannels = 0x20000, /* channels modified as a single unit */ |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 58 | DefaultChannels = ((AllChannels | SyncChannels) &~ AlphaChannel) |
| 59 | } ChannelType; /* must correspond to PixelChannel */ |
| 60 | |
| 61 | typedef enum |
| 62 | { |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 63 | UndefinedInterpolatePixel, |
| anthony | cf4e33d | 2012-06-08 07:33:23 +0000 | [diff] [blame] | 64 | AverageInterpolatePixel, /* Average 4 nearest neighbours */ |
| 65 | Average9InterpolatePixel, /* Average 9 nearest neighbours */ |
| 66 | Average16InterpolatePixel, /* Average 16 nearest neighbours */ |
| 67 | BackgroundInterpolatePixel, /* Just return background color */ |
| 68 | BilinearInterpolatePixel, /* Triangular filter interpolation */ |
| 69 | BlendInterpolatePixel, /* blend of nearest 1, 2 or 4 pixels */ |
| 70 | CatromInterpolatePixel, /* Catmull-Rom interpolation */ |
| 71 | IntegerInterpolatePixel, /* Integer (floor) interpolation */ |
| 72 | MeshInterpolatePixel, /* Triangular Mesh interpolation */ |
| 73 | NearestInterpolatePixel, /* Nearest Neighbour Only */ |
| cristy | 436f31b | 2012-06-10 17:47:56 +0000 | [diff] [blame] | 74 | SplineInterpolatePixel /* Cubic Spline (blurred) interpolation */ |
| anthony | cf4e33d | 2012-06-08 07:33:23 +0000 | [diff] [blame] | 75 | /* FilterInterpolatePixel, ** Use resize filter - (very slow) */ |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 76 | } PixelInterpolateMethod; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 77 | |
| 78 | typedef enum |
| 79 | { |
| cristy | 6dcb9b8 | 2011-10-23 23:21:25 +0000 | [diff] [blame] | 80 | UndefinedPixelChannel = 0, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 81 | RedPixelChannel = 0, |
| 82 | CyanPixelChannel = 0, |
| 83 | GrayPixelChannel = 0, |
| cristy | b564954 | 2012-06-30 22:46:15 +0000 | [diff] [blame] | 84 | LPixelChannel = 0, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 85 | YPixelChannel = 0, |
| cristy | b564954 | 2012-06-30 22:46:15 +0000 | [diff] [blame] | 86 | aPixelChannel = 1, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 87 | GreenPixelChannel = 1, |
| 88 | MagentaPixelChannel = 1, |
| 89 | CbPixelChannel = 1, |
| cristy | b564954 | 2012-06-30 22:46:15 +0000 | [diff] [blame] | 90 | bPixelChannel = 2, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 91 | BluePixelChannel = 2, |
| 92 | YellowPixelChannel = 2, |
| 93 | CrPixelChannel = 2, |
| cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 94 | BlackPixelChannel = 3, |
| 95 | AlphaPixelChannel = 4, |
| 96 | IndexPixelChannel = 5, |
| anthony | aa6b084 | 2012-03-22 00:25:25 +0000 | [diff] [blame] | 97 | MaskPixelChannel = 6, /* Image Write Mask */ |
| 98 | MetaPixelChannel = 7, /* ??? */ |
| 99 | IntensityPixelChannel = MaxPixelChannels, /* what are these ??? */ |
| cristy | 5f95f4f | 2011-10-23 01:01:01 +0000 | [diff] [blame] | 100 | CompositePixelChannel = MaxPixelChannels, |
| cristy | 2bddff8 | 2011-07-25 18:39:12 +0000 | [diff] [blame] | 101 | SyncPixelChannel = MaxPixelChannels+1 |
| cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 102 | } PixelChannel; /* must correspond to ChannelType */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 103 | |
| 104 | typedef enum |
| 105 | { |
| cristy | 94bc3bf | 2011-07-04 18:55:37 +0000 | [diff] [blame] | 106 | UndefinedPixelTrait = 0x000000, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 107 | CopyPixelTrait = 0x000001, |
| 108 | UpdatePixelTrait = 0x000002, |
| 109 | BlendPixelTrait = 0x000004 |
| cristy | 94bc3bf | 2011-07-04 18:55:37 +0000 | [diff] [blame] | 110 | } PixelTrait; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 111 | |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 112 | typedef struct _PixelChannelMap |
| 113 | { |
| 114 | PixelChannel |
| 115 | channel; |
| 116 | |
| 117 | PixelTrait |
| 118 | traits; |
| cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 119 | |
| cristy | d26338f | 2011-12-14 02:39:30 +0000 | [diff] [blame] | 120 | ssize_t |
| cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 121 | offset; |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 122 | } PixelChannelMap; |
| 123 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 124 | typedef struct _PixelInfo |
| 125 | { |
| 126 | ClassType |
| 127 | storage_class; |
| 128 | |
| 129 | ColorspaceType |
| 130 | colorspace; |
| 131 | |
| 132 | MagickBooleanType |
| 133 | matte; |
| 134 | |
| 135 | double |
| 136 | fuzz; |
| 137 | |
| 138 | size_t |
| 139 | depth; |
| 140 | |
| cristy | 3094b7f | 2011-10-01 23:18:02 +0000 | [diff] [blame] | 141 | MagickSizeType |
| 142 | count; |
| 143 | |
| 144 | double |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 145 | red, |
| 146 | green, |
| 147 | blue, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 148 | black, |
| cristy | 3094b7f | 2011-10-01 23:18:02 +0000 | [diff] [blame] | 149 | alpha, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 150 | index; |
| 151 | } PixelInfo; |
| 152 | |
| cristy | 101ab70 | 2011-10-13 13:06:32 +0000 | [diff] [blame] | 153 | typedef struct _PixelPacket |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 154 | { |
| 155 | unsigned int |
| 156 | red, |
| 157 | green, |
| 158 | blue, |
| 159 | alpha, |
| 160 | black; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 161 | } PixelPacket; |
| 162 | |
| cristy | 3f858f4 | 2012-01-07 00:03:25 +0000 | [diff] [blame] | 163 | typedef enum |
| 164 | { |
| 165 | UndefinedPixel, |
| 166 | CharPixel, |
| 167 | DoublePixel, |
| 168 | FloatPixel, |
| cristy | 3f858f4 | 2012-01-07 00:03:25 +0000 | [diff] [blame] | 169 | LongPixel, |
| cristy | 6c9e168 | 2012-01-07 21:37:44 +0000 | [diff] [blame] | 170 | LongLongPixel, |
| cristy | 3f858f4 | 2012-01-07 00:03:25 +0000 | [diff] [blame] | 171 | QuantumPixel, |
| 172 | ShortPixel |
| 173 | } StorageType; |
| 174 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 175 | typedef struct _CacheView |
| 176 | CacheView_; |
| 177 | |
| 178 | extern MagickExport MagickBooleanType |
| cristy | 2dc655d | 2012-07-05 13:16:28 +0000 | [diff] [blame] | 179 | ExportImagePixels(Image *,const ssize_t,const ssize_t,const size_t, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 180 | const size_t,const char *,const StorageType,void *,ExceptionInfo *), |
| 181 | ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t, |
| cristy | 018f07f | 2011-09-04 21:15:19 +0000 | [diff] [blame] | 182 | const size_t,const char *,const StorageType,const void *,ExceptionInfo *), |
| cristy | a085a43 | 2011-07-30 01:39:32 +0000 | [diff] [blame] | 183 | InterpolatePixelChannel(const Image *,const CacheView_ *, |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 184 | const PixelChannel,const PixelInterpolateMethod,const double,const double, |
| cristy | a085a43 | 2011-07-30 01:39:32 +0000 | [diff] [blame] | 185 | double *,ExceptionInfo *), |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 186 | InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *, |
| 187 | const PixelInterpolateMethod,const double,const double,Quantum *, |
| 188 | ExceptionInfo *), |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 189 | InterpolatePixelInfo(const Image *,const CacheView_ *, |
| cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 190 | const PixelInterpolateMethod,const double,const double,PixelInfo *, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 191 | ExceptionInfo *), |
| cristy | e4a4047 | 2011-12-22 02:56:19 +0000 | [diff] [blame] | 192 | IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 193 | const Quantum *), |
| cristy | 322d07d | 2012-03-18 21:17:23 +0000 | [diff] [blame] | 194 | IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *), |
| 195 | SetPixelMetaChannels(Image *,const size_t,ExceptionInfo *); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 196 | |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 197 | extern MagickExport PixelChannelMap |
| cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 198 | *AcquirePixelChannelMap(void), |
| 199 | *ClonePixelChannelMap(PixelChannelMap *), |
| 200 | *DestroyPixelChannelMap(PixelChannelMap *); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 201 | |
| 202 | extern MagickExport PixelInfo |
| 203 | *ClonePixelInfo(const PixelInfo *); |
| 204 | |
| 205 | extern MagickExport void |
| cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 206 | InitializePixelChannelMap(Image *), |
| cristy | 2b9582a | 2011-07-04 17:38:56 +0000 | [diff] [blame] | 207 | GetPixelInfo(const Image *,PixelInfo *), |
| cristy | cf1296e | 2012-08-26 23:40:49 +0000 | [diff] [blame] | 208 | SetPixelChannelMask(Image *,const ChannelType); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 209 | |
| 210 | #if defined(__cplusplus) || defined(c_plusplus) |
| 211 | } |
| 212 | #endif |
| 213 | |
| 214 | #endif |