| cristy | 3ed852e | 2009-09-05 21:47:34 +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 | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | dedicated to making software imaging solutions freely available. |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 4 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5 | You may not use this file except in compliance with the License. |
| 6 | obtain a copy of the License at |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 7 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8 | http://www.imagemagick.org/script/license.php |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 9 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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 | |
| 16 | MagickCore cache private methods. |
| 17 | */ |
| 18 | #ifndef _MAGICKCORE_CACHE_PRIVATE_H |
| 19 | #define _MAGICKCORE_CACHE_PRIVATE_H |
| 20 | |
| 21 | #if defined(__cplusplus) || defined(c_plusplus) |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | #include <time.h> |
| cristy | 4ee2b0c | 2012-05-15 00:30:35 +0000 | [diff] [blame] | 26 | #include "MagickCore/cache.h" |
| cristy | e80f9cb | 2013-01-09 01:09:31 +0000 | [diff] [blame] | 27 | #include "MagickCore/distribute-cache.h" |
| cristy | 8a46d82 | 2012-08-28 23:32:39 +0000 | [diff] [blame] | 28 | #include "MagickCore/pixel.h" |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 29 | #include "MagickCore/random_.h" |
| 30 | #include "MagickCore/thread-private.h" |
| 31 | #include "MagickCore/semaphore.h" |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 32 | |
| cristy | cd01fae | 2011-08-06 23:52:42 +0000 | [diff] [blame] | 33 | typedef void |
| 34 | *Cache; |
| 35 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 36 | typedef MagickBooleanType |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 37 | (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 38 | Quantum *,ExceptionInfo *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 39 | (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 40 | const ssize_t,const ssize_t,Quantum *,ExceptionInfo *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 41 | (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *); |
| 42 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 43 | typedef const Quantum |
| cristy | 5ed838e | 2010-05-31 00:05:35 +0000 | [diff] [blame] | 44 | *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod, |
| 45 | const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 46 | *(*GetVirtualPixelsHandler)(const Image *); |
| 47 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 48 | typedef const void |
| 49 | *(*GetVirtualMetacontentFromHandler)(const Image *); |
| 50 | |
| 51 | typedef Quantum |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 52 | *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t, |
| 53 | const size_t,const size_t,ExceptionInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 54 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 55 | typedef Quantum |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 56 | *(*GetAuthenticPixelsFromHandler)(const Image *); |
| 57 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 58 | typedef Quantum |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 59 | *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t, |
| 60 | const size_t,const size_t,ExceptionInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 61 | |
| 62 | typedef void |
| 63 | (*DestroyPixelHandler)(Image *); |
| 64 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 65 | typedef void |
| 66 | *(*GetAuthenticMetacontentFromHandler)(const Image *); |
| 67 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 68 | typedef struct _CacheMethods |
| 69 | { |
| 70 | GetVirtualPixelHandler |
| 71 | get_virtual_pixel_handler; |
| 72 | |
| 73 | GetVirtualPixelsHandler |
| 74 | get_virtual_pixels_handler; |
| 75 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 76 | GetVirtualMetacontentFromHandler |
| 77 | get_virtual_metacontent_from_handler; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 78 | |
| 79 | GetOneVirtualPixelFromHandler |
| 80 | get_one_virtual_pixel_from_handler; |
| 81 | |
| 82 | GetAuthenticPixelsHandler |
| 83 | get_authentic_pixels_handler; |
| 84 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 85 | GetAuthenticMetacontentFromHandler |
| 86 | get_authentic_metacontent_from_handler; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 87 | |
| 88 | GetOneAuthenticPixelFromHandler |
| 89 | get_one_authentic_pixel_from_handler; |
| 90 | |
| 91 | GetAuthenticPixelsFromHandler |
| 92 | get_authentic_pixels_from_handler; |
| 93 | |
| 94 | QueueAuthenticPixelsHandler |
| 95 | queue_authentic_pixels_handler; |
| 96 | |
| 97 | SyncAuthenticPixelsHandler |
| 98 | sync_authentic_pixels_handler; |
| 99 | |
| 100 | DestroyPixelHandler |
| 101 | destroy_pixel_handler; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 102 | } CacheMethods; |
| 103 | |
| 104 | typedef struct _NexusInfo |
| cristy | bb31fcd | 2013-01-15 20:06:37 +0000 | [diff] [blame^] | 105 | NexusInfo; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 106 | |
| 107 | typedef struct _CacheInfo |
| 108 | { |
| 109 | ClassType |
| 110 | storage_class; |
| 111 | |
| 112 | ColorspaceType |
| 113 | colorspace; |
| 114 | |
| cristy | 8a46d82 | 2012-08-28 23:32:39 +0000 | [diff] [blame] | 115 | PixelTrait |
| 116 | alpha_trait; |
| 117 | |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 118 | MagickBooleanType |
| cristy | 183a5c7 | 2012-01-30 01:40:35 +0000 | [diff] [blame] | 119 | mask; |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 120 | |
| 121 | size_t |
| 122 | columns, |
| 123 | rows; |
| 124 | |
| cristy | bcc1fdc | 2011-04-29 13:06:35 +0000 | [diff] [blame] | 125 | size_t |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 126 | metacontent_extent, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 127 | number_channels; |
| cristy | 0d26717 | 2011-04-25 20:13:48 +0000 | [diff] [blame] | 128 | |
| cristy | 3dfccb2 | 2011-12-28 21:47:20 +0000 | [diff] [blame] | 129 | PixelChannelMap |
| 130 | channel_map[MaxPixelChannels]; |
| 131 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 132 | CacheType |
| 133 | type; |
| 134 | |
| cristy | 87528ea | 2009-09-10 14:53:56 +0000 | [diff] [blame] | 135 | MapMode |
| 136 | mode; |
| 137 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 138 | MagickBooleanType |
| 139 | mapped; |
| 140 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 141 | MagickOffsetType |
| 142 | offset; |
| 143 | |
| 144 | MagickSizeType |
| 145 | length; |
| 146 | |
| 147 | VirtualPixelMethod |
| 148 | virtual_pixel_method; |
| 149 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 150 | PixelInfo |
| cristy | c3ec0d4 | 2010-04-07 01:18:08 +0000 | [diff] [blame] | 151 | virtual_pixel_color; |
| 152 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 153 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 154 | number_threads; |
| 155 | |
| 156 | NexusInfo |
| 157 | **nexus_info; |
| 158 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 159 | Quantum |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 160 | *pixels; |
| 161 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 162 | void |
| 163 | *metacontent; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 164 | |
| 165 | int |
| 166 | file; |
| 167 | |
| 168 | char |
| 169 | filename[MaxTextExtent], |
| 170 | cache_filename[MaxTextExtent]; |
| 171 | |
| 172 | CacheMethods |
| 173 | methods; |
| 174 | |
| 175 | RandomInfo |
| 176 | *random_info; |
| 177 | |
| cristy | bb31fcd | 2013-01-15 20:06:37 +0000 | [diff] [blame^] | 178 | void |
| cristy | 1cbaf97 | 2013-01-09 02:13:23 +0000 | [diff] [blame] | 179 | *distribute_cache_info; |
| cristy | 286dea0 | 2013-01-08 21:34:16 +0000 | [diff] [blame] | 180 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 181 | MagickBooleanType |
| cristy | fa0ea94 | 2012-12-21 02:42:29 +0000 | [diff] [blame] | 182 | synchronize, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 183 | debug; |
| 184 | |
| 185 | MagickThreadType |
| 186 | id; |
| 187 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 188 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 189 | reference_count; |
| 190 | |
| 191 | SemaphoreInfo |
| 192 | *semaphore, |
| cristy | 245d4c5 | 2012-11-15 21:13:56 +0000 | [diff] [blame] | 193 | *file_semaphore; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 194 | |
| cristy | ff1889f | 2012-05-08 18:38:44 +0000 | [diff] [blame] | 195 | time_t |
| 196 | timestamp; |
| 197 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 198 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 199 | signature; |
| 200 | } CacheInfo; |
| 201 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 202 | extern MagickPrivate Cache |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 203 | AcquirePixelCache(const size_t), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 204 | ClonePixelCache(const Cache), |
| 205 | DestroyPixelCache(Cache), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 206 | ReferencePixelCache(Cache); |
| 207 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 208 | extern MagickPrivate ClassType |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 209 | GetPixelCacheStorageClass(const Cache); |
| 210 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 211 | extern MagickPrivate ColorspaceType |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 212 | GetPixelCacheColorspace(const Cache); |
| 213 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 214 | extern MagickPrivate const Quantum |
| cristy | 5ed838e | 2010-05-31 00:05:35 +0000 | [diff] [blame] | 215 | *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod, |
| 216 | const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *, |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 217 | ExceptionInfo *) magick_hot_spot, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 218 | *GetVirtualPixelsNexus(const Cache,NexusInfo *); |
| 219 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 220 | extern MagickPrivate const void |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 221 | *AcquirePixelCachePixels(const Image *,MagickSizeType *,ExceptionInfo *), |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 222 | *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 223 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 224 | extern MagickPrivate MagickBooleanType |
| cristy | 5ff4eaf | 2011-09-03 01:38:02 +0000 | [diff] [blame] | 225 | CacheComponentGenesis(void), |
| cristy | e41d079 | 2012-04-04 00:49:50 +0000 | [diff] [blame] | 226 | SyncAuthenticPixelCacheNexus(Image *,NexusInfo *,ExceptionInfo *) |
| 227 | magick_hot_spot, |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 228 | SyncImagePixelCache(Image *,ExceptionInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 229 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 230 | extern MagickPrivate MagickSizeType |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 231 | GetPixelCacheNexusExtent(const Cache,NexusInfo *); |
| 232 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 233 | extern MagickPrivate NexusInfo |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 234 | **AcquirePixelCacheNexus(const size_t), |
| 235 | **DestroyPixelCacheNexus(NexusInfo **,const size_t); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 236 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 237 | extern MagickPrivate Quantum |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 238 | *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t, |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 239 | const size_t,const size_t,NexusInfo *,ExceptionInfo *) magick_hot_spot, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 240 | *GetPixelCacheNexusPixels(const Cache,NexusInfo *), |
| cristy | c11dace | 2012-01-24 16:39:46 +0000 | [diff] [blame] | 241 | *QueueAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t, |
| 242 | const size_t,const size_t,const MagickBooleanType,NexusInfo *, |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 243 | ExceptionInfo *) magick_hot_spot; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 244 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 245 | extern MagickPrivate size_t |
| cristy | 0d26717 | 2011-04-25 20:13:48 +0000 | [diff] [blame] | 246 | GetPixelCacheChannels(const Cache); |
| 247 | |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 248 | extern MagickPrivate VirtualPixelMethod |
| 249 | GetPixelCacheVirtualMethod(const Image *), |
| cristy | 387430f | 2012-02-07 13:09:46 +0000 | [diff] [blame] | 250 | SetPixelCacheVirtualMethod(Image *,const VirtualPixelMethod,ExceptionInfo *); |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 251 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 252 | extern MagickPrivate void |
| cristy | 5ff4eaf | 2011-09-03 01:38:02 +0000 | [diff] [blame] | 253 | CacheComponentTerminus(void), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 254 | ClonePixelCacheMethods(Cache,const Cache), |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 255 | *GetPixelCacheNexusMetacontent(const Cache,NexusInfo *) magick_hot_spot, |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 256 | *GetPixelCachePixels(Image *,MagickSizeType *,ExceptionInfo *), |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 257 | GetPixelCacheTileSize(const Image *,size_t *,size_t *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 258 | GetPixelCacheMethods(CacheMethods *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 259 | SetPixelCacheMethods(Cache,CacheMethods *); |
| 260 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 261 | #if defined(__cplusplus) || defined(c_plusplus) |
| 262 | } |
| 263 | #endif |
| 264 | |
| 265 | #endif |