| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % CCCC AAA CCCC H H EEEEE % |
| 7 | % C A A C H H E % |
| 8 | % C AAAAA C HHHHH EEE % |
| 9 | % C A A C H H E % |
| 10 | % CCCC A A CCCC H H EEEEE % |
| 11 | % % |
| 12 | % V V IIIII EEEEE W W % |
| 13 | % V V I E W W % |
| 14 | % V V I EEE W W W % |
| 15 | % V V I E WW WW % |
| 16 | % V IIIII EEEEE W W % |
| 17 | % % |
| 18 | % % |
| 19 | % MagickCore Cache View Methods % |
| 20 | % % |
| 21 | % Software Design % |
| cristy | de984cd | 2013-12-01 14:49:27 +0000 | [diff] [blame] | 22 | % Cristy % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 23 | % February 2000 % |
| 24 | % % |
| 25 | % % |
| cristy | b56bb24 | 2014-11-25 17:12:48 +0000 | [diff] [blame] | 26 | % Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 27 | % dedicated to making software imaging solutions freely available. % |
| 28 | % % |
| 29 | % You may not use this file except in compliance with the License. You may % |
| 30 | % obtain a copy of the License at % |
| 31 | % % |
| 32 | % http://www.imagemagick.org/script/license.php % |
| 33 | % % |
| 34 | % Unless required by applicable law or agreed to in writing, software % |
| 35 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 36 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 37 | % See the License for the specific language governing permissions and % |
| 38 | % limitations under the License. % |
| 39 | % % |
| 40 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 41 | % |
| 42 | % |
| 43 | % |
| 44 | */ |
| 45 | |
| 46 | /* |
| 47 | Include declarations. |
| 48 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 49 | #include "MagickCore/studio.h" |
| 50 | #include "MagickCore/cache.h" |
| 51 | #include "MagickCore/cache-private.h" |
| 52 | #include "MagickCore/cache-view.h" |
| 53 | #include "MagickCore/memory_.h" |
| cristy | e42639a | 2012-08-23 01:53:24 +0000 | [diff] [blame] | 54 | #include "MagickCore/memory-private.h" |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 55 | #include "MagickCore/exception.h" |
| 56 | #include "MagickCore/exception-private.h" |
| 57 | #include "MagickCore/pixel-accessor.h" |
| cristy | ac245f8 | 2012-05-05 17:13:57 +0000 | [diff] [blame] | 58 | #include "MagickCore/resource_.h" |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 59 | #include "MagickCore/string_.h" |
| 60 | #include "MagickCore/thread-private.h" |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 61 | |
| 62 | /* |
| 63 | Typedef declarations. |
| 64 | */ |
| 65 | struct _CacheView |
| 66 | { |
| 67 | Image |
| 68 | *image; |
| 69 | |
| 70 | VirtualPixelMethod |
| 71 | virtual_pixel_method; |
| 72 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 73 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 74 | number_threads; |
| 75 | |
| 76 | NexusInfo |
| 77 | **nexus_info; |
| 78 | |
| 79 | MagickBooleanType |
| 80 | debug; |
| 81 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 82 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 83 | signature; |
| 84 | }; |
| 85 | |
| 86 | /* |
| 87 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 88 | % % |
| 89 | % % |
| 90 | % % |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 91 | % A c q u i r e A u t h e n t i c C a c h e V i e w % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 92 | % % |
| 93 | % % |
| 94 | % % |
| 95 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 96 | % |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 97 | % AcquireAuthenticCacheView() acquires an authentic view into the pixel cache. |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 98 | % It always succeeds but may return a warning or informational exception. |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 99 | % |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 100 | % The format of the AcquireAuthenticCacheView method is: |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 101 | % |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 102 | % CacheView *AcquireAuthenticCacheView(const Image *image, |
| 103 | % ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 104 | % |
| 105 | % A description of each parameter follows: |
| 106 | % |
| 107 | % o image: the image. |
| 108 | % |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 109 | % o exception: return any errors or warnings in this structure. |
| 110 | % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 111 | */ |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 112 | MagickExport CacheView *AcquireAuthenticCacheView(const Image *image, |
| 113 | ExceptionInfo *exception) |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 114 | { |
| 115 | CacheView |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 116 | *magick_restrict cache_view; |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 117 | |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 118 | cache_view=AcquireVirtualCacheView(image,exception); |
| cristy | b764910 | 2012-12-13 16:43:21 +0000 | [diff] [blame] | 119 | (void) SyncImagePixelCache(cache_view->image,exception); |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 120 | return(cache_view); |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 125 | % % |
| 126 | % % |
| 127 | % % |
| 128 | % A c q u i r e V i r t u a l C a c h e V i e w % |
| 129 | % % |
| 130 | % % |
| 131 | % % |
| 132 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 133 | % |
| 134 | % AcquireVirtualCacheView() acquires a virtual view into the pixel cache, |
| 135 | % using the VirtualPixelMethod that is defined within the given image itself. |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 136 | % It always succeeds but may return a warning or informational exception. |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 137 | % |
| 138 | % The format of the AcquireVirtualCacheView method is: |
| 139 | % |
| 140 | % CacheView *AcquireVirtualCacheView(const Image *image, |
| 141 | % ExceptionInfo *exception) |
| 142 | % |
| 143 | % A description of each parameter follows: |
| 144 | % |
| 145 | % o image: the image. |
| 146 | % |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 147 | % o exception: return any errors or warnings in this structure. |
| 148 | % |
| cristy | db07095 | 2012-04-20 14:33:00 +0000 | [diff] [blame] | 149 | */ |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 150 | MagickExport CacheView *AcquireVirtualCacheView(const Image *image, |
| 151 | ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 152 | { |
| 153 | CacheView |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 154 | *magick_restrict cache_view; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 155 | |
| 156 | assert(image != (Image *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 157 | assert(image->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 158 | if (image->debug != MagickFalse) |
| 159 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
| cristy | 46ff267 | 2012-12-14 15:32:26 +0000 | [diff] [blame] | 160 | (void) exception; |
| cristy | e42639a | 2012-08-23 01:53:24 +0000 | [diff] [blame] | 161 | cache_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1, |
| 162 | sizeof(*cache_view))); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 163 | if (cache_view == (CacheView *) NULL) |
| 164 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
| 165 | (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view)); |
| 166 | cache_view->image=ReferenceImage((Image *) image); |
| cristy | d99b5a5 | 2012-10-27 23:07:47 +0000 | [diff] [blame] | 167 | cache_view->number_threads=GetOpenMPMaximumThreads(); |
| 168 | if (GetMagickResourceLimit(ThreadResource) > cache_view->number_threads) |
| 169 | cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource); |
| 170 | if (cache_view->number_threads == 0) |
| 171 | cache_view->number_threads=1; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 172 | cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads); |
| 173 | cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image); |
| 174 | cache_view->debug=IsEventLogging(); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 175 | cache_view->signature=MagickCoreSignature; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 176 | if (cache_view->nexus_info == (NexusInfo **) NULL) |
| 177 | ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView"); |
| 178 | return(cache_view); |
| 179 | } |
| 180 | |
| 181 | /* |
| 182 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 183 | % % |
| 184 | % % |
| 185 | % % |
| 186 | % C l o n e C a c h e V i e w % |
| 187 | % % |
| 188 | % % |
| 189 | % % |
| 190 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 191 | % |
| 192 | % CloneCacheView() makes an exact copy of the specified cache view. |
| 193 | % |
| 194 | % The format of the CloneCacheView method is: |
| 195 | % |
| 196 | % CacheView *CloneCacheView(const CacheView *cache_view) |
| 197 | % |
| 198 | % A description of each parameter follows: |
| 199 | % |
| 200 | % o cache_view: the cache view. |
| 201 | % |
| 202 | */ |
| 203 | MagickExport CacheView *CloneCacheView(const CacheView *cache_view) |
| 204 | { |
| 205 | CacheView |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 206 | *magick_restrict clone_view; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 207 | |
| 208 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 209 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 210 | if (cache_view->debug != MagickFalse) |
| 211 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 212 | cache_view->image->filename); |
| cristy | e42639a | 2012-08-23 01:53:24 +0000 | [diff] [blame] | 213 | clone_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1, |
| 214 | sizeof(*clone_view))); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 215 | if (clone_view == (CacheView *) NULL) |
| 216 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
| 217 | (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); |
| 218 | clone_view->image=ReferenceImage(cache_view->image); |
| 219 | clone_view->number_threads=cache_view->number_threads; |
| 220 | clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads); |
| 221 | clone_view->virtual_pixel_method=cache_view->virtual_pixel_method; |
| 222 | clone_view->debug=cache_view->debug; |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 223 | clone_view->signature=MagickCoreSignature; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 224 | return(clone_view); |
| 225 | } |
| 226 | |
| 227 | /* |
| 228 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 229 | % % |
| 230 | % % |
| 231 | % % |
| 232 | % D e s t r o y C a c h e V i e w % |
| 233 | % % |
| 234 | % % |
| 235 | % % |
| 236 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 237 | % |
| 238 | % DestroyCacheView() destroys the specified view returned by a previous call |
| 239 | % to AcquireCacheView(). |
| 240 | % |
| 241 | % The format of the DestroyCacheView method is: |
| 242 | % |
| 243 | % CacheView *DestroyCacheView(CacheView *cache_view) |
| 244 | % |
| 245 | % A description of each parameter follows: |
| 246 | % |
| 247 | % o cache_view: the cache view. |
| 248 | % |
| 249 | */ |
| 250 | MagickExport CacheView *DestroyCacheView(CacheView *cache_view) |
| 251 | { |
| 252 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 253 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 254 | if (cache_view->debug != MagickFalse) |
| 255 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 256 | cache_view->image->filename); |
| 257 | if (cache_view->nexus_info != (NexusInfo **) NULL) |
| 258 | cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info, |
| 259 | cache_view->number_threads); |
| 260 | cache_view->image=DestroyImage(cache_view->image); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 261 | cache_view->signature=(~MagickCoreSignature); |
| cristy | 27d53d6 | 2012-07-29 23:30:07 +0000 | [diff] [blame] | 262 | cache_view=(CacheView *) RelinquishAlignedMemory(cache_view); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 263 | return(cache_view); |
| 264 | } |
| 265 | |
| 266 | /* |
| 267 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 268 | % % |
| 269 | % % |
| 270 | % % |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 271 | % G e t C a c h e V i e w A u t h e n t i c P i x e l s % |
| 272 | % % |
| 273 | % % |
| 274 | % % |
| 275 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 276 | % |
| 277 | % GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel |
| 278 | % cache as defined by the geometry parameters. A pointer to the pixels is |
| 279 | % returned if the pixels are transferred, otherwise a NULL is returned. |
| 280 | % |
| 281 | % The format of the GetCacheViewAuthenticPixels method is: |
| 282 | % |
| 283 | % Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view, |
| 284 | % const ssize_t x,const ssize_t y,const size_t columns, |
| 285 | % const size_t rows,ExceptionInfo *exception) |
| 286 | % |
| 287 | % A description of each parameter follows: |
| 288 | % |
| 289 | % o cache_view: the cache view. |
| 290 | % |
| 291 | % o x,y,columns,rows: These values define the perimeter of a region of |
| 292 | % pixels. |
| 293 | % |
| 294 | % o exception: return any errors or warnings in this structure. |
| 295 | % |
| 296 | */ |
| 297 | MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view, |
| 298 | const ssize_t x,const ssize_t y,const size_t columns,const size_t rows, |
| 299 | ExceptionInfo *exception) |
| 300 | { |
| 301 | const int |
| 302 | id = GetOpenMPThreadId(); |
| 303 | |
| 304 | Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 305 | *magick_restrict pixels; |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 306 | |
| 307 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 308 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 309 | assert(id < (int) cache_view->number_threads); |
| 310 | pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows, |
| 311 | cache_view->nexus_info[id],exception); |
| 312 | return(pixels); |
| 313 | } |
| 314 | |
| 315 | /* |
| 316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 317 | % % |
| 318 | % % |
| 319 | % % |
| 320 | % G e t C a c h e V i e w A u t h e n t i c M e t a c o n t e n t % |
| 321 | % % |
| 322 | % % |
| 323 | % % |
| 324 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 325 | % |
| 326 | % GetCacheViewAuthenticMetacontent() returns the meta-content corresponding |
| 327 | % with the last call to SetCacheViewIndexes() or |
| 328 | % GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can |
| 329 | % be updated. |
| 330 | % |
| 331 | % The format of the GetCacheViewAuthenticMetacontent() method is: |
| 332 | % |
| 333 | % void *GetCacheViewAuthenticMetacontent(CacheView *cache_view) |
| 334 | % |
| 335 | % A description of each parameter follows: |
| 336 | % |
| 337 | % o cache_view: the cache view. |
| 338 | % |
| 339 | */ |
| 340 | MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view) |
| 341 | { |
| 342 | const int |
| 343 | id = GetOpenMPThreadId(); |
| 344 | |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 345 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 346 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 347 | assert(cache_view->image->cache != (Cache) NULL); |
| 348 | assert(id < (int) cache_view->number_threads); |
| cristy | ffaf87e | 2013-04-30 17:09:30 +0000 | [diff] [blame] | 349 | return(cache_view->nexus_info[id]->metacontent); |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | /* |
| 353 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 354 | % % |
| 355 | % % |
| 356 | % % |
| 357 | % G e t C a c h e V i e w A u t h e n t i c P i x e l Q u e u e % |
| 358 | % % |
| 359 | % % |
| 360 | % % |
| 361 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 362 | % |
| 363 | % GetCacheViewAuthenticPixelQueue() returns the pixels associated with the |
| 364 | % last call to QueueCacheViewAuthenticPixels() or |
| 365 | % GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be |
| 366 | % updated. |
| 367 | % |
| 368 | % The format of the GetCacheViewAuthenticPixelQueue() method is: |
| 369 | % |
| 370 | % Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view) |
| 371 | % |
| 372 | % A description of each parameter follows: |
| 373 | % |
| 374 | % o cache_view: the cache view. |
| 375 | % |
| 376 | */ |
| 377 | MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view) |
| 378 | { |
| 379 | const int |
| 380 | id = GetOpenMPThreadId(); |
| 381 | |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 382 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 383 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 384 | assert(cache_view->image->cache != (Cache) NULL); |
| 385 | assert(id < (int) cache_view->number_threads); |
| cristy | ffaf87e | 2013-04-30 17:09:30 +0000 | [diff] [blame] | 386 | return(cache_view->nexus_info[id]->pixels); |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | /* |
| 390 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 391 | % % |
| 392 | % % |
| 393 | % % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 394 | % G e t C a c h e V i e w C o l o r s p a c e % |
| 395 | % % |
| 396 | % % |
| 397 | % % |
| 398 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 399 | % |
| 400 | % GetCacheViewColorspace() returns the image colorspace associated with the |
| 401 | % specified view. |
| 402 | % |
| 403 | % The format of the GetCacheViewColorspace method is: |
| 404 | % |
| 405 | % ColorspaceType GetCacheViewColorspace(const CacheView *cache_view) |
| 406 | % |
| 407 | % A description of each parameter follows: |
| 408 | % |
| 409 | % o cache_view: the cache view. |
| 410 | % |
| 411 | */ |
| 412 | MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view) |
| 413 | { |
| 414 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 415 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 416 | if (cache_view->debug != MagickFalse) |
| 417 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 418 | cache_view->image->filename); |
| cristy | 0d26717 | 2011-04-25 20:13:48 +0000 | [diff] [blame] | 419 | return(GetPixelCacheColorspace(cache_view->image->cache)); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | /* |
| 423 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 424 | % % |
| 425 | % % |
| 426 | % % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 427 | + G e t C a c h e V i e w E x t e n t % |
| 428 | % % |
| 429 | % % |
| 430 | % % |
| 431 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 432 | % |
| 433 | % GetCacheViewExtent() returns the extent of the pixels associated with the |
| 434 | % last call to QueueCacheViewAuthenticPixels() or |
| 435 | % GetCacheViewAuthenticPixels(). |
| 436 | % |
| 437 | % The format of the GetCacheViewExtent() method is: |
| 438 | % |
| 439 | % MagickSizeType GetCacheViewExtent(const CacheView *cache_view) |
| 440 | % |
| 441 | % A description of each parameter follows: |
| 442 | % |
| 443 | % o cache_view: the cache view. |
| 444 | % |
| 445 | */ |
| 446 | MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view) |
| 447 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 448 | const int |
| 449 | id = GetOpenMPThreadId(); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 450 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 451 | MagickSizeType |
| 452 | extent; |
| 453 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 454 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 455 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 456 | if (cache_view->debug != MagickFalse) |
| 457 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 458 | cache_view->image->filename); |
| 459 | assert(cache_view->image->cache != (Cache) NULL); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 460 | assert(id < (int) cache_view->number_threads); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 461 | extent=GetPixelCacheNexusExtent(cache_view->image->cache, |
| 462 | cache_view->nexus_info[id]); |
| 463 | return(extent); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | /* |
| 467 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 468 | % % |
| 469 | % % |
| 470 | % % |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 471 | % G e t C a c h e V i e w I m a g e % |
| 472 | % % |
| 473 | % % |
| 474 | % % |
| 475 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 476 | % |
| 477 | % GetCacheViewImage() returns the image associated with the specified view. |
| 478 | % |
| 479 | % The format of the GetCacheViewImage method is: |
| 480 | % |
| 481 | % const Image *GetCacheViewImage(const CacheView *cache_view) |
| 482 | % |
| 483 | % A description of each parameter follows: |
| 484 | % |
| 485 | % o cache_view: the cache view. |
| 486 | % |
| 487 | */ |
| 488 | MagickExport const Image *GetCacheViewImage(const CacheView *cache_view) |
| 489 | { |
| 490 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 491 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 492 | if (cache_view->debug != MagickFalse) |
| 493 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 494 | cache_view->image->filename); |
| 495 | return(cache_view->image); |
| 496 | } |
| 497 | |
| 498 | /* |
| 499 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 500 | % % |
| 501 | % % |
| 502 | % % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 503 | % G e t C a c h e V i e w S t o r a g e C l a s s % |
| 504 | % % |
| 505 | % % |
| 506 | % % |
| 507 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 508 | % |
| cristy | e751662 | 2012-04-29 14:22:45 +0000 | [diff] [blame] | 509 | % GetCacheViewStorageClass() returns the image storage class associated with |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 510 | % the specified view. |
| 511 | % |
| 512 | % The format of the GetCacheViewStorageClass method is: |
| 513 | % |
| 514 | % ClassType GetCacheViewStorageClass(const CacheView *cache_view) |
| 515 | % |
| 516 | % A description of each parameter follows: |
| 517 | % |
| 518 | % o cache_view: the cache view. |
| 519 | % |
| 520 | */ |
| 521 | MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view) |
| 522 | { |
| 523 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 524 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 525 | if (cache_view->debug != MagickFalse) |
| 526 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 527 | cache_view->image->filename); |
| cristy | 0d26717 | 2011-04-25 20:13:48 +0000 | [diff] [blame] | 528 | return(GetPixelCacheStorageClass(cache_view->image->cache)); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 529 | } |
| 530 | |
| 531 | /* |
| 532 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 533 | % % |
| 534 | % % |
| 535 | % % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 536 | % G e t C a c h e V i e w V i r t u a l M e t a c o n t e n t % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 537 | % % |
| 538 | % % |
| 539 | % % |
| 540 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 541 | % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 542 | % GetCacheViewVirtualMetacontent() returns the meta-content corresponding |
| 543 | % with the last call to GetCacheViewVirtualMetacontent(). The meta-content |
| 544 | % is virtual and therefore cannot be updated. |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 545 | % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 546 | % The format of the GetCacheViewVirtualMetacontent() method is: |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 547 | % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 548 | % const void *GetCacheViewVirtualMetacontent( |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 549 | % const CacheView *cache_view) |
| 550 | % |
| 551 | % A description of each parameter follows: |
| 552 | % |
| 553 | % o cache_view: the cache view. |
| 554 | % |
| 555 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 556 | MagickExport const void *GetCacheViewVirtualMetacontent( |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 557 | const CacheView *cache_view) |
| 558 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 559 | const int |
| 560 | id = GetOpenMPThreadId(); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 561 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 562 | const void |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 563 | *magick_restrict metacontent; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 564 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 565 | assert(cache_view != (const CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 566 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 567 | assert(cache_view->image->cache != (Cache) NULL); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 568 | assert(id < (int) cache_view->number_threads); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 569 | metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache, |
| 570 | cache_view->nexus_info[id]); |
| 571 | return(metacontent); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 572 | } |
| 573 | |
| 574 | /* |
| 575 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 576 | % % |
| 577 | % % |
| 578 | % % |
| 579 | % G e t C a c h e V i e w V i r t u a l P i x e l Q u e u e % |
| 580 | % % |
| 581 | % % |
| 582 | % % |
| 583 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 584 | % |
| 585 | % GetCacheViewVirtualPixelQueue() returns the the pixels associated with |
| 586 | % the last call to GetCacheViewVirtualPixels(). The pixels are virtual |
| 587 | % and therefore cannot be updated. |
| 588 | % |
| 589 | % The format of the GetCacheViewVirtualPixelQueue() method is: |
| 590 | % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 591 | % const Quantum *GetCacheViewVirtualPixelQueue( |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 592 | % const CacheView *cache_view) |
| 593 | % |
| 594 | % A description of each parameter follows: |
| 595 | % |
| 596 | % o cache_view: the cache view. |
| 597 | % |
| 598 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 599 | MagickExport const Quantum *GetCacheViewVirtualPixelQueue( |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 600 | const CacheView *cache_view) |
| 601 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 602 | const int |
| 603 | id = GetOpenMPThreadId(); |
| 604 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 605 | const Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 606 | *magick_restrict pixels; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 607 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 608 | assert(cache_view != (const CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 609 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 610 | assert(cache_view->image->cache != (Cache) NULL); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 611 | assert(id < (int) cache_view->number_threads); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 612 | pixels=GetVirtualPixelsNexus(cache_view->image->cache, |
| 613 | cache_view->nexus_info[id]); |
| 614 | return(pixels); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | /* |
| 618 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 619 | % % |
| 620 | % % |
| 621 | % % |
| 622 | % G e t C a c h e V i e w V i r t u a l P i x e l s % |
| 623 | % % |
| 624 | % % |
| 625 | % % |
| 626 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 627 | % |
| 628 | % GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or |
| 629 | % disk pixel cache as defined by the geometry parameters. A pointer to the |
| 630 | % pixels is returned if the pixels are transferred, otherwise a NULL is |
| 631 | % returned. |
| 632 | % |
| 633 | % The format of the GetCacheViewVirtualPixels method is: |
| 634 | % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 635 | % const Quantum *GetCacheViewVirtualPixels( |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 636 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| cristy | e076a6e | 2010-08-15 19:59:43 +0000 | [diff] [blame] | 637 | % const size_t columns,const size_t rows,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 638 | % |
| 639 | % A description of each parameter follows: |
| 640 | % |
| 641 | % o cache_view: the cache view. |
| 642 | % |
| 643 | % o x,y,columns,rows: These values define the perimeter of a region of |
| 644 | % pixels. |
| 645 | % |
| 646 | % o exception: return any errors or warnings in this structure. |
| 647 | % |
| 648 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 649 | MagickExport const Quantum *GetCacheViewVirtualPixels( |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 650 | const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| 651 | const size_t columns,const size_t rows,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 652 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 653 | const int |
| 654 | id = GetOpenMPThreadId(); |
| 655 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 656 | const Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 657 | *magick_restrict pixels; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 658 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 659 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 660 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 661 | assert(id < (int) cache_view->number_threads); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 662 | pixels=GetVirtualPixelsFromNexus(cache_view->image, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 663 | cache_view->virtual_pixel_method,x,y,columns,rows, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 664 | cache_view->nexus_info[id],exception); |
| 665 | return(pixels); |
| 666 | } |
| 667 | |
| 668 | /* |
| 669 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 670 | % % |
| 671 | % % |
| 672 | % % |
| 673 | % G e t O n e C a c h e V i e w A u t h e n t i c P i x e l % |
| 674 | % % |
| 675 | % % |
| 676 | % % |
| 677 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 678 | % |
| 679 | % GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y) |
| 680 | % location. The image background color is returned if an error occurs. |
| 681 | % |
| 682 | % The format of the GetOneCacheViewAuthenticPixel method is: |
| 683 | % |
| 684 | % MagickBooleaNType GetOneCacheViewAuthenticPixel( |
| 685 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 686 | % Quantum *pixel,ExceptionInfo *exception) |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 687 | % |
| 688 | % A description of each parameter follows: |
| 689 | % |
| 690 | % o cache_view: the cache view. |
| 691 | % |
| 692 | % o x,y: These values define the offset of the pixel. |
| 693 | % |
| 694 | % o pixel: return a pixel at the specified (x,y) location. |
| 695 | % |
| 696 | % o exception: return any errors or warnings in this structure. |
| 697 | % |
| 698 | */ |
| 699 | MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel( |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 700 | const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel, |
| 701 | ExceptionInfo *exception) |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 702 | { |
| 703 | const int |
| 704 | id = GetOpenMPThreadId(); |
| 705 | |
| 706 | Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 707 | *magick_restrict q; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 708 | |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 709 | register ssize_t |
| 710 | i; |
| 711 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 712 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 713 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 714 | assert(id < (int) cache_view->number_threads); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 715 | (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel)); |
| cristy | 584cbf8 | 2013-04-19 12:21:58 +0000 | [diff] [blame] | 716 | q=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1, |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 717 | cache_view->nexus_info[id],exception); |
| cristy | 584cbf8 | 2013-04-19 12:21:58 +0000 | [diff] [blame] | 718 | if (q == (const Quantum *) NULL) |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 719 | { |
| cristy | d09f880 | 2012-02-04 16:44:10 +0000 | [diff] [blame] | 720 | PixelInfo |
| 721 | background_color; |
| 722 | |
| 723 | background_color=cache_view->image->background_color; |
| 724 | pixel[RedPixelChannel]=ClampToQuantum(background_color.red); |
| 725 | pixel[GreenPixelChannel]=ClampToQuantum(background_color.green); |
| 726 | pixel[BluePixelChannel]=ClampToQuantum(background_color.blue); |
| 727 | pixel[BlackPixelChannel]=ClampToQuantum(background_color.black); |
| 728 | pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 729 | return(MagickFalse); |
| 730 | } |
| 731 | for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++) |
| 732 | { |
| cristy | 5a23c55 | 2013-02-13 14:34:28 +0000 | [diff] [blame] | 733 | PixelChannel channel=GetPixelChannelChannel(cache_view->image,i); |
| cristy | 584cbf8 | 2013-04-19 12:21:58 +0000 | [diff] [blame] | 734 | pixel[channel]=q[i]; |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 735 | } |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 736 | return(MagickTrue); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | /* |
| 740 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 741 | % % |
| 742 | % % |
| 743 | % % |
| 744 | % G e t O n e C a c h e V i e w V i r t u a l P i x e l % |
| 745 | % % |
| 746 | % % |
| 747 | % % |
| 748 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 749 | % |
| 750 | % GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y) |
| 751 | % location. The image background color is returned if an error occurs. If |
| 752 | % you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead. |
| 753 | % |
| 754 | % The format of the GetOneCacheViewVirtualPixel method is: |
| 755 | % |
| 756 | % MagickBooleanType GetOneCacheViewVirtualPixel( |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 757 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 758 | % Quantum *pixel,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 759 | % |
| 760 | % A description of each parameter follows: |
| 761 | % |
| 762 | % o cache_view: the cache view. |
| 763 | % |
| 764 | % o x,y: These values define the offset of the pixel. |
| 765 | % |
| 766 | % o pixel: return a pixel at the specified (x,y) location. |
| 767 | % |
| 768 | % o exception: return any errors or warnings in this structure. |
| 769 | % |
| 770 | */ |
| 771 | MagickExport MagickBooleanType GetOneCacheViewVirtualPixel( |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 772 | const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel, |
| 773 | ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 774 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 775 | const int |
| 776 | id = GetOpenMPThreadId(); |
| 777 | |
| cristy | f05d494 | 2012-03-17 16:26:09 +0000 | [diff] [blame] | 778 | register const Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 779 | *magick_restrict p; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 780 | |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 781 | register ssize_t |
| 782 | i; |
| 783 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 784 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 785 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 786 | assert(id < (int) cache_view->number_threads); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 787 | (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel)); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 788 | p=GetVirtualPixelsFromNexus(cache_view->image, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 789 | cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id], |
| 790 | exception); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 791 | if (p == (const Quantum *) NULL) |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 792 | { |
| cristy | d09f880 | 2012-02-04 16:44:10 +0000 | [diff] [blame] | 793 | PixelInfo |
| 794 | background_color; |
| 795 | |
| 796 | background_color=cache_view->image->background_color; |
| 797 | pixel[RedPixelChannel]=ClampToQuantum(background_color.red); |
| 798 | pixel[GreenPixelChannel]=ClampToQuantum(background_color.green); |
| 799 | pixel[BluePixelChannel]=ClampToQuantum(background_color.blue); |
| 800 | pixel[BlackPixelChannel]=ClampToQuantum(background_color.black); |
| 801 | pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 802 | return(MagickFalse); |
| 803 | } |
| 804 | for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++) |
| 805 | { |
| cristy | 5a23c55 | 2013-02-13 14:34:28 +0000 | [diff] [blame] | 806 | PixelChannel channel=GetPixelChannelChannel(cache_view->image,i); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 807 | pixel[channel]=p[i]; |
| 808 | } |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 809 | return(MagickTrue); |
| 810 | } |
| 811 | |
| 812 | /* |
| 813 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 814 | % % |
| 815 | % % |
| 816 | % % |
| cristy | f05d494 | 2012-03-17 16:26:09 +0000 | [diff] [blame] | 817 | % G e t O n e C a c h e V i e w V i r t u a l P i x e l I n f o % |
| 818 | % % |
| 819 | % % |
| 820 | % % |
| 821 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 822 | % |
| 823 | % GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified |
| 824 | % (x,y) location. The image background color is returned if an error occurs. |
| 825 | % If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead. |
| 826 | % |
| 827 | % The format of the GetOneCacheViewVirtualPixelInfo method is: |
| 828 | % |
| 829 | % MagickBooleanType GetOneCacheViewVirtualPixelInfo( |
| 830 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| 831 | % PixelInfo *pixel,ExceptionInfo *exception) |
| 832 | % |
| 833 | % A description of each parameter follows: |
| 834 | % |
| 835 | % o cache_view: the cache view. |
| 836 | % |
| 837 | % o x,y: These values define the offset of the pixel. |
| 838 | % |
| 839 | % o pixel: return a pixel at the specified (x,y) location. |
| 840 | % |
| 841 | % o exception: return any errors or warnings in this structure. |
| 842 | % |
| 843 | */ |
| 844 | MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo( |
| 845 | const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel, |
| 846 | ExceptionInfo *exception) |
| 847 | { |
| 848 | const int |
| 849 | id = GetOpenMPThreadId(); |
| 850 | |
| 851 | register const Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 852 | *magick_restrict p; |
| cristy | f05d494 | 2012-03-17 16:26:09 +0000 | [diff] [blame] | 853 | |
| 854 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 855 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | f05d494 | 2012-03-17 16:26:09 +0000 | [diff] [blame] | 856 | assert(id < (int) cache_view->number_threads); |
| cristy | f82cff8 | 2012-04-16 16:54:17 +0000 | [diff] [blame] | 857 | GetPixelInfo(cache_view->image,pixel); |
| cristy | f05d494 | 2012-03-17 16:26:09 +0000 | [diff] [blame] | 858 | p=GetVirtualPixelsFromNexus(cache_view->image, |
| 859 | cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id], |
| 860 | exception); |
| cristy | f05d494 | 2012-03-17 16:26:09 +0000 | [diff] [blame] | 861 | if (p == (const Quantum *) NULL) |
| 862 | return(MagickFalse); |
| 863 | GetPixelInfoPixel(cache_view->image,p,pixel); |
| 864 | return(MagickTrue); |
| 865 | } |
| 866 | |
| 867 | /* |
| 868 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 869 | % % |
| 870 | % % |
| 871 | % % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 872 | % G e t O n e C a c h e V i e w V i r t u a l P i x e l % |
| 873 | % % |
| 874 | % % |
| 875 | % % |
| 876 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 877 | % |
| 878 | % GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at |
| 879 | % the specified (x,y) location. The image background color is returned if an |
| 880 | % error occurs. If you plan to modify the pixel, use |
| 881 | % GetOneCacheViewAuthenticPixel() instead. |
| 882 | % |
| 883 | % The format of the GetOneCacheViewVirtualPixel method is: |
| 884 | % |
| 885 | % MagickBooleanType GetOneCacheViewVirtualMethodPixel( |
| 886 | % const CacheView *cache_view, |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 887 | % const VirtualPixelMethod virtual_pixel_method,const ssize_t x, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 888 | % const ssize_t y,Quantum *pixel,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 889 | % |
| 890 | % A description of each parameter follows: |
| 891 | % |
| 892 | % o cache_view: the cache view. |
| 893 | % |
| 894 | % o virtual_pixel_method: the virtual pixel method. |
| 895 | % |
| 896 | % o x,y: These values define the offset of the pixel. |
| 897 | % |
| 898 | % o pixel: return a pixel at the specified (x,y) location. |
| 899 | % |
| 900 | % o exception: return any errors or warnings in this structure. |
| 901 | % |
| 902 | */ |
| 903 | MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel( |
| 904 | const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 905 | const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 906 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 907 | const int |
| 908 | id = GetOpenMPThreadId(); |
| 909 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 910 | const Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 911 | *magick_restrict p; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 912 | |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 913 | register ssize_t |
| 914 | i; |
| 915 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 916 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 917 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 918 | assert(id < (int) cache_view->number_threads); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 919 | (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel)); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 920 | p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1, |
| 921 | cache_view->nexus_info[id],exception); |
| 922 | if (p == (const Quantum *) NULL) |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 923 | { |
| cristy | d09f880 | 2012-02-04 16:44:10 +0000 | [diff] [blame] | 924 | PixelInfo |
| 925 | background_color; |
| 926 | |
| 927 | background_color=cache_view->image->background_color; |
| 928 | pixel[RedPixelChannel]=ClampToQuantum(background_color.red); |
| 929 | pixel[GreenPixelChannel]=ClampToQuantum(background_color.green); |
| 930 | pixel[BluePixelChannel]=ClampToQuantum(background_color.blue); |
| 931 | pixel[BlackPixelChannel]=ClampToQuantum(background_color.black); |
| 932 | pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 933 | return(MagickFalse); |
| 934 | } |
| 935 | for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++) |
| 936 | { |
| cristy | 5a23c55 | 2013-02-13 14:34:28 +0000 | [diff] [blame] | 937 | PixelChannel channel=GetPixelChannelChannel(cache_view->image,i); |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 938 | pixel[channel]=p[i]; |
| 939 | } |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 940 | return(MagickTrue); |
| 941 | } |
| 942 | |
| 943 | /* |
| 944 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 945 | % % |
| 946 | % % |
| 947 | % % |
| 948 | % Q u e u e C a c h e V i e w A u t h e n t i c P i x e l s % |
| 949 | % % |
| 950 | % % |
| 951 | % % |
| 952 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 953 | % |
| 954 | % QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or |
| 955 | % disk pixel cache as defined by the geometry parameters. A pointer to the |
| 956 | % pixels is returned if the pixels are transferred, otherwise a NULL is |
| 957 | % returned. |
| 958 | % |
| 959 | % The format of the QueueCacheViewAuthenticPixels method is: |
| 960 | % |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 961 | % Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view, |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 962 | % const ssize_t x,const ssize_t y,const size_t columns, |
| 963 | % const size_t rows,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 964 | % |
| 965 | % A description of each parameter follows: |
| 966 | % |
| 967 | % o cache_view: the cache view. |
| 968 | % |
| 969 | % o x,y,columns,rows: These values define the perimeter of a region of |
| 970 | % pixels. |
| 971 | % |
| 972 | % o exception: return any errors or warnings in this structure. |
| 973 | % |
| 974 | */ |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 975 | MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view, |
| cristy | 3009723 | 2010-07-01 02:16:30 +0000 | [diff] [blame] | 976 | const ssize_t x,const ssize_t y,const size_t columns,const size_t rows, |
| 977 | ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 978 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 979 | const int |
| 980 | id = GetOpenMPThreadId(); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 981 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 982 | Quantum |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 983 | *magick_restrict pixels; |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 984 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 985 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 986 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 987 | assert(id < (int) cache_view->number_threads); |
| cristy | c11dace | 2012-01-24 16:39:46 +0000 | [diff] [blame] | 988 | pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows, |
| 989 | MagickFalse,cache_view->nexus_info[id],exception); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 990 | return(pixels); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 991 | } |
| 992 | |
| 993 | /* |
| 994 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 995 | % % |
| 996 | % % |
| 997 | % % |
| 998 | % S e t C a c h e V i e w S t o r a g e C l a s s % |
| 999 | % % |
| 1000 | % % |
| 1001 | % % |
| 1002 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1003 | % |
| 1004 | % SetCacheViewStorageClass() sets the image storage class associated with |
| 1005 | % the specified view. |
| 1006 | % |
| 1007 | % The format of the SetCacheViewStorageClass method is: |
| 1008 | % |
| 1009 | % MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view, |
| cristy | c82a27b | 2011-10-21 01:07:16 +0000 | [diff] [blame] | 1010 | % const ClassType storage_class,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1011 | % |
| 1012 | % A description of each parameter follows: |
| 1013 | % |
| 1014 | % o cache_view: the cache view. |
| 1015 | % |
| 1016 | % o storage_class: the image storage class: PseudoClass or DirectClass. |
| 1017 | % |
| cristy | c82a27b | 2011-10-21 01:07:16 +0000 | [diff] [blame] | 1018 | % o exception: return any errors or warnings in this structure. |
| 1019 | % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1020 | */ |
| 1021 | MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view, |
| cristy | c82a27b | 2011-10-21 01:07:16 +0000 | [diff] [blame] | 1022 | const ClassType storage_class,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1023 | { |
| 1024 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 1025 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1026 | if (cache_view->debug != MagickFalse) |
| 1027 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 1028 | cache_view->image->filename); |
| cristy | c82a27b | 2011-10-21 01:07:16 +0000 | [diff] [blame] | 1029 | return(SetImageStorageClass(cache_view->image,storage_class,exception)); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | /* |
| 1033 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1034 | % % |
| 1035 | % % |
| 1036 | % % |
| 1037 | % S e t C a c h e V i e w V i r t u a l P i x e l M e t h o d % |
| 1038 | % % |
| 1039 | % % |
| 1040 | % % |
| 1041 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1042 | % |
| 1043 | % SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated |
| 1044 | % with the specified cache view. |
| 1045 | % |
| 1046 | % The format of the SetCacheViewVirtualPixelMethod method is: |
| 1047 | % |
| 1048 | % MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view, |
| 1049 | % const VirtualPixelMethod virtual_pixel_method) |
| 1050 | % |
| 1051 | % A description of each parameter follows: |
| 1052 | % |
| 1053 | % o cache_view: the cache view. |
| 1054 | % |
| 1055 | % o virtual_pixel_method: the virtual pixel method. |
| 1056 | % |
| 1057 | */ |
| 1058 | MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod( |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 1059 | CacheView *magick_restrict cache_view, |
| 1060 | const VirtualPixelMethod virtual_pixel_method) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1061 | { |
| 1062 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 1063 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1064 | if (cache_view->debug != MagickFalse) |
| 1065 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 1066 | cache_view->image->filename); |
| 1067 | cache_view->virtual_pixel_method=virtual_pixel_method; |
| 1068 | return(MagickTrue); |
| 1069 | } |
| 1070 | |
| 1071 | /* |
| 1072 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1073 | % % |
| 1074 | % % |
| 1075 | % % |
| 1076 | % S y n c C a c h e V i e w A u t h e n t i c P i x e l s % |
| 1077 | % % |
| 1078 | % % |
| 1079 | % % |
| 1080 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1081 | % |
| 1082 | % SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory |
| 1083 | % or disk cache. It returns MagickTrue if the pixel region is flushed, |
| 1084 | % otherwise MagickFalse. |
| 1085 | % |
| 1086 | % The format of the SyncCacheViewAuthenticPixels method is: |
| 1087 | % |
| 1088 | % MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view, |
| 1089 | % ExceptionInfo *exception) |
| 1090 | % |
| 1091 | % A description of each parameter follows: |
| 1092 | % |
| 1093 | % o cache_view: the cache view. |
| 1094 | % |
| 1095 | % o exception: return any errors or warnings in this structure. |
| 1096 | % |
| 1097 | */ |
| 1098 | MagickExport MagickBooleanType SyncCacheViewAuthenticPixels( |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 1099 | CacheView *magick_restrict cache_view,ExceptionInfo *exception) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1100 | { |
| cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 1101 | const int |
| 1102 | id = GetOpenMPThreadId(); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 1103 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1104 | MagickBooleanType |
| 1105 | status; |
| 1106 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1107 | assert(cache_view != (CacheView *) NULL); |
| cristy | e1c94d9 | 2015-06-28 12:16:33 +0000 | [diff] [blame] | 1108 | assert(cache_view->signature == MagickCoreSignature); |
| cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 1109 | assert(id < (int) cache_view->number_threads); |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 1110 | status=SyncAuthenticPixelCacheNexus(cache_view->image, |
| 1111 | cache_view->nexus_info[id],exception); |
| 1112 | return(status); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1113 | } |