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 h a n n e l s %
223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225 % GetCacheViewChannels() returns the image pixel channels associated with
226 % the specified view.
228 % The format of the GetCacheViewChannels method is:
230 % size_t GetCacheViewChannels(const CacheView *cache_view)
232 % A description of each parameter follows:
234 % o cache_view: the cache view.
237 MagickExport size_t GetCacheViewChannels(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(GetPixelCacheChannels(cache_view->image->cache));
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 % G e t C a c h e V i e w C o l o r s p a c e %
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258 % GetCacheViewColorspace() returns the image colorspace associated with the
261 % The format of the GetCacheViewColorspace method is:
263 % ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
265 % A description of each parameter follows:
267 % o cache_view: the cache view.
270 MagickExport ColorspaceType GetCacheViewColorspace(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(GetPixelCacheColorspace(cache_view->image->cache));
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
285 % G e t C a c h e V i e w E x c e p t i o n %
289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
291 % GetCacheViewException() returns the image exception associated with the
294 % The format of the GetCacheViewException method is:
296 % ExceptionInfo GetCacheViewException(const CacheView *cache_view)
298 % A description of each parameter follows:
300 % o cache_view: the cache view.
303 MagickExport ExceptionInfo *GetCacheViewException(const CacheView *cache_view)
305 assert(cache_view != (CacheView *) NULL);
306 assert(cache_view->signature == MagickSignature);
307 if (cache_view->debug != MagickFalse)
308 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
309 cache_view->image->filename);
310 return(&cache_view->image->exception);
314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318 + G e t C a c h e V i e w E x t e n t %
322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324 % GetCacheViewExtent() returns the extent of the pixels associated with the
325 % last call to QueueCacheViewAuthenticPixels() or
326 % GetCacheViewAuthenticPixels().
328 % The format of the GetCacheViewExtent() method is:
330 % MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
332 % A description of each parameter follows:
334 % o cache_view: the cache view.
337 MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
340 id = GetOpenMPThreadId();
342 assert(cache_view != (CacheView *) NULL);
343 assert(cache_view->signature == MagickSignature);
344 if (cache_view->debug != MagickFalse)
345 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
346 cache_view->image->filename);
347 assert(cache_view->image->cache != (Cache) NULL);
348 assert(id < (int) cache_view->number_threads);
349 return(GetPixelCacheNexusExtent(cache_view->image->cache,
350 cache_view->nexus_info[id]));
354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358 % G e t C a c h e V i e w S t o r a g e C l a s s %
362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 % GetCacheViewStorageClass() returns the image storage class associated with
365 % the specified view.
367 % The format of the GetCacheViewStorageClass method is:
369 % ClassType GetCacheViewStorageClass(const CacheView *cache_view)
371 % A description of each parameter follows:
373 % o cache_view: the cache view.
376 MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
378 assert(cache_view != (CacheView *) NULL);
379 assert(cache_view->signature == MagickSignature);
380 if (cache_view->debug != MagickFalse)
381 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
382 cache_view->image->filename);
383 return(GetPixelCacheStorageClass(cache_view->image->cache));
387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391 % 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 %
395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397 % GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
398 % cache as defined by the geometry parameters. A pointer to the pixels is
399 % returned if the pixels are transferred, otherwise a NULL is returned.
401 % The format of the GetCacheViewAuthenticPixels method is:
403 % PixelPacket *GetCacheViewAuthenticPixels(CacheView *cache_view,
404 % const ssize_t x,const ssize_t y,const size_t columns,
405 % const size_t rows,ExceptionInfo *exception)
407 % A description of each parameter follows:
409 % o cache_view: the cache view.
411 % o x,y,columns,rows: These values define the perimeter of a region of
415 MagickExport PixelPacket *GetCacheViewAuthenticPixels(CacheView *cache_view,
416 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
417 ExceptionInfo *exception)
420 id = GetOpenMPThreadId();
422 assert(cache_view != (CacheView *) NULL);
423 assert(cache_view->signature == MagickSignature);
424 assert(id < (int) cache_view->number_threads);
425 return(GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
426 cache_view->nexus_info[id],exception));
430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434 % 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 %
438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440 % GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
441 % location. The image background color is returned if an error occurs.
443 % The format of the GetOneCacheViewAuthenticPixel method is:
445 % MagickBooleaNType GetOneCacheViewAuthenticPixel(
446 % const CacheView *cache_view,const ssize_t x,const ssize_t y,
447 % Pixelpacket *pixel,ExceptionInfo *exception)
449 % A description of each parameter follows:
451 % o cache_view: the cache view.
453 % o x,y: These values define the offset of the pixel.
455 % o pixel: return a pixel at the specified (x,y) location.
457 % o exception: return any errors or warnings in this structure.
460 MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
461 const CacheView *cache_view,const ssize_t x,const ssize_t y,
462 PixelPacket *pixel,ExceptionInfo *exception)
465 id = GetOpenMPThreadId();
470 assert(cache_view != (CacheView *) NULL);
471 assert(cache_view->signature == MagickSignature);
472 *pixel=cache_view->image->background_color;
473 assert(id < (int) cache_view->number_threads);
474 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
475 cache_view->nexus_info[id],exception);
476 if (pixels == (const PixelPacket *) NULL)
483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
487 % 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 %
491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
493 % GetCacheViewAuthenticIndexQueue() returns the indexes associated with the
494 % last call to SetCacheViewIndexes() or GetCacheViewAuthenticIndexQueue(). The
495 % indexes are authentic and can be updated.
497 % The format of the GetCacheViewAuthenticIndexQueue() method is:
499 % IndexPacket *GetCacheViewAuthenticIndexQueue(CacheView *cache_view)
501 % A description of each parameter follows:
503 % o cache_view: the cache view.
506 MagickExport IndexPacket *GetCacheViewAuthenticIndexQueue(CacheView *cache_view)
509 id = GetOpenMPThreadId();
511 assert(cache_view != (CacheView *) NULL);
512 assert(cache_view->signature == MagickSignature);
513 assert(cache_view->image->cache != (Cache) NULL);
514 assert(id < (int) cache_view->number_threads);
515 return(GetPixelCacheNexusIndexes(cache_view->image->cache,
516 cache_view->nexus_info[id]));
520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
524 % 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 %
528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
530 % GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
531 % last call to QueueCacheViewAuthenticPixels() or
532 % GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
535 % The format of the GetCacheViewAuthenticPixelQueue() method is:
537 % PixelPacket *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
539 % A description of each parameter follows:
541 % o cache_view: the cache view.
544 MagickExport PixelPacket *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
547 id = GetOpenMPThreadId();
549 assert(cache_view != (CacheView *) NULL);
550 assert(cache_view->signature == MagickSignature);
551 assert(cache_view->image->cache != (Cache) NULL);
552 assert(id < (int) cache_view->number_threads);
553 return(GetPixelCacheNexusPixels(cache_view->image->cache,
554 cache_view->nexus_info[id]));
558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 % 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 %
566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568 % GetCacheViewVirtualIndexQueue() returns the indexes associated with the
569 % last call to GetCacheViewVirtualIndexQueue(). The indexes are virtual and
570 % therefore cannot be updated.
572 % The format of the GetCacheViewVirtualIndexQueue() method is:
574 % const IndexPacket *GetCacheViewVirtualIndexQueue(
575 % const CacheView *cache_view)
577 % A description of each parameter follows:
579 % o cache_view: the cache view.
582 MagickExport const IndexPacket *GetCacheViewVirtualIndexQueue(
583 const CacheView *cache_view)
586 id = GetOpenMPThreadId();
588 assert(cache_view != (const CacheView *) NULL);
589 assert(cache_view->signature == MagickSignature);
590 assert(cache_view->image->cache != (Cache) NULL);
591 assert(id < (int) cache_view->number_threads);
592 return(GetVirtualIndexesFromNexus(cache_view->image->cache,
593 cache_view->nexus_info[id]));
597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
601 % 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 %
605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607 % GetCacheViewVirtualPixelQueue() returns the the pixels associated with
608 % the last call to GetCacheViewVirtualPixels(). The pixels are virtual
609 % and therefore cannot be updated.
611 % The format of the GetCacheViewVirtualPixelQueue() method is:
613 % const PixelPacket *GetCacheViewVirtualPixelQueue(
614 % const CacheView *cache_view)
616 % A description of each parameter follows:
618 % o cache_view: the cache view.
621 MagickExport const PixelPacket *GetCacheViewVirtualPixelQueue(
622 const CacheView *cache_view)
625 id = GetOpenMPThreadId();
627 assert(cache_view != (const CacheView *) NULL);
628 assert(cache_view->signature == MagickSignature);
629 assert(cache_view->image->cache != (Cache) NULL);
630 assert(id < (int) cache_view->number_threads);
631 return(GetVirtualPixelsNexus(cache_view->image->cache,
632 cache_view->nexus_info[id]));
636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
640 % 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 %
644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
646 % GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
647 % disk pixel cache as defined by the geometry parameters. A pointer to the
648 % pixels is returned if the pixels are transferred, otherwise a NULL is
651 % The format of the GetCacheViewVirtualPixels method is:
653 % const PixelPacket *GetCacheViewVirtualPixels(
654 % const CacheView *cache_view,const ssize_t x,const ssize_t y,
655 % const size_t columns,const size_t rows,ExceptionInfo *exception)
657 % A description of each parameter follows:
659 % o cache_view: the cache view.
661 % o x,y,columns,rows: These values define the perimeter of a region of
664 % o exception: return any errors or warnings in this structure.
667 MagickExport const PixelPacket *GetCacheViewVirtualPixels(
668 const CacheView *cache_view,const ssize_t x,const ssize_t y,
669 const size_t columns,const size_t rows,ExceptionInfo *exception)
672 id = GetOpenMPThreadId();
674 assert(cache_view != (CacheView *) NULL);
675 assert(cache_view->signature == MagickSignature);
676 assert(id < (int) cache_view->number_threads);
677 return(GetVirtualPixelsFromNexus(cache_view->image,
678 cache_view->virtual_pixel_method,x,y,columns,rows,
679 cache_view->nexus_info[id],exception));
683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
687 % 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 %
691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 % GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
694 % location. The image background color is returned if an error occurs. If
695 % you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
697 % The format of the GetOneCacheViewVirtualPixel method is:
699 % MagickBooleanType GetOneCacheViewVirtualPixel(
700 % const CacheView *cache_view,const ssize_t x,const ssize_t y,
701 % PixelPacket *pixel,ExceptionInfo *exception)
703 % A description of each parameter follows:
705 % o cache_view: the cache view.
707 % o x,y: These values define the offset of the pixel.
709 % o pixel: return a pixel at the specified (x,y) location.
711 % o exception: return any errors or warnings in this structure.
714 MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
715 const CacheView *cache_view,const ssize_t x,const ssize_t y,
716 PixelPacket *pixel,ExceptionInfo *exception)
719 id = GetOpenMPThreadId();
724 assert(cache_view != (CacheView *) NULL);
725 assert(cache_view->signature == MagickSignature);
726 *pixel=cache_view->image->background_color;
727 assert(id < (int) cache_view->number_threads);
728 pixels=GetVirtualPixelsFromNexus(cache_view->image,
729 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
731 if (pixels == (const PixelPacket *) NULL)
738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
742 % 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 %
746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
748 % GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
749 % the specified (x,y) location. The image background color is returned if an
750 % error occurs. If you plan to modify the pixel, use
751 % GetOneCacheViewAuthenticPixel() instead.
753 % The format of the GetOneCacheViewVirtualPixel method is:
755 % MagickBooleanType GetOneCacheViewVirtualMethodPixel(
756 % const CacheView *cache_view,
757 % const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
758 % const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
760 % A description of each parameter follows:
762 % o cache_view: the cache view.
764 % o virtual_pixel_method: the virtual pixel method.
766 % o x,y: These values define the offset of the pixel.
768 % o pixel: return a pixel at the specified (x,y) location.
770 % o exception: return any errors or warnings in this structure.
773 MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
774 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
775 const ssize_t x,const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
778 id = GetOpenMPThreadId();
783 assert(cache_view != (CacheView *) NULL);
784 assert(cache_view->signature == MagickSignature);
785 *pixel=cache_view->image->background_color;
786 assert(id < (int) cache_view->number_threads);
787 pixels=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,
788 1,cache_view->nexus_info[id],exception);
789 if (pixels == (const PixelPacket *) NULL)
796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
800 % 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 %
804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
806 % QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
807 % disk pixel cache as defined by the geometry parameters. A pointer to the
808 % pixels is returned if the pixels are transferred, otherwise a NULL is
811 % The format of the QueueCacheViewAuthenticPixels method is:
813 % PixelPacket *QueueCacheViewAuthenticPixels(CacheView *cache_view,
814 % const ssize_t x,const ssize_t y,const size_t columns,
815 % const size_t rows,ExceptionInfo *exception)
817 % A description of each parameter follows:
819 % o cache_view: the cache view.
821 % o x,y,columns,rows: These values define the perimeter of a region of
824 % o exception: return any errors or warnings in this structure.
827 MagickExport PixelPacket *QueueCacheViewAuthenticPixels(CacheView *cache_view,
828 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
829 ExceptionInfo *exception)
832 id = GetOpenMPThreadId();
834 assert(cache_view != (CacheView *) NULL);
835 assert(cache_view->signature == MagickSignature);
836 assert(id < (int) cache_view->number_threads);
837 return(QueueAuthenticNexus(cache_view->image,x,y,columns,rows,
838 cache_view->nexus_info[id],exception));
842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846 % S e t C a c h e V i e w S t o r a g e C l a s s %
850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
852 % SetCacheViewStorageClass() sets the image storage class associated with
853 % the specified view.
855 % The format of the SetCacheViewStorageClass method is:
857 % MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
858 % const ClassType storage_class)
860 % A description of each parameter follows:
862 % o cache_view: the cache view.
864 % o storage_class: the image storage class: PseudoClass or DirectClass.
867 MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
868 const ClassType storage_class)
870 assert(cache_view != (CacheView *) NULL);
871 assert(cache_view->signature == MagickSignature);
872 if (cache_view->debug != MagickFalse)
873 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
874 cache_view->image->filename);
875 return(SetImageStorageClass(cache_view->image,storage_class));
879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
883 % 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 %
887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
889 % SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
890 % with the specified cache view.
892 % The format of the SetCacheViewVirtualPixelMethod method is:
894 % MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
895 % const VirtualPixelMethod virtual_pixel_method)
897 % A description of each parameter follows:
899 % o cache_view: the cache view.
901 % o virtual_pixel_method: the virtual pixel method.
904 MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
905 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
907 assert(cache_view != (CacheView *) NULL);
908 assert(cache_view->signature == MagickSignature);
909 if (cache_view->debug != MagickFalse)
910 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
911 cache_view->image->filename);
912 cache_view->virtual_pixel_method=virtual_pixel_method;
917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
921 % 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 %
925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
927 % SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
928 % or disk cache. It returns MagickTrue if the pixel region is flushed,
929 % otherwise MagickFalse.
931 % The format of the SyncCacheViewAuthenticPixels method is:
933 % MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
934 % ExceptionInfo *exception)
936 % A description of each parameter follows:
938 % o cache_view: the cache view.
940 % o exception: return any errors or warnings in this structure.
943 MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
944 CacheView *cache_view,ExceptionInfo *exception)
947 id = GetOpenMPThreadId();
949 assert(cache_view != (CacheView *) NULL);
950 assert(cache_view->signature == MagickSignature);
951 assert(id < (int) cache_view->number_threads);
952 return(SyncAuthenticPixelCacheNexus(cache_view->image,
953 cache_view->nexus_info[id],exception));