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