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. |
| 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 | |
| 58 | typedef enum |
| 59 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 60 | UndefinedInterpolatePixel, |
| 61 | AverageInterpolatePixel, |
| 62 | BicubicInterpolatePixel, |
| 63 | BilinearInterpolatePixel, |
| 64 | FilterInterpolatePixel, |
| 65 | IntegerInterpolatePixel, |
| 66 | MeshInterpolatePixel, |
| 67 | NearestNeighborInterpolatePixel, |
| 68 | SplineInterpolatePixel |
cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 69 | } PixelInterpolateMethod; |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 70 | |
| 71 | typedef enum |
| 72 | { |
cristy | 6dcb9b8 | 2011-10-23 23:21:25 +0000 | [diff] [blame] | 73 | UndefinedPixelChannel = 0, |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 74 | 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, |
cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 84 | BlackPixelChannel = 3, |
| 85 | AlphaPixelChannel = 4, |
| 86 | IndexPixelChannel = 5, |
| 87 | MaskPixelChannel = 6, |
| 88 | MetaPixelChannel = 7, |
cristy | 2bddff8 | 2011-07-25 18:39:12 +0000 | [diff] [blame] | 89 | IntensityPixelChannel = MaxPixelChannels, |
cristy | 5f95f4f | 2011-10-23 01:01:01 +0000 | [diff] [blame] | 90 | CompositePixelChannel = MaxPixelChannels, |
cristy | 2bddff8 | 2011-07-25 18:39:12 +0000 | [diff] [blame] | 91 | SyncPixelChannel = MaxPixelChannels+1 |
cristy | c8d6367 | 2012-01-11 13:03:13 +0000 | [diff] [blame] | 92 | } PixelChannel; /* must correspond to ChannelType */ |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 93 | |
| 94 | typedef enum |
| 95 | { |
cristy | 94bc3bf | 2011-07-04 18:55:37 +0000 | [diff] [blame] | 96 | UndefinedPixelTrait = 0x000000, |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 97 | CopyPixelTrait = 0x000001, |
| 98 | UpdatePixelTrait = 0x000002, |
| 99 | BlendPixelTrait = 0x000004 |
cristy | 94bc3bf | 2011-07-04 18:55:37 +0000 | [diff] [blame] | 100 | } PixelTrait; |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 101 | |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 102 | typedef struct _PixelChannelMap |
| 103 | { |
| 104 | PixelChannel |
| 105 | channel; |
| 106 | |
| 107 | PixelTrait |
| 108 | traits; |
cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 109 | |
cristy | d26338f | 2011-12-14 02:39:30 +0000 | [diff] [blame] | 110 | ssize_t |
cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 111 | offset; |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 112 | } PixelChannelMap; |
| 113 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 114 | typedef 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 | |
cristy | 3094b7f | 2011-10-01 23:18:02 +0000 | [diff] [blame] | 131 | MagickSizeType |
| 132 | count; |
| 133 | |
| 134 | double |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 135 | red, |
| 136 | green, |
| 137 | blue, |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 138 | black, |
cristy | 3094b7f | 2011-10-01 23:18:02 +0000 | [diff] [blame] | 139 | alpha, |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 140 | index; |
| 141 | } PixelInfo; |
| 142 | |
cristy | 101ab70 | 2011-10-13 13:06:32 +0000 | [diff] [blame] | 143 | typedef struct _PixelPacket |
cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 144 | { |
| 145 | unsigned int |
| 146 | red, |
| 147 | green, |
| 148 | blue, |
| 149 | alpha, |
| 150 | black; |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 151 | } PixelPacket; |
| 152 | |
cristy | 3f858f4 | 2012-01-07 00:03:25 +0000 | [diff] [blame] | 153 | typedef enum |
| 154 | { |
| 155 | UndefinedPixel, |
| 156 | CharPixel, |
| 157 | DoublePixel, |
| 158 | FloatPixel, |
cristy | 3f858f4 | 2012-01-07 00:03:25 +0000 | [diff] [blame] | 159 | LongPixel, |
cristy | 6c9e168 | 2012-01-07 21:37:44 +0000 | [diff] [blame] | 160 | LongLongPixel, |
cristy | 3f858f4 | 2012-01-07 00:03:25 +0000 | [diff] [blame] | 161 | QuantumPixel, |
| 162 | ShortPixel |
| 163 | } StorageType; |
| 164 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 165 | typedef struct _CacheView |
| 166 | CacheView_; |
| 167 | |
cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 168 | extern MagickExport ChannelType |
| 169 | SetPixelChannelMask(Image *,const ChannelType); |
| 170 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 171 | extern 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, |
cristy | 018f07f | 2011-09-04 21:15:19 +0000 | [diff] [blame] | 175 | const size_t,const char *,const StorageType,const void *,ExceptionInfo *), |
cristy | a085a43 | 2011-07-30 01:39:32 +0000 | [diff] [blame] | 176 | InterpolatePixelChannel(const Image *,const CacheView_ *, |
cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 177 | const PixelChannel,const PixelInterpolateMethod,const double,const double, |
cristy | a085a43 | 2011-07-30 01:39:32 +0000 | [diff] [blame] | 178 | double *,ExceptionInfo *), |
cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 179 | InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *, |
| 180 | const PixelInterpolateMethod,const double,const double,Quantum *, |
| 181 | ExceptionInfo *), |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 182 | InterpolatePixelInfo(const Image *,const CacheView_ *, |
cristy | 5c4e258 | 2011-09-11 19:21:03 +0000 | [diff] [blame] | 183 | const PixelInterpolateMethod,const double,const double,PixelInfo *, |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 184 | ExceptionInfo *), |
cristy | e4a4047 | 2011-12-22 02:56:19 +0000 | [diff] [blame] | 185 | IsFuzzyEquivalencePixel(const Image *,const Quantum *,const Image *, |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 186 | const Quantum *), |
cristy | 101ab70 | 2011-10-13 13:06:32 +0000 | [diff] [blame] | 187 | IsFuzzyEquivalencePixelInfo(const PixelInfo *,const PixelInfo *); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 188 | |
cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 189 | extern MagickExport PixelChannelMap |
cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 190 | *AcquirePixelChannelMap(void), |
| 191 | *ClonePixelChannelMap(PixelChannelMap *), |
| 192 | *DestroyPixelChannelMap(PixelChannelMap *); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 193 | |
| 194 | extern MagickExport PixelInfo |
| 195 | *ClonePixelInfo(const PixelInfo *); |
| 196 | |
| 197 | extern MagickExport void |
cristy | bd5a96c | 2011-08-21 00:04:26 +0000 | [diff] [blame] | 198 | InitializePixelChannelMap(Image *), |
cristy | 2b9582a | 2011-07-04 17:38:56 +0000 | [diff] [blame] | 199 | GetPixelInfo(const Image *,PixelInfo *), |
cristy | e2a912b | 2011-12-05 20:02:07 +0000 | [diff] [blame] | 200 | SetPixelChannelMapMask(Image *,const ChannelType); |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 201 | |
| 202 | #if defined(__cplusplus) || defined(c_plusplus) |
| 203 | } |
| 204 | #endif |
| 205 | |
| 206 | #endif |