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 % |
| 22 | % John Cristy % |
| 23 | % February 2000 % |
| 24 | % % |
| 25 | % % |
cristy | 16af1cb | 2009-12-11 21:38:29 +0000 | [diff] [blame] | 26 | % Copyright 1999-2010 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 | */ |
| 49 | #include "magick/studio.h" |
| 50 | #include "magick/cache.h" |
| 51 | #include "magick/cache-private.h" |
| 52 | #include "magick/cache-view.h" |
| 53 | #include "magick/memory_.h" |
| 54 | #include "magick/exception.h" |
| 55 | #include "magick/exception-private.h" |
| 56 | #include "magick/string_.h" |
| 57 | #include "magick/thread-private.h" |
| 58 | |
| 59 | /* |
| 60 | Typedef declarations. |
| 61 | */ |
| 62 | struct _CacheView |
| 63 | { |
| 64 | Image |
| 65 | *image; |
| 66 | |
| 67 | VirtualPixelMethod |
| 68 | virtual_pixel_method; |
| 69 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 70 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 71 | number_threads; |
| 72 | |
| 73 | NexusInfo |
| 74 | **nexus_info; |
| 75 | |
| 76 | MagickBooleanType |
| 77 | debug; |
| 78 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 79 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 80 | signature; |
| 81 | }; |
| 82 | |
| 83 | /* |
| 84 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 85 | % % |
| 86 | % % |
| 87 | % % |
| 88 | % A c q u i r e C a c h e V i e w % |
| 89 | % % |
| 90 | % % |
| 91 | % % |
| 92 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 93 | % |
| 94 | % AcquireCacheView() acquires a view into the pixel cache, using the |
| 95 | % VirtualPixelMethod that is defined within the given image itself. |
| 96 | % |
| 97 | % The format of the AcquireCacheView method is: |
| 98 | % |
| 99 | % CacheView *AcquireCacheView(const Image *image) |
| 100 | % |
| 101 | % A description of each parameter follows: |
| 102 | % |
| 103 | % o image: the image. |
| 104 | % |
| 105 | */ |
| 106 | MagickExport CacheView *AcquireCacheView(const Image *image) |
| 107 | { |
| 108 | CacheView |
| 109 | *cache_view; |
| 110 | |
| 111 | assert(image != (Image *) NULL); |
| 112 | assert(image->signature == MagickSignature); |
| 113 | if (image->debug != MagickFalse) |
| 114 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); |
cristy | b41ee10 | 2010-10-04 16:46:15 +0000 | [diff] [blame] | 115 | cache_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*cache_view)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 116 | if (cache_view == (CacheView *) NULL) |
| 117 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
| 118 | (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view)); |
| 119 | cache_view->image=ReferenceImage((Image *) image); |
| 120 | cache_view->number_threads=GetOpenMPMaximumThreads(); |
| 121 | cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads); |
| 122 | cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image); |
| 123 | cache_view->debug=IsEventLogging(); |
| 124 | cache_view->signature=MagickSignature; |
| 125 | if (cache_view->nexus_info == (NexusInfo **) NULL) |
| 126 | ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView"); |
| 127 | return(cache_view); |
| 128 | } |
| 129 | |
| 130 | /* |
| 131 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 132 | % % |
| 133 | % % |
| 134 | % % |
| 135 | % C l o n e C a c h e V i e w % |
| 136 | % % |
| 137 | % % |
| 138 | % % |
| 139 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 140 | % |
| 141 | % CloneCacheView() makes an exact copy of the specified cache view. |
| 142 | % |
| 143 | % The format of the CloneCacheView method is: |
| 144 | % |
| 145 | % CacheView *CloneCacheView(const CacheView *cache_view) |
| 146 | % |
| 147 | % A description of each parameter follows: |
| 148 | % |
| 149 | % o cache_view: the cache view. |
| 150 | % |
| 151 | */ |
| 152 | MagickExport CacheView *CloneCacheView(const CacheView *cache_view) |
| 153 | { |
| 154 | CacheView |
| 155 | *clone_view; |
| 156 | |
| 157 | assert(cache_view != (CacheView *) NULL); |
| 158 | assert(cache_view->signature == MagickSignature); |
| 159 | if (cache_view->debug != MagickFalse) |
| 160 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 161 | cache_view->image->filename); |
cristy | b41ee10 | 2010-10-04 16:46:15 +0000 | [diff] [blame] | 162 | clone_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*clone_view)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 163 | if (clone_view == (CacheView *) NULL) |
| 164 | ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); |
| 165 | (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); |
| 166 | clone_view->image=ReferenceImage(cache_view->image); |
| 167 | clone_view->number_threads=cache_view->number_threads; |
| 168 | clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads); |
| 169 | clone_view->virtual_pixel_method=cache_view->virtual_pixel_method; |
| 170 | clone_view->debug=cache_view->debug; |
| 171 | clone_view->signature=MagickSignature; |
| 172 | return(clone_view); |
| 173 | } |
| 174 | |
| 175 | /* |
| 176 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 177 | % % |
| 178 | % % |
| 179 | % % |
| 180 | % D e s t r o y C a c h e V i e w % |
| 181 | % % |
| 182 | % % |
| 183 | % % |
| 184 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 185 | % |
| 186 | % DestroyCacheView() destroys the specified view returned by a previous call |
| 187 | % to AcquireCacheView(). |
| 188 | % |
| 189 | % The format of the DestroyCacheView method is: |
| 190 | % |
| 191 | % CacheView *DestroyCacheView(CacheView *cache_view) |
| 192 | % |
| 193 | % A description of each parameter follows: |
| 194 | % |
| 195 | % o cache_view: the cache view. |
| 196 | % |
| 197 | */ |
| 198 | MagickExport CacheView *DestroyCacheView(CacheView *cache_view) |
| 199 | { |
| 200 | assert(cache_view != (CacheView *) NULL); |
| 201 | assert(cache_view->signature == MagickSignature); |
| 202 | if (cache_view->debug != MagickFalse) |
| 203 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 204 | cache_view->image->filename); |
| 205 | if (cache_view->nexus_info != (NexusInfo **) NULL) |
| 206 | cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info, |
| 207 | cache_view->number_threads); |
| 208 | cache_view->image=DestroyImage(cache_view->image); |
| 209 | cache_view->signature=(~MagickSignature); |
cristy | b41ee10 | 2010-10-04 16:46:15 +0000 | [diff] [blame] | 210 | cache_view=(CacheView *) RelinquishMagickMemory(cache_view); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 211 | return(cache_view); |
| 212 | } |
| 213 | |
| 214 | /* |
| 215 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 216 | % % |
| 217 | % % |
| 218 | % % |
| 219 | % G e t C a c h e V i e w C o l o r s p a c e % |
| 220 | % % |
| 221 | % % |
| 222 | % % |
| 223 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 224 | % |
| 225 | % GetCacheViewColorspace() returns the image colorspace associated with the |
| 226 | % specified view. |
| 227 | % |
| 228 | % The format of the GetCacheViewColorspace method is: |
| 229 | % |
| 230 | % ColorspaceType GetCacheViewColorspace(const CacheView *cache_view) |
| 231 | % |
| 232 | % A description of each parameter follows: |
| 233 | % |
| 234 | % o cache_view: the cache view. |
| 235 | % |
| 236 | */ |
| 237 | MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view) |
| 238 | { |
| 239 | assert(cache_view != (CacheView *) NULL); |
| 240 | assert(cache_view->signature == MagickSignature); |
| 241 | if (cache_view->debug != MagickFalse) |
| 242 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 243 | cache_view->image->filename); |
| 244 | return(cache_view->image->colorspace); |
| 245 | } |
| 246 | |
| 247 | /* |
| 248 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 249 | % % |
| 250 | % % |
| 251 | % % |
| 252 | % G e t C a c h e V i e w E x c e p t i o n % |
| 253 | % % |
| 254 | % % |
| 255 | % % |
| 256 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 257 | % |
| 258 | % GetCacheViewException() returns the image exception associated with the |
| 259 | % specified view. |
| 260 | % |
| 261 | % The format of the GetCacheViewException method is: |
| 262 | % |
| 263 | % ExceptionInfo GetCacheViewException(const CacheView *cache_view) |
| 264 | % |
| 265 | % A description of each parameter follows: |
| 266 | % |
| 267 | % o cache_view: the cache view. |
| 268 | % |
| 269 | */ |
| 270 | MagickExport ExceptionInfo *GetCacheViewException(const CacheView *cache_view) |
| 271 | { |
| 272 | assert(cache_view != (CacheView *) NULL); |
| 273 | assert(cache_view->signature == MagickSignature); |
| 274 | if (cache_view->debug != MagickFalse) |
| 275 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 276 | cache_view->image->filename); |
| 277 | return(&cache_view->image->exception); |
| 278 | } |
| 279 | |
| 280 | /* |
| 281 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 282 | % % |
| 283 | % % |
| 284 | % % |
| 285 | + G e t C a c h e V i e w E x t e n t % |
| 286 | % % |
| 287 | % % |
| 288 | % % |
| 289 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 290 | % |
| 291 | % GetCacheViewExtent() returns the extent of the pixels associated with the |
| 292 | % last call to QueueCacheViewAuthenticPixels() or |
| 293 | % GetCacheViewAuthenticPixels(). |
| 294 | % |
| 295 | % The format of the GetCacheViewExtent() method is: |
| 296 | % |
| 297 | % MagickSizeType GetCacheViewExtent(const CacheView *cache_view) |
| 298 | % |
| 299 | % A description of each parameter follows: |
| 300 | % |
| 301 | % o cache_view: the cache view. |
| 302 | % |
| 303 | */ |
| 304 | MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view) |
| 305 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 306 | const int |
| 307 | id = GetOpenMPThreadId(); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 308 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 309 | assert(cache_view != (CacheView *) NULL); |
| 310 | assert(cache_view->signature == MagickSignature); |
| 311 | if (cache_view->debug != MagickFalse) |
| 312 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 313 | cache_view->image->filename); |
| 314 | assert(cache_view->image->cache != (Cache) NULL); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 315 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 316 | return(GetPixelCacheNexusExtent(cache_view->image->cache, |
| 317 | cache_view->nexus_info[id])); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | /* |
| 321 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 322 | % % |
| 323 | % % |
| 324 | % % |
| 325 | % G e t C a c h e V i e w S t o r a g e C l a s s % |
| 326 | % % |
| 327 | % % |
| 328 | % % |
| 329 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 330 | % |
| 331 | % GetCacheViewStorageClass() returns the image storage class associated with |
| 332 | % the specified view. |
| 333 | % |
| 334 | % The format of the GetCacheViewStorageClass method is: |
| 335 | % |
| 336 | % ClassType GetCacheViewStorageClass(const CacheView *cache_view) |
| 337 | % |
| 338 | % A description of each parameter follows: |
| 339 | % |
| 340 | % o cache_view: the cache view. |
| 341 | % |
| 342 | */ |
| 343 | MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view) |
| 344 | { |
| 345 | assert(cache_view != (CacheView *) NULL); |
| 346 | assert(cache_view->signature == MagickSignature); |
| 347 | if (cache_view->debug != MagickFalse) |
| 348 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 349 | cache_view->image->filename); |
| 350 | return(cache_view->image->storage_class); |
| 351 | } |
| 352 | |
| 353 | /* |
| 354 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 355 | % % |
| 356 | % % |
| 357 | % % |
| 358 | % 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 % |
| 359 | % % |
| 360 | % % |
| 361 | % % |
| 362 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 363 | % |
| 364 | % GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel |
| 365 | % cache as defined by the geometry parameters. A pointer to the pixels is |
| 366 | % returned if the pixels are transferred, otherwise a NULL is returned. |
| 367 | % |
| 368 | % The format of the GetCacheViewAuthenticPixels method is: |
| 369 | % |
| 370 | % PixelPacket *GetCacheViewAuthenticPixels(CacheView *cache_view, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 371 | % const ssize_t x,const ssize_t y,const size_t columns, |
| 372 | % const size_t rows,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 373 | % |
| 374 | % A description of each parameter follows: |
| 375 | % |
| 376 | % o cache_view: the cache view. |
| 377 | % |
| 378 | % o x,y,columns,rows: These values define the perimeter of a region of |
| 379 | % pixels. |
| 380 | % |
| 381 | */ |
| 382 | MagickExport PixelPacket *GetCacheViewAuthenticPixels(CacheView *cache_view, |
cristy | 3009723 | 2010-07-01 02:16:30 +0000 | [diff] [blame] | 383 | const ssize_t x,const ssize_t y,const size_t columns,const size_t rows, |
| 384 | ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 385 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 386 | const int |
| 387 | id = GetOpenMPThreadId(); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 388 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 389 | assert(cache_view != (CacheView *) NULL); |
| 390 | assert(cache_view->signature == MagickSignature); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 391 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 392 | return(GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows, |
| 393 | cache_view->nexus_info[id],exception)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | /* |
| 397 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 398 | % % |
| 399 | % % |
| 400 | % % |
| 401 | % 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 % |
| 402 | % % |
| 403 | % % |
| 404 | % % |
| 405 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 406 | % |
| 407 | % GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y) |
| 408 | % location. The image background color is returned if an error occurs. |
| 409 | % |
| 410 | % The format of the GetOneCacheViewAuthenticPixel method is: |
| 411 | % |
| 412 | % MagickBooleaNType GetOneCacheViewAuthenticPixel( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 413 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 414 | % Pixelpacket *pixel,ExceptionInfo *exception) |
| 415 | % |
| 416 | % A description of each parameter follows: |
| 417 | % |
| 418 | % o cache_view: the cache view. |
| 419 | % |
| 420 | % o x,y: These values define the offset of the pixel. |
| 421 | % |
| 422 | % o pixel: return a pixel at the specified (x,y) location. |
| 423 | % |
| 424 | % o exception: return any errors or warnings in this structure. |
| 425 | % |
| 426 | */ |
| 427 | MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel( |
cristy | 3009723 | 2010-07-01 02:16:30 +0000 | [diff] [blame] | 428 | const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| 429 | PixelPacket *pixel,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 430 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 431 | const int |
| 432 | id = GetOpenMPThreadId(); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 433 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 434 | PixelPacket |
| 435 | *pixels; |
| 436 | |
| 437 | assert(cache_view != (CacheView *) NULL); |
| 438 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 439 | *pixel=cache_view->image->background_color; |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 440 | assert(id < (int) cache_view->number_threads); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 441 | pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1, |
| 442 | cache_view->nexus_info[id],exception); |
| 443 | if (pixels == (const PixelPacket *) NULL) |
| 444 | return(MagickFalse); |
| 445 | *pixel=(*pixels); |
| 446 | return(MagickTrue); |
| 447 | } |
| 448 | |
| 449 | /* |
| 450 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 451 | % % |
| 452 | % % |
| 453 | % % |
| 454 | % G e t C a c h e V i e w A u t h e n t i c I n d e x Q u e u e % |
| 455 | % % |
| 456 | % % |
| 457 | % % |
| 458 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 459 | % |
| 460 | % GetCacheViewAuthenticIndexQueue() returns the indexes associated with the |
| 461 | % last call to SetCacheViewIndexes() or GetCacheViewAuthenticIndexQueue(). The |
| 462 | % indexes are authentic and can be updated. |
| 463 | % |
| 464 | % The format of the GetCacheViewAuthenticIndexQueue() method is: |
| 465 | % |
| 466 | % IndexPacket *GetCacheViewAuthenticIndexQueue(CacheView *cache_view) |
| 467 | % |
| 468 | % A description of each parameter follows: |
| 469 | % |
| 470 | % o cache_view: the cache view. |
| 471 | % |
| 472 | */ |
| 473 | MagickExport IndexPacket *GetCacheViewAuthenticIndexQueue(CacheView *cache_view) |
| 474 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 475 | const int |
| 476 | id = GetOpenMPThreadId(); |
| 477 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 478 | assert(cache_view != (CacheView *) NULL); |
| 479 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 480 | assert(cache_view->image->cache != (Cache) NULL); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 481 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 482 | return(GetPixelCacheNexusIndexes(cache_view->image->cache, |
| 483 | cache_view->nexus_info[id])); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | /* |
| 487 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 488 | % % |
| 489 | % % |
| 490 | % % |
| 491 | % 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 % |
| 492 | % % |
| 493 | % % |
| 494 | % % |
| 495 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 496 | % |
| 497 | % GetCacheViewAuthenticPixelQueue() returns the pixels associated with the |
| 498 | % last call to QueueCacheViewAuthenticPixels() or |
| 499 | % GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be |
| 500 | % updated. |
| 501 | % |
| 502 | % The format of the GetCacheViewAuthenticPixelQueue() method is: |
| 503 | % |
| 504 | % PixelPacket *GetCacheViewAuthenticPixelQueue(CacheView *cache_view) |
| 505 | % |
| 506 | % A description of each parameter follows: |
| 507 | % |
| 508 | % o cache_view: the cache view. |
| 509 | % |
| 510 | */ |
| 511 | MagickExport PixelPacket *GetCacheViewAuthenticPixelQueue(CacheView *cache_view) |
| 512 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 513 | const int |
| 514 | id = GetOpenMPThreadId(); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 515 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 516 | assert(cache_view != (CacheView *) NULL); |
| 517 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 518 | assert(cache_view->image->cache != (Cache) NULL); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 519 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 520 | return(GetPixelCacheNexusPixels(cache_view->image->cache, |
| 521 | cache_view->nexus_info[id])); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | /* |
| 525 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 526 | % % |
| 527 | % % |
| 528 | % % |
| 529 | % G e t C a c h e V i e w V i r t u a l I n d e x Q u e u e % |
| 530 | % % |
| 531 | % % |
| 532 | % % |
| 533 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 534 | % |
| 535 | % GetCacheViewVirtualIndexQueue() returns the indexes associated with the |
| 536 | % last call to GetCacheViewVirtualIndexQueue(). The indexes are virtual and |
| 537 | % therefore cannot be updated. |
| 538 | % |
| 539 | % The format of the GetCacheViewVirtualIndexQueue() method is: |
| 540 | % |
| 541 | % const IndexPacket *GetCacheViewVirtualIndexQueue( |
| 542 | % const CacheView *cache_view) |
| 543 | % |
| 544 | % A description of each parameter follows: |
| 545 | % |
| 546 | % o cache_view: the cache view. |
| 547 | % |
| 548 | */ |
| 549 | MagickExport const IndexPacket *GetCacheViewVirtualIndexQueue( |
| 550 | const CacheView *cache_view) |
| 551 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 552 | const int |
| 553 | id = GetOpenMPThreadId(); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 554 | |
| 555 | assert(cache_view != (const CacheView *) NULL); |
| 556 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 557 | assert(cache_view->image->cache != (Cache) NULL); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 558 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 559 | return(GetVirtualIndexesFromNexus(cache_view->image->cache, |
| 560 | cache_view->nexus_info[id])); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | /* |
| 564 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 565 | % % |
| 566 | % % |
| 567 | % % |
| 568 | % 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 % |
| 569 | % % |
| 570 | % % |
| 571 | % % |
| 572 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 573 | % |
| 574 | % GetCacheViewVirtualPixelQueue() returns the the pixels associated with |
| 575 | % the last call to GetCacheViewVirtualPixels(). The pixels are virtual |
| 576 | % and therefore cannot be updated. |
| 577 | % |
| 578 | % The format of the GetCacheViewVirtualPixelQueue() method is: |
| 579 | % |
| 580 | % const PixelPacket *GetCacheViewVirtualPixelQueue( |
| 581 | % const CacheView *cache_view) |
| 582 | % |
| 583 | % A description of each parameter follows: |
| 584 | % |
| 585 | % o cache_view: the cache view. |
| 586 | % |
| 587 | */ |
| 588 | MagickExport const PixelPacket *GetCacheViewVirtualPixelQueue( |
| 589 | const CacheView *cache_view) |
| 590 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 591 | const int |
| 592 | id = GetOpenMPThreadId(); |
| 593 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 594 | assert(cache_view != (const CacheView *) NULL); |
| 595 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 596 | assert(cache_view->image->cache != (Cache) NULL); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 597 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 598 | return(GetVirtualPixelsNexus(cache_view->image->cache, |
| 599 | cache_view->nexus_info[id])); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | /* |
| 603 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 604 | % % |
| 605 | % % |
| 606 | % % |
| 607 | % 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 % |
| 608 | % % |
| 609 | % % |
| 610 | % % |
| 611 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 612 | % |
| 613 | % GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or |
| 614 | % disk pixel cache as defined by the geometry parameters. A pointer to the |
| 615 | % pixels is returned if the pixels are transferred, otherwise a NULL is |
| 616 | % returned. |
| 617 | % |
| 618 | % The format of the GetCacheViewVirtualPixels method is: |
| 619 | % |
| 620 | % const PixelPacket *GetCacheViewVirtualPixels( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 621 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
cristy | e076a6e | 2010-08-15 19:59:43 +0000 | [diff] [blame] | 622 | % const size_t columns,const size_t rows,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 623 | % |
| 624 | % A description of each parameter follows: |
| 625 | % |
| 626 | % o cache_view: the cache view. |
| 627 | % |
| 628 | % o x,y,columns,rows: These values define the perimeter of a region of |
| 629 | % pixels. |
| 630 | % |
| 631 | % o exception: return any errors or warnings in this structure. |
| 632 | % |
| 633 | */ |
| 634 | MagickExport const PixelPacket *GetCacheViewVirtualPixels( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 635 | const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| 636 | const size_t columns,const size_t rows,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 637 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 638 | const int |
| 639 | id = GetOpenMPThreadId(); |
| 640 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 641 | assert(cache_view != (CacheView *) NULL); |
| 642 | assert(cache_view->signature == MagickSignature); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 643 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 644 | return(GetVirtualPixelsFromNexus(cache_view->image, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 645 | cache_view->virtual_pixel_method,x,y,columns,rows, |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 646 | cache_view->nexus_info[id],exception)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | /* |
| 650 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 651 | % % |
| 652 | % % |
| 653 | % % |
| 654 | % 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 % |
| 655 | % % |
| 656 | % % |
| 657 | % % |
| 658 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 659 | % |
| 660 | % GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y) |
| 661 | % location. The image background color is returned if an error occurs. If |
| 662 | % you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead. |
| 663 | % |
| 664 | % The format of the GetOneCacheViewVirtualPixel method is: |
| 665 | % |
| 666 | % MagickBooleanType GetOneCacheViewVirtualPixel( |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 667 | % const CacheView *cache_view,const ssize_t x,const ssize_t y, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 668 | % PixelPacket *pixel,ExceptionInfo *exception) |
| 669 | % |
| 670 | % A description of each parameter follows: |
| 671 | % |
| 672 | % o cache_view: the cache view. |
| 673 | % |
| 674 | % o x,y: These values define the offset of the pixel. |
| 675 | % |
| 676 | % o pixel: return a pixel at the specified (x,y) location. |
| 677 | % |
| 678 | % o exception: return any errors or warnings in this structure. |
| 679 | % |
| 680 | */ |
| 681 | MagickExport MagickBooleanType GetOneCacheViewVirtualPixel( |
cristy | 3009723 | 2010-07-01 02:16:30 +0000 | [diff] [blame] | 682 | const CacheView *cache_view,const ssize_t x,const ssize_t y, |
| 683 | PixelPacket *pixel,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 684 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 685 | const int |
| 686 | id = GetOpenMPThreadId(); |
| 687 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 688 | const PixelPacket |
| 689 | *pixels; |
| 690 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 691 | assert(cache_view != (CacheView *) NULL); |
| 692 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 693 | *pixel=cache_view->image->background_color; |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 694 | assert(id < (int) cache_view->number_threads); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 695 | pixels=GetVirtualPixelsFromNexus(cache_view->image, |
| 696 | cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id], |
| 697 | exception); |
| 698 | if (pixels == (const PixelPacket *) NULL) |
| 699 | return(MagickFalse); |
| 700 | *pixel=(*pixels); |
| 701 | return(MagickTrue); |
| 702 | } |
| 703 | |
| 704 | /* |
| 705 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 706 | % % |
| 707 | % % |
| 708 | % % |
| 709 | % 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 % |
| 710 | % % |
| 711 | % % |
| 712 | % % |
| 713 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 714 | % |
| 715 | % GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at |
| 716 | % the specified (x,y) location. The image background color is returned if an |
| 717 | % error occurs. If you plan to modify the pixel, use |
| 718 | % GetOneCacheViewAuthenticPixel() instead. |
| 719 | % |
| 720 | % The format of the GetOneCacheViewVirtualPixel method is: |
| 721 | % |
| 722 | % MagickBooleanType GetOneCacheViewVirtualMethodPixel( |
| 723 | % const CacheView *cache_view, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 724 | % const VirtualPixelMethod virtual_pixel_method,const ssize_t x, |
| 725 | % const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 726 | % |
| 727 | % A description of each parameter follows: |
| 728 | % |
| 729 | % o cache_view: the cache view. |
| 730 | % |
| 731 | % o virtual_pixel_method: the virtual pixel method. |
| 732 | % |
| 733 | % o x,y: These values define the offset of the pixel. |
| 734 | % |
| 735 | % o pixel: return a pixel at the specified (x,y) location. |
| 736 | % |
| 737 | % o exception: return any errors or warnings in this structure. |
| 738 | % |
| 739 | */ |
| 740 | MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel( |
| 741 | const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 742 | const ssize_t x,const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 743 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 744 | const int |
| 745 | id = GetOpenMPThreadId(); |
| 746 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 747 | const PixelPacket |
| 748 | *pixels; |
| 749 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 750 | assert(cache_view != (CacheView *) NULL); |
| 751 | assert(cache_view->signature == MagickSignature); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 752 | *pixel=cache_view->image->background_color; |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 753 | assert(id < (int) cache_view->number_threads); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 754 | pixels=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1, |
| 755 | 1,cache_view->nexus_info[id],exception); |
| 756 | if (pixels == (const PixelPacket *) NULL) |
| 757 | return(MagickFalse); |
| 758 | *pixel=(*pixels); |
| 759 | return(MagickTrue); |
| 760 | } |
| 761 | |
| 762 | /* |
| 763 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 764 | % % |
| 765 | % % |
| 766 | % % |
| 767 | % 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 % |
| 768 | % % |
| 769 | % % |
| 770 | % % |
| 771 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 772 | % |
| 773 | % QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or |
| 774 | % disk pixel cache as defined by the geometry parameters. A pointer to the |
| 775 | % pixels is returned if the pixels are transferred, otherwise a NULL is |
| 776 | % returned. |
| 777 | % |
| 778 | % The format of the QueueCacheViewAuthenticPixels method is: |
| 779 | % |
| 780 | % PixelPacket *QueueCacheViewAuthenticPixels(CacheView *cache_view, |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 781 | % const ssize_t x,const ssize_t y,const size_t columns, |
| 782 | % const size_t rows,ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 783 | % |
| 784 | % A description of each parameter follows: |
| 785 | % |
| 786 | % o cache_view: the cache view. |
| 787 | % |
| 788 | % o x,y,columns,rows: These values define the perimeter of a region of |
| 789 | % pixels. |
| 790 | % |
| 791 | % o exception: return any errors or warnings in this structure. |
| 792 | % |
| 793 | */ |
| 794 | MagickExport PixelPacket *QueueCacheViewAuthenticPixels(CacheView *cache_view, |
cristy | 3009723 | 2010-07-01 02:16:30 +0000 | [diff] [blame] | 795 | const ssize_t x,const ssize_t y,const size_t columns,const size_t rows, |
| 796 | ExceptionInfo *exception) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 797 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 798 | const int |
| 799 | id = GetOpenMPThreadId(); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 800 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 801 | assert(cache_view != (CacheView *) NULL); |
| 802 | assert(cache_view->signature == MagickSignature); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 803 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 804 | return(QueueAuthenticNexus(cache_view->image,x,y,columns,rows, |
| 805 | cache_view->nexus_info[id],exception)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | /* |
| 809 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 810 | % % |
| 811 | % % |
| 812 | % % |
| 813 | % S e t C a c h e V i e w S t o r a g e C l a s s % |
| 814 | % % |
| 815 | % % |
| 816 | % % |
| 817 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 818 | % |
| 819 | % SetCacheViewStorageClass() sets the image storage class associated with |
| 820 | % the specified view. |
| 821 | % |
| 822 | % The format of the SetCacheViewStorageClass method is: |
| 823 | % |
| 824 | % MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view, |
| 825 | % const ClassType storage_class) |
| 826 | % |
| 827 | % A description of each parameter follows: |
| 828 | % |
| 829 | % o cache_view: the cache view. |
| 830 | % |
| 831 | % o storage_class: the image storage class: PseudoClass or DirectClass. |
| 832 | % |
| 833 | */ |
| 834 | MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view, |
| 835 | const ClassType storage_class) |
| 836 | { |
| 837 | assert(cache_view != (CacheView *) NULL); |
| 838 | assert(cache_view->signature == MagickSignature); |
| 839 | if (cache_view->debug != MagickFalse) |
| 840 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 841 | cache_view->image->filename); |
| 842 | return(SetImageStorageClass(cache_view->image,storage_class)); |
| 843 | } |
| 844 | |
| 845 | /* |
| 846 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 847 | % % |
| 848 | % % |
| 849 | % % |
| 850 | % 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 % |
| 851 | % % |
| 852 | % % |
| 853 | % % |
| 854 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 855 | % |
| 856 | % SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated |
| 857 | % with the specified cache view. |
| 858 | % |
| 859 | % The format of the SetCacheViewVirtualPixelMethod method is: |
| 860 | % |
| 861 | % MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view, |
| 862 | % const VirtualPixelMethod virtual_pixel_method) |
| 863 | % |
| 864 | % A description of each parameter follows: |
| 865 | % |
| 866 | % o cache_view: the cache view. |
| 867 | % |
| 868 | % o virtual_pixel_method: the virtual pixel method. |
| 869 | % |
| 870 | */ |
| 871 | MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod( |
| 872 | CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method) |
| 873 | { |
| 874 | assert(cache_view != (CacheView *) NULL); |
| 875 | assert(cache_view->signature == MagickSignature); |
| 876 | if (cache_view->debug != MagickFalse) |
| 877 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", |
| 878 | cache_view->image->filename); |
| 879 | cache_view->virtual_pixel_method=virtual_pixel_method; |
| 880 | return(MagickTrue); |
| 881 | } |
| 882 | |
| 883 | /* |
| 884 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 885 | % % |
| 886 | % % |
| 887 | % % |
| 888 | % 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 % |
| 889 | % % |
| 890 | % % |
| 891 | % % |
| 892 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 893 | % |
| 894 | % SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory |
| 895 | % or disk cache. It returns MagickTrue if the pixel region is flushed, |
| 896 | % otherwise MagickFalse. |
| 897 | % |
| 898 | % The format of the SyncCacheViewAuthenticPixels method is: |
| 899 | % |
| 900 | % MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view, |
| 901 | % ExceptionInfo *exception) |
| 902 | % |
| 903 | % A description of each parameter follows: |
| 904 | % |
| 905 | % o cache_view: the cache view. |
| 906 | % |
| 907 | % o exception: return any errors or warnings in this structure. |
| 908 | % |
| 909 | */ |
| 910 | MagickExport MagickBooleanType SyncCacheViewAuthenticPixels( |
| 911 | CacheView *cache_view,ExceptionInfo *exception) |
| 912 | { |
cristy | 5c9e6f2 | 2010-09-17 17:31:01 +0000 | [diff] [blame] | 913 | const int |
| 914 | id = GetOpenMPThreadId(); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 915 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 916 | assert(cache_view != (CacheView *) NULL); |
| 917 | assert(cache_view->signature == MagickSignature); |
cristy | 4205a3c | 2010-09-12 20:19:59 +0000 | [diff] [blame] | 918 | assert(id < (int) cache_view->number_threads); |
cristy | f54fb57 | 2010-09-17 20:08:14 +0000 | [diff] [blame] | 919 | return(SyncAuthenticPixelCacheNexus(cache_view->image, |
| 920 | cache_view->nexus_info[id],exception)); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 921 | } |