2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % CCCC AAA CCCC H H EEEEE %
8 % C AAAAA C HHHHH EEE %
10 % CCCC A A CCCC H H EEEEE %
12 % V V IIIII EEEEE W W %
19 % MagickCore Cache View Methods %
26 % Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
27 % dedicated to making software imaging solutions freely available. %
29 % You may not use this file except in compliance with the License. You may %
30 % obtain a copy of the License at %
32 % http://www.imagemagick.org/script/license.php %
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. %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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"
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 % A c q u i r e C a c h e V i e w %
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 % AcquireCacheView() acquires a view into the pixel cache, using the
95 % VirtualPixelMethod that is defined within the given image itself.
97 % The format of the AcquireCacheView method is:
99 % CacheView *AcquireCacheView(const Image *image)
101 % A description of each parameter follows:
103 % o image: the image.
106 MagickExport CacheView *AcquireCacheView(const Image *image)
111 assert(image != (Image *) NULL);
112 assert(image->signature == MagickSignature);
113 if (image->debug != MagickFalse)
114 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
115 cache_view=(CacheView *) AcquireMagickMemory(sizeof(*cache_view));
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");
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135 % C l o n e C a c h e V i e w %
139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141 % CloneCacheView() makes an exact copy of the specified cache view.
143 % The format of the CloneCacheView method is:
145 % CacheView *CloneCacheView(const CacheView *cache_view)
147 % A description of each parameter follows:
149 % o cache_view: the cache view.
152 MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
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);
162 clone_view=(CacheView *) AcquireMagickMemory(sizeof(*clone_view));
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;
176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 % D e s t r o y C a c h e V i e w %
184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186 % DestroyCacheView() destroys the specified view returned by a previous call
187 % to AcquireCacheView().
189 % The format of the DestroyCacheView method is:
191 % CacheView *DestroyCacheView(CacheView *cache_view)
193 % A description of each parameter follows:
195 % o cache_view: the cache view.
198 MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
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);
210 cache_view=(CacheView *) RelinquishMagickMemory(cache_view);
215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
219 % G e t C a c h e V i e w C o l o r s p a c e %
223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225 % GetCacheViewColorspace() returns the image colorspace associated with the
228 % The format of the GetCacheViewColorspace method is:
230 % ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
232 % A description of each parameter follows:
234 % o cache_view: the cache view.
237 MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
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);
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 % G e t C a c h e V i e w E x c e p t i o n %
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258 % GetCacheViewException() returns the image exception associated with the
261 % The format of the GetCacheViewException method is:
263 % ExceptionInfo GetCacheViewException(const CacheView *cache_view)
265 % A description of each parameter follows:
267 % o cache_view: the cache view.
270 MagickExport ExceptionInfo *GetCacheViewException(const CacheView *cache_view)
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);
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
285 + G e t C a c h e V i e w E x t e n t %
289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
291 % GetCacheViewExtent() returns the extent of the pixels associated with the
292 % last call to QueueCacheViewAuthenticPixels() or
293 % GetCacheViewAuthenticPixels().
295 % The format of the GetCacheViewExtent() method is:
297 % MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
299 % A description of each parameter follows:
301 % o cache_view: the cache view.
304 MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
307 id = GetOpenMPThreadId();
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);
315 assert(id < (int) cache_view->number_threads);
316 return(GetPixelCacheNexusExtent(cache_view->image->cache,
317 cache_view->nexus_info[id]));
321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331 % GetCacheViewStorageClass() returns the image storage class associated with
332 % the specified view.
334 % The format of the GetCacheViewStorageClass method is:
336 % ClassType GetCacheViewStorageClass(const CacheView *cache_view)
338 % A description of each parameter follows:
340 % o cache_view: the cache view.
343 MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
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);
354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
368 % The format of the GetCacheViewAuthenticPixels method is:
370 % PixelPacket *GetCacheViewAuthenticPixels(CacheView *cache_view,
371 % const ssize_t x,const ssize_t y,const size_t columns,
372 % const size_t rows,ExceptionInfo *exception)
374 % A description of each parameter follows:
376 % o cache_view: the cache view.
378 % o x,y,columns,rows: These values define the perimeter of a region of
382 MagickExport PixelPacket *GetCacheViewAuthenticPixels(CacheView *cache_view,
383 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
384 ExceptionInfo *exception)
387 id = GetOpenMPThreadId();
389 assert(cache_view != (CacheView *) NULL);
390 assert(cache_view->signature == MagickSignature);
391 assert(id < (int) cache_view->number_threads);
392 return(GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
393 cache_view->nexus_info[id],exception));
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407 % GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
408 % location. The image background color is returned if an error occurs.
410 % The format of the GetOneCacheViewAuthenticPixel method is:
412 % MagickBooleaNType GetOneCacheViewAuthenticPixel(
413 % const CacheView *cache_view,const ssize_t x,const ssize_t y,
414 % Pixelpacket *pixel,ExceptionInfo *exception)
416 % A description of each parameter follows:
418 % o cache_view: the cache view.
420 % o x,y: These values define the offset of the pixel.
422 % o pixel: return a pixel at the specified (x,y) location.
424 % o exception: return any errors or warnings in this structure.
427 MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
428 const CacheView *cache_view,const ssize_t x,const ssize_t y,
429 PixelPacket *pixel,ExceptionInfo *exception)
432 id = GetOpenMPThreadId();
437 assert(cache_view != (CacheView *) NULL);
438 assert(cache_view->signature == MagickSignature);
439 *pixel=cache_view->image->background_color;
440 assert(id < (int) cache_view->number_threads);
441 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
442 cache_view->nexus_info[id],exception);
443 if (pixels == (const PixelPacket *) NULL)
450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460 % GetCacheViewAuthenticIndexQueue() returns the indexes associated with the
461 % last call to SetCacheViewIndexes() or GetCacheViewAuthenticIndexQueue(). The
462 % indexes are authentic and can be updated.
464 % The format of the GetCacheViewAuthenticIndexQueue() method is:
466 % IndexPacket *GetCacheViewAuthenticIndexQueue(CacheView *cache_view)
468 % A description of each parameter follows:
470 % o cache_view: the cache view.
473 MagickExport IndexPacket *GetCacheViewAuthenticIndexQueue(CacheView *cache_view)
476 id = GetOpenMPThreadId();
478 assert(cache_view != (CacheView *) NULL);
479 assert(cache_view->signature == MagickSignature);
480 assert(cache_view->image->cache != (Cache) NULL);
481 assert(id < (int) cache_view->number_threads);
482 return(GetPixelCacheNexusIndexes(cache_view->image->cache,
483 cache_view->nexus_info[id]));
487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
497 % GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
498 % last call to QueueCacheViewAuthenticPixels() or
499 % GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
502 % The format of the GetCacheViewAuthenticPixelQueue() method is:
504 % PixelPacket *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
506 % A description of each parameter follows:
508 % o cache_view: the cache view.
511 MagickExport PixelPacket *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
514 id = GetOpenMPThreadId();
516 assert(cache_view != (CacheView *) NULL);
517 assert(cache_view->signature == MagickSignature);
518 assert(cache_view->image->cache != (Cache) NULL);
519 assert(id < (int) cache_view->number_threads);
520 return(GetPixelCacheNexusPixels(cache_view->image->cache,
521 cache_view->nexus_info[id]));
525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
535 % GetCacheViewVirtualIndexQueue() returns the indexes associated with the
536 % last call to GetCacheViewVirtualIndexQueue(). The indexes are virtual and
537 % therefore cannot be updated.
539 % The format of the GetCacheViewVirtualIndexQueue() method is:
541 % const IndexPacket *GetCacheViewVirtualIndexQueue(
542 % const CacheView *cache_view)
544 % A description of each parameter follows:
546 % o cache_view: the cache view.
549 MagickExport const IndexPacket *GetCacheViewVirtualIndexQueue(
550 const CacheView *cache_view)
553 id = GetOpenMPThreadId();
555 assert(cache_view != (const CacheView *) NULL);
556 assert(cache_view->signature == MagickSignature);
557 assert(cache_view->image->cache != (Cache) NULL);
558 assert(id < (int) cache_view->number_threads);
559 return(GetVirtualIndexesFromNexus(cache_view->image->cache,
560 cache_view->nexus_info[id]));
564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574 % GetCacheViewVirtualPixelQueue() returns the the pixels associated with
575 % the last call to GetCacheViewVirtualPixels(). The pixels are virtual
576 % and therefore cannot be updated.
578 % The format of the GetCacheViewVirtualPixelQueue() method is:
580 % const PixelPacket *GetCacheViewVirtualPixelQueue(
581 % const CacheView *cache_view)
583 % A description of each parameter follows:
585 % o cache_view: the cache view.
588 MagickExport const PixelPacket *GetCacheViewVirtualPixelQueue(
589 const CacheView *cache_view)
592 id = GetOpenMPThreadId();
594 assert(cache_view != (const CacheView *) NULL);
595 assert(cache_view->signature == MagickSignature);
596 assert(cache_view->image->cache != (Cache) NULL);
597 assert(id < (int) cache_view->number_threads);
598 return(GetVirtualPixelsNexus(cache_view->image->cache,
599 cache_view->nexus_info[id]));
603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
618 % The format of the GetCacheViewVirtualPixels method is:
620 % const PixelPacket *GetCacheViewVirtualPixels(
621 % const CacheView *cache_view,const ssize_t x,const ssize_t y,
622 % const size_t columns,const size_t rows,ExceptionInfo *exception)
624 % A description of each parameter follows:
626 % o cache_view: the cache view.
628 % o x,y,columns,rows: These values define the perimeter of a region of
631 % o exception: return any errors or warnings in this structure.
634 MagickExport const PixelPacket *GetCacheViewVirtualPixels(
635 const CacheView *cache_view,const ssize_t x,const ssize_t y,
636 const size_t columns,const size_t rows,ExceptionInfo *exception)
639 id = GetOpenMPThreadId();
641 assert(cache_view != (CacheView *) NULL);
642 assert(cache_view->signature == MagickSignature);
643 assert(id < (int) cache_view->number_threads);
644 return(GetVirtualPixelsFromNexus(cache_view->image,
645 cache_view->virtual_pixel_method,x,y,columns,rows,
646 cache_view->nexus_info[id],exception));
650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
664 % The format of the GetOneCacheViewVirtualPixel method is:
666 % MagickBooleanType GetOneCacheViewVirtualPixel(
667 % const CacheView *cache_view,const ssize_t x,const ssize_t y,
668 % PixelPacket *pixel,ExceptionInfo *exception)
670 % A description of each parameter follows:
672 % o cache_view: the cache view.
674 % o x,y: These values define the offset of the pixel.
676 % o pixel: return a pixel at the specified (x,y) location.
678 % o exception: return any errors or warnings in this structure.
681 MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
682 const CacheView *cache_view,const ssize_t x,const ssize_t y,
683 PixelPacket *pixel,ExceptionInfo *exception)
686 id = GetOpenMPThreadId();
691 assert(cache_view != (CacheView *) NULL);
692 assert(cache_view->signature == MagickSignature);
693 *pixel=cache_view->image->background_color;
694 assert(id < (int) cache_view->number_threads);
695 pixels=GetVirtualPixelsFromNexus(cache_view->image,
696 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
698 if (pixels == (const PixelPacket *) NULL)
705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
720 % The format of the GetOneCacheViewVirtualPixel method is:
722 % MagickBooleanType GetOneCacheViewVirtualMethodPixel(
723 % const CacheView *cache_view,
724 % const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
725 % const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
727 % A description of each parameter follows:
729 % o cache_view: the cache view.
731 % o virtual_pixel_method: the virtual pixel method.
733 % o x,y: These values define the offset of the pixel.
735 % o pixel: return a pixel at the specified (x,y) location.
737 % o exception: return any errors or warnings in this structure.
740 MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
741 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
742 const ssize_t x,const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
745 id = GetOpenMPThreadId();
750 assert(cache_view != (CacheView *) NULL);
751 assert(cache_view->signature == MagickSignature);
752 *pixel=cache_view->image->background_color;
753 assert(id < (int) cache_view->number_threads);
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)
763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
778 % The format of the QueueCacheViewAuthenticPixels method is:
780 % PixelPacket *QueueCacheViewAuthenticPixels(CacheView *cache_view,
781 % const ssize_t x,const ssize_t y,const size_t columns,
782 % const size_t rows,ExceptionInfo *exception)
784 % A description of each parameter follows:
786 % o cache_view: the cache view.
788 % o x,y,columns,rows: These values define the perimeter of a region of
791 % o exception: return any errors or warnings in this structure.
794 MagickExport PixelPacket *QueueCacheViewAuthenticPixels(CacheView *cache_view,
795 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
796 ExceptionInfo *exception)
799 id = GetOpenMPThreadId();
801 assert(cache_view != (CacheView *) NULL);
802 assert(cache_view->signature == MagickSignature);
803 assert(id < (int) cache_view->number_threads);
804 return(QueueAuthenticNexus(cache_view->image,x,y,columns,rows,
805 cache_view->nexus_info[id],exception));
809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
819 % SetCacheViewStorageClass() sets the image storage class associated with
820 % the specified view.
822 % The format of the SetCacheViewStorageClass method is:
824 % MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
825 % const ClassType storage_class)
827 % A description of each parameter follows:
829 % o cache_view: the cache view.
831 % o storage_class: the image storage class: PseudoClass or DirectClass.
834 MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
835 const ClassType storage_class)
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));
846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
856 % SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
857 % with the specified cache view.
859 % The format of the SetCacheViewVirtualPixelMethod method is:
861 % MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
862 % const VirtualPixelMethod virtual_pixel_method)
864 % A description of each parameter follows:
866 % o cache_view: the cache view.
868 % o virtual_pixel_method: the virtual pixel method.
871 MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
872 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
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;
884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
898 % The format of the SyncCacheViewAuthenticPixels method is:
900 % MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
901 % ExceptionInfo *exception)
903 % A description of each parameter follows:
905 % o cache_view: the cache view.
907 % o exception: return any errors or warnings in this structure.
910 MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
911 CacheView *cache_view,ExceptionInfo *exception)
914 id = GetOpenMPThreadId();
916 assert(cache_view != (CacheView *) NULL);
917 assert(cache_view->signature == MagickSignature);
918 assert(id < (int) cache_view->number_threads);
919 return(SyncAuthenticPixelCacheNexus(cache_view->image,
920 cache_view->nexus_info[id],exception));