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