blob: c5eabf4c0dcb2a158fc7b785e3c423e892422e10 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
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% %
cristy45ef08f2012-12-07 13:13:34 +000026% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000027% 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*/
cristy4c08aed2011-07-01 19:47:50 +000049#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"
cristye42639a2012-08-23 01:53:24 +000054#include "MagickCore/memory-private.h"
cristy4c08aed2011-07-01 19:47:50 +000055#include "MagickCore/exception.h"
56#include "MagickCore/exception-private.h"
57#include "MagickCore/pixel-accessor.h"
cristyac245f82012-05-05 17:13:57 +000058#include "MagickCore/resource_.h"
cristy4c08aed2011-07-01 19:47:50 +000059#include "MagickCore/string_.h"
60#include "MagickCore/thread-private.h"
cristy3ed852e2009-09-05 21:47:34 +000061
62/*
63 Typedef declarations.
64*/
65struct _CacheView
66{
67 Image
68 *image;
69
70 VirtualPixelMethod
71 virtual_pixel_method;
72
cristybb503372010-05-27 20:51:26 +000073 size_t
cristy3ed852e2009-09-05 21:47:34 +000074 number_threads;
75
76 NexusInfo
77 **nexus_info;
78
79 MagickBooleanType
80 debug;
81
cristybb503372010-05-27 20:51:26 +000082 size_t
cristy3ed852e2009-09-05 21:47:34 +000083 signature;
84};
85
86/*
87%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88% %
89% %
90% %
cristydb070952012-04-20 14:33:00 +000091% A c q u i r e A u t h e n t i c C a c h e V i e w %
cristy3ed852e2009-09-05 21:47:34 +000092% %
93% %
94% %
95%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96%
cristydb070952012-04-20 14:33:00 +000097% AcquireAuthenticCacheView() acquires an authentic view into the pixel cache.
cristy46ff2672012-12-14 15:32:26 +000098% It always succeeds but may return a warning or informational exception.
cristy3ed852e2009-09-05 21:47:34 +000099%
cristydb070952012-04-20 14:33:00 +0000100% The format of the AcquireAuthenticCacheView method is:
cristy3ed852e2009-09-05 21:47:34 +0000101%
cristy46ff2672012-12-14 15:32:26 +0000102% CacheView *AcquireAuthenticCacheView(const Image *image,
103% ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000104%
105% A description of each parameter follows:
106%
107% o image: the image.
108%
cristydb070952012-04-20 14:33:00 +0000109% o exception: return any errors or warnings in this structure.
110%
cristy3ed852e2009-09-05 21:47:34 +0000111*/
cristy46ff2672012-12-14 15:32:26 +0000112MagickExport CacheView *AcquireAuthenticCacheView(const Image *image,
113 ExceptionInfo *exception)
cristydb070952012-04-20 14:33:00 +0000114{
115 CacheView
116 *cache_view;
117
cristy46ff2672012-12-14 15:32:26 +0000118 cache_view=AcquireVirtualCacheView(image,exception);
cristyb7649102012-12-13 16:43:21 +0000119 (void) SyncImagePixelCache(cache_view->image,exception);
cristydb070952012-04-20 14:33:00 +0000120 return(cache_view);
121}
122
123/*
124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125% %
126% %
127% %
128% A c q u i r e V i r t u a l C a c h e V i e w %
129% %
130% %
131% %
132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133%
134% AcquireVirtualCacheView() acquires a virtual view into the pixel cache,
135% using the VirtualPixelMethod that is defined within the given image itself.
cristy46ff2672012-12-14 15:32:26 +0000136% It always succeeds but may return a warning or informational exception.
cristydb070952012-04-20 14:33:00 +0000137%
138% The format of the AcquireVirtualCacheView method is:
139%
140% CacheView *AcquireVirtualCacheView(const Image *image,
141% ExceptionInfo *exception)
142%
143% A description of each parameter follows:
144%
145% o image: the image.
146%
cristy46ff2672012-12-14 15:32:26 +0000147% o exception: return any errors or warnings in this structure.
148%
cristydb070952012-04-20 14:33:00 +0000149*/
cristy46ff2672012-12-14 15:32:26 +0000150MagickExport CacheView *AcquireVirtualCacheView(const Image *image,
151 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000152{
153 CacheView
154 *cache_view;
155
156 assert(image != (Image *) NULL);
157 assert(image->signature == MagickSignature);
158 if (image->debug != MagickFalse)
159 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
cristy46ff2672012-12-14 15:32:26 +0000160 (void) exception;
cristye42639a2012-08-23 01:53:24 +0000161 cache_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
162 sizeof(*cache_view)));
cristy3ed852e2009-09-05 21:47:34 +0000163 if (cache_view == (CacheView *) NULL)
164 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
165 (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view));
166 cache_view->image=ReferenceImage((Image *) image);
cristyd99b5a52012-10-27 23:07:47 +0000167 cache_view->number_threads=GetOpenMPMaximumThreads();
168 if (GetMagickResourceLimit(ThreadResource) > cache_view->number_threads)
169 cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
170 if (cache_view->number_threads == 0)
171 cache_view->number_threads=1;
cristy3ed852e2009-09-05 21:47:34 +0000172 cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
173 cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
174 cache_view->debug=IsEventLogging();
175 cache_view->signature=MagickSignature;
176 if (cache_view->nexus_info == (NexusInfo **) NULL)
177 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
178 return(cache_view);
179}
180
181/*
182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183% %
184% %
185% %
186% C l o n e C a c h e V i e w %
187% %
188% %
189% %
190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
191%
192% CloneCacheView() makes an exact copy of the specified cache view.
193%
194% The format of the CloneCacheView method is:
195%
196% CacheView *CloneCacheView(const CacheView *cache_view)
197%
198% A description of each parameter follows:
199%
200% o cache_view: the cache view.
201%
202*/
203MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
204{
205 CacheView
206 *clone_view;
207
208 assert(cache_view != (CacheView *) NULL);
209 assert(cache_view->signature == MagickSignature);
210 if (cache_view->debug != MagickFalse)
211 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
212 cache_view->image->filename);
cristye42639a2012-08-23 01:53:24 +0000213 clone_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
214 sizeof(*clone_view)));
cristy3ed852e2009-09-05 21:47:34 +0000215 if (clone_view == (CacheView *) NULL)
216 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
217 (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
218 clone_view->image=ReferenceImage(cache_view->image);
219 clone_view->number_threads=cache_view->number_threads;
220 clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
221 clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
222 clone_view->debug=cache_view->debug;
223 clone_view->signature=MagickSignature;
224 return(clone_view);
225}
226
227/*
228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229% %
230% %
231% %
232% D e s t r o y C a c h e V i e w %
233% %
234% %
235% %
236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
237%
238% DestroyCacheView() destroys the specified view returned by a previous call
239% to AcquireCacheView().
240%
241% The format of the DestroyCacheView method is:
242%
243% CacheView *DestroyCacheView(CacheView *cache_view)
244%
245% A description of each parameter follows:
246%
247% o cache_view: the cache view.
248%
249*/
250MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
251{
252 assert(cache_view != (CacheView *) NULL);
253 assert(cache_view->signature == MagickSignature);
254 if (cache_view->debug != MagickFalse)
255 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
256 cache_view->image->filename);
257 if (cache_view->nexus_info != (NexusInfo **) NULL)
258 cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
259 cache_view->number_threads);
260 cache_view->image=DestroyImage(cache_view->image);
261 cache_view->signature=(~MagickSignature);
cristy27d53d62012-07-29 23:30:07 +0000262 cache_view=(CacheView *) RelinquishAlignedMemory(cache_view);
cristy3ed852e2009-09-05 21:47:34 +0000263 return(cache_view);
264}
265
266/*
267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268% %
269% %
270% %
cristye7516622012-04-29 14:22:45 +0000271% G e t C a c h e V i e w A u t h e n t i c P i x e l s %
272% %
273% %
274% %
275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276%
277% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
278% cache as defined by the geometry parameters. A pointer to the pixels is
279% returned if the pixels are transferred, otherwise a NULL is returned.
280%
281% The format of the GetCacheViewAuthenticPixels method is:
282%
283% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
284% const ssize_t x,const ssize_t y,const size_t columns,
285% const size_t rows,ExceptionInfo *exception)
286%
287% A description of each parameter follows:
288%
289% o cache_view: the cache view.
290%
291% o x,y,columns,rows: These values define the perimeter of a region of
292% pixels.
293%
294% o exception: return any errors or warnings in this structure.
295%
296*/
297MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
298 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
299 ExceptionInfo *exception)
300{
301 const int
302 id = GetOpenMPThreadId();
303
304 Quantum
305 *pixels;
306
307 assert(cache_view != (CacheView *) NULL);
308 assert(cache_view->signature == MagickSignature);
309 assert(id < (int) cache_view->number_threads);
310 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
311 cache_view->nexus_info[id],exception);
312 return(pixels);
313}
314
315/*
316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317% %
318% %
319% %
320% G e t C a c h e V i e w A u t h e n t i c M e t a c o n t e n t %
321% %
322% %
323% %
324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325%
326% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
327% with the last call to SetCacheViewIndexes() or
328% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
329% be updated.
330%
331% The format of the GetCacheViewAuthenticMetacontent() method is:
332%
333% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
334%
335% A description of each parameter follows:
336%
337% o cache_view: the cache view.
338%
339*/
340MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
341{
342 const int
343 id = GetOpenMPThreadId();
344
345 void
346 *metacontent;
347
348 assert(cache_view != (CacheView *) NULL);
349 assert(cache_view->signature == MagickSignature);
350 assert(cache_view->image->cache != (Cache) NULL);
351 assert(id < (int) cache_view->number_threads);
352 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
353 cache_view->nexus_info[id]);
354 return(metacontent);
355}
356
357/*
358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
359% %
360% %
361% %
362% 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 %
363% %
364% %
365% %
366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367%
368% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
369% last call to QueueCacheViewAuthenticPixels() or
370% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
371% updated.
372%
373% The format of the GetCacheViewAuthenticPixelQueue() method is:
374%
375% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
376%
377% A description of each parameter follows:
378%
379% o cache_view: the cache view.
380%
381*/
382MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
383{
384 const int
385 id = GetOpenMPThreadId();
386
387 Quantum
388 *pixels;
389
390 assert(cache_view != (CacheView *) NULL);
391 assert(cache_view->signature == MagickSignature);
392 assert(cache_view->image->cache != (Cache) NULL);
393 assert(id < (int) cache_view->number_threads);
394 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
395 cache_view->nexus_info[id]);
396 return(pixels);
397}
398
399/*
400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401% %
402% %
403% %
cristy3ed852e2009-09-05 21:47:34 +0000404% G e t C a c h e V i e w C o l o r s p a c e %
405% %
406% %
407% %
408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409%
410% GetCacheViewColorspace() returns the image colorspace associated with the
411% specified view.
412%
413% The format of the GetCacheViewColorspace method is:
414%
415% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
416%
417% A description of each parameter follows:
418%
419% o cache_view: the cache view.
420%
421*/
422MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
423{
424 assert(cache_view != (CacheView *) NULL);
425 assert(cache_view->signature == MagickSignature);
426 if (cache_view->debug != MagickFalse)
427 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
428 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000429 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000430}
431
432/*
433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434% %
435% %
436% %
cristy3ed852e2009-09-05 21:47:34 +0000437+ G e t C a c h e V i e w E x t e n t %
438% %
439% %
440% %
441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
442%
443% GetCacheViewExtent() returns the extent of the pixels associated with the
444% last call to QueueCacheViewAuthenticPixels() or
445% GetCacheViewAuthenticPixels().
446%
447% The format of the GetCacheViewExtent() method is:
448%
449% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
450%
451% A description of each parameter follows:
452%
453% o cache_view: the cache view.
454%
455*/
456MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
457{
cristy5c9e6f22010-09-17 17:31:01 +0000458 const int
459 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000460
cristy4c08aed2011-07-01 19:47:50 +0000461 MagickSizeType
462 extent;
463
cristy3ed852e2009-09-05 21:47:34 +0000464 assert(cache_view != (CacheView *) NULL);
465 assert(cache_view->signature == MagickSignature);
466 if (cache_view->debug != MagickFalse)
467 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
468 cache_view->image->filename);
469 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000470 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000471 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
472 cache_view->nexus_info[id]);
473 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000474}
475
476/*
477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
478% %
479% %
480% %
cristye7516622012-04-29 14:22:45 +0000481% G e t C a c h e V i e w I m a g e %
482% %
483% %
484% %
485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
486%
487% GetCacheViewImage() returns the image associated with the specified view.
488%
489% The format of the GetCacheViewImage method is:
490%
491% const Image *GetCacheViewImage(const CacheView *cache_view)
492%
493% A description of each parameter follows:
494%
495% o cache_view: the cache view.
496%
497*/
498MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
499{
500 assert(cache_view != (CacheView *) NULL);
501 assert(cache_view->signature == MagickSignature);
502 if (cache_view->debug != MagickFalse)
503 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
504 cache_view->image->filename);
505 return(cache_view->image);
506}
507
508/*
509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
510% %
511% %
512% %
cristy3ed852e2009-09-05 21:47:34 +0000513% G e t C a c h e V i e w S t o r a g e C l a s s %
514% %
515% %
516% %
517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
518%
cristye7516622012-04-29 14:22:45 +0000519% GetCacheViewStorageClass() returns the image storage class associated with
cristy3ed852e2009-09-05 21:47:34 +0000520% the specified view.
521%
522% The format of the GetCacheViewStorageClass method is:
523%
524% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
525%
526% A description of each parameter follows:
527%
528% o cache_view: the cache view.
529%
530*/
531MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
532{
533 assert(cache_view != (CacheView *) NULL);
534 assert(cache_view->signature == MagickSignature);
535 if (cache_view->debug != MagickFalse)
536 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
537 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000538 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000539}
540
541/*
542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
543% %
544% %
545% %
cristy4c08aed2011-07-01 19:47:50 +0000546% 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 %
cristy3ed852e2009-09-05 21:47:34 +0000547% %
548% %
549% %
550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
551%
cristy4c08aed2011-07-01 19:47:50 +0000552% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
553% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
554% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000555%
cristy4c08aed2011-07-01 19:47:50 +0000556% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000557%
cristy4c08aed2011-07-01 19:47:50 +0000558% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000559% const CacheView *cache_view)
560%
561% A description of each parameter follows:
562%
563% o cache_view: the cache view.
564%
565*/
cristy4c08aed2011-07-01 19:47:50 +0000566MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000567 const CacheView *cache_view)
568{
cristy5c9e6f22010-09-17 17:31:01 +0000569 const int
570 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000571
cristy4c08aed2011-07-01 19:47:50 +0000572 const void
573 *metacontent;
574
cristy3ed852e2009-09-05 21:47:34 +0000575 assert(cache_view != (const CacheView *) NULL);
576 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000577 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000578 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000579 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
580 cache_view->nexus_info[id]);
581 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000582}
583
584/*
585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586% %
587% %
588% %
589% 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 %
590% %
591% %
592% %
593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
594%
595% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
596% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
597% and therefore cannot be updated.
598%
599% The format of the GetCacheViewVirtualPixelQueue() method is:
600%
cristy4c08aed2011-07-01 19:47:50 +0000601% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000602% const CacheView *cache_view)
603%
604% A description of each parameter follows:
605%
606% o cache_view: the cache view.
607%
608*/
cristy4c08aed2011-07-01 19:47:50 +0000609MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000610 const CacheView *cache_view)
611{
cristy5c9e6f22010-09-17 17:31:01 +0000612 const int
613 id = GetOpenMPThreadId();
614
cristy4c08aed2011-07-01 19:47:50 +0000615 const Quantum
616 *pixels;
617
cristy3ed852e2009-09-05 21:47:34 +0000618 assert(cache_view != (const CacheView *) NULL);
619 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000620 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000621 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000622 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
623 cache_view->nexus_info[id]);
624 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000625}
626
627/*
628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629% %
630% %
631% %
632% 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 %
633% %
634% %
635% %
636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637%
638% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
639% disk pixel cache as defined by the geometry parameters. A pointer to the
640% pixels is returned if the pixels are transferred, otherwise a NULL is
641% returned.
642%
643% The format of the GetCacheViewVirtualPixels method is:
644%
cristy4c08aed2011-07-01 19:47:50 +0000645% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000646% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000647% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000648%
649% A description of each parameter follows:
650%
651% o cache_view: the cache view.
652%
653% o x,y,columns,rows: These values define the perimeter of a region of
654% pixels.
655%
656% o exception: return any errors or warnings in this structure.
657%
658*/
cristy4c08aed2011-07-01 19:47:50 +0000659MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000660 const CacheView *cache_view,const ssize_t x,const ssize_t y,
661 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000662{
cristy5c9e6f22010-09-17 17:31:01 +0000663 const int
664 id = GetOpenMPThreadId();
665
cristy4c08aed2011-07-01 19:47:50 +0000666 const Quantum
667 *pixels;
668
cristy3ed852e2009-09-05 21:47:34 +0000669 assert(cache_view != (CacheView *) NULL);
670 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000671 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000672 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000673 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000674 cache_view->nexus_info[id],exception);
675 return(pixels);
676}
677
678/*
679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
680% %
681% %
682% %
683% 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 %
684% %
685% %
686% %
687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
688%
689% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
690% location. The image background color is returned if an error occurs.
691%
692% The format of the GetOneCacheViewAuthenticPixel method is:
693%
694% MagickBooleaNType GetOneCacheViewAuthenticPixel(
695% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000696% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000697%
698% A description of each parameter follows:
699%
700% o cache_view: the cache view.
701%
702% o x,y: These values define the offset of the pixel.
703%
704% o pixel: return a pixel at the specified (x,y) location.
705%
706% o exception: return any errors or warnings in this structure.
707%
708*/
709MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000710 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
711 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000712{
713 const int
714 id = GetOpenMPThreadId();
715
716 Quantum
cristy584cbf82013-04-19 12:21:58 +0000717 *q;
cristy4c08aed2011-07-01 19:47:50 +0000718
cristy2ed42f62011-10-02 19:49:57 +0000719 register ssize_t
720 i;
721
cristy4c08aed2011-07-01 19:47:50 +0000722 assert(cache_view != (CacheView *) NULL);
723 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000724 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000725 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy584cbf82013-04-19 12:21:58 +0000726 q=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
cristy4c08aed2011-07-01 19:47:50 +0000727 cache_view->nexus_info[id],exception);
cristy584cbf82013-04-19 12:21:58 +0000728 if (q == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000729 {
cristyd09f8802012-02-04 16:44:10 +0000730 PixelInfo
731 background_color;
732
733 background_color=cache_view->image->background_color;
734 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
735 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
736 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
737 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
738 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000739 return(MagickFalse);
740 }
741 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
742 {
cristy5a23c552013-02-13 14:34:28 +0000743 PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);
cristy584cbf82013-04-19 12:21:58 +0000744 pixel[channel]=q[i];
cristy2ed42f62011-10-02 19:49:57 +0000745 }
cristy4c08aed2011-07-01 19:47:50 +0000746 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000747}
748
749/*
750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
751% %
752% %
753% %
754% 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 %
755% %
756% %
757% %
758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
759%
760% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
761% location. The image background color is returned if an error occurs. If
762% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
763%
764% The format of the GetOneCacheViewVirtualPixel method is:
765%
766% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000767% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000768% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000769%
770% A description of each parameter follows:
771%
772% o cache_view: the cache view.
773%
774% o x,y: These values define the offset of the pixel.
775%
776% o pixel: return a pixel at the specified (x,y) location.
777%
778% o exception: return any errors or warnings in this structure.
779%
780*/
781MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000782 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
783 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000784{
cristy5c9e6f22010-09-17 17:31:01 +0000785 const int
786 id = GetOpenMPThreadId();
787
cristyf05d4942012-03-17 16:26:09 +0000788 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000789 *p;
cristy3ed852e2009-09-05 21:47:34 +0000790
cristy2ed42f62011-10-02 19:49:57 +0000791 register ssize_t
792 i;
793
cristy3ed852e2009-09-05 21:47:34 +0000794 assert(cache_view != (CacheView *) NULL);
795 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000796 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000797 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000798 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000799 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
800 exception);
cristy4c08aed2011-07-01 19:47:50 +0000801 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000802 {
cristyd09f8802012-02-04 16:44:10 +0000803 PixelInfo
804 background_color;
805
806 background_color=cache_view->image->background_color;
807 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
808 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
809 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
810 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
811 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000812 return(MagickFalse);
813 }
814 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
815 {
cristy5a23c552013-02-13 14:34:28 +0000816 PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000817 pixel[channel]=p[i];
818 }
cristy3ed852e2009-09-05 21:47:34 +0000819 return(MagickTrue);
820}
821
822/*
823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
824% %
825% %
826% %
cristyf05d4942012-03-17 16:26:09 +0000827% G e t O n e C a c h e V i e w V i r t u a l P i x e l I n f o %
828% %
829% %
830% %
831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
832%
833% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
834% (x,y) location. The image background color is returned if an error occurs.
835% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
836%
837% The format of the GetOneCacheViewVirtualPixelInfo method is:
838%
839% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
840% const CacheView *cache_view,const ssize_t x,const ssize_t y,
841% PixelInfo *pixel,ExceptionInfo *exception)
842%
843% A description of each parameter follows:
844%
845% o cache_view: the cache view.
846%
847% o x,y: These values define the offset of the pixel.
848%
849% o pixel: return a pixel at the specified (x,y) location.
850%
851% o exception: return any errors or warnings in this structure.
852%
853*/
854MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
855 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
856 ExceptionInfo *exception)
857{
858 const int
859 id = GetOpenMPThreadId();
860
861 register const Quantum
862 *p;
863
864 assert(cache_view != (CacheView *) NULL);
865 assert(cache_view->signature == MagickSignature);
866 assert(id < (int) cache_view->number_threads);
cristyf82cff82012-04-16 16:54:17 +0000867 GetPixelInfo(cache_view->image,pixel);
cristyf05d4942012-03-17 16:26:09 +0000868 p=GetVirtualPixelsFromNexus(cache_view->image,
869 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
870 exception);
cristyf05d4942012-03-17 16:26:09 +0000871 if (p == (const Quantum *) NULL)
872 return(MagickFalse);
873 GetPixelInfoPixel(cache_view->image,p,pixel);
874 return(MagickTrue);
875}
876
877/*
878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
879% %
880% %
881% %
cristy3ed852e2009-09-05 21:47:34 +0000882% 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 %
883% %
884% %
885% %
886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
887%
888% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
889% the specified (x,y) location. The image background color is returned if an
890% error occurs. If you plan to modify the pixel, use
891% GetOneCacheViewAuthenticPixel() instead.
892%
893% The format of the GetOneCacheViewVirtualPixel method is:
894%
895% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
896% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000897% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000898% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000899%
900% A description of each parameter follows:
901%
902% o cache_view: the cache view.
903%
904% o virtual_pixel_method: the virtual pixel method.
905%
906% o x,y: These values define the offset of the pixel.
907%
908% o pixel: return a pixel at the specified (x,y) location.
909%
910% o exception: return any errors or warnings in this structure.
911%
912*/
913MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
914 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000915 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000916{
cristy5c9e6f22010-09-17 17:31:01 +0000917 const int
918 id = GetOpenMPThreadId();
919
cristy4c08aed2011-07-01 19:47:50 +0000920 const Quantum
921 *p;
cristy3ed852e2009-09-05 21:47:34 +0000922
cristy2ed42f62011-10-02 19:49:57 +0000923 register ssize_t
924 i;
925
cristy3ed852e2009-09-05 21:47:34 +0000926 assert(cache_view != (CacheView *) NULL);
927 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000928 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000929 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000930 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
931 cache_view->nexus_info[id],exception);
932 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000933 {
cristyd09f8802012-02-04 16:44:10 +0000934 PixelInfo
935 background_color;
936
937 background_color=cache_view->image->background_color;
938 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
939 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
940 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
941 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
942 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000943 return(MagickFalse);
944 }
945 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
946 {
cristy5a23c552013-02-13 14:34:28 +0000947 PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000948 pixel[channel]=p[i];
949 }
cristy3ed852e2009-09-05 21:47:34 +0000950 return(MagickTrue);
951}
952
953/*
954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
955% %
956% %
957% %
958% 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 %
959% %
960% %
961% %
962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
963%
964% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
965% disk pixel cache as defined by the geometry parameters. A pointer to the
966% pixels is returned if the pixels are transferred, otherwise a NULL is
967% returned.
968%
969% The format of the QueueCacheViewAuthenticPixels method is:
970%
cristy4c08aed2011-07-01 19:47:50 +0000971% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000972% const ssize_t x,const ssize_t y,const size_t columns,
973% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000974%
975% A description of each parameter follows:
976%
977% o cache_view: the cache view.
978%
979% o x,y,columns,rows: These values define the perimeter of a region of
980% pixels.
981%
982% o exception: return any errors or warnings in this structure.
983%
984*/
cristy4c08aed2011-07-01 19:47:50 +0000985MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000986 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
987 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000988{
cristy5c9e6f22010-09-17 17:31:01 +0000989 const int
990 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000991
cristy4c08aed2011-07-01 19:47:50 +0000992 Quantum
993 *pixels;
994
cristy3ed852e2009-09-05 21:47:34 +0000995 assert(cache_view != (CacheView *) NULL);
996 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000997 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +0000998 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
999 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +00001000 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +00001001}
1002
1003/*
1004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1005% %
1006% %
1007% %
1008% S e t C a c h e V i e w S t o r a g e C l a s s %
1009% %
1010% %
1011% %
1012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1013%
1014% SetCacheViewStorageClass() sets the image storage class associated with
1015% the specified view.
1016%
1017% The format of the SetCacheViewStorageClass method is:
1018%
1019% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001020% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001021%
1022% A description of each parameter follows:
1023%
1024% o cache_view: the cache view.
1025%
1026% o storage_class: the image storage class: PseudoClass or DirectClass.
1027%
cristyc82a27b2011-10-21 01:07:16 +00001028% o exception: return any errors or warnings in this structure.
1029%
cristy3ed852e2009-09-05 21:47:34 +00001030*/
1031MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001032 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001033{
1034 assert(cache_view != (CacheView *) NULL);
1035 assert(cache_view->signature == MagickSignature);
1036 if (cache_view->debug != MagickFalse)
1037 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1038 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +00001039 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +00001040}
1041
1042/*
1043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044% %
1045% %
1046% %
1047% 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 %
1048% %
1049% %
1050% %
1051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052%
1053% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1054% with the specified cache view.
1055%
1056% The format of the SetCacheViewVirtualPixelMethod method is:
1057%
1058% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1059% const VirtualPixelMethod virtual_pixel_method)
1060%
1061% A description of each parameter follows:
1062%
1063% o cache_view: the cache view.
1064%
1065% o virtual_pixel_method: the virtual pixel method.
1066%
1067*/
1068MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1069 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
1070{
1071 assert(cache_view != (CacheView *) NULL);
1072 assert(cache_view->signature == MagickSignature);
1073 if (cache_view->debug != MagickFalse)
1074 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1075 cache_view->image->filename);
1076 cache_view->virtual_pixel_method=virtual_pixel_method;
1077 return(MagickTrue);
1078}
1079
1080/*
1081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1082% %
1083% %
1084% %
1085% 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 %
1086% %
1087% %
1088% %
1089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1090%
1091% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1092% or disk cache. It returns MagickTrue if the pixel region is flushed,
1093% otherwise MagickFalse.
1094%
1095% The format of the SyncCacheViewAuthenticPixels method is:
1096%
1097% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1098% ExceptionInfo *exception)
1099%
1100% A description of each parameter follows:
1101%
1102% o cache_view: the cache view.
1103%
1104% o exception: return any errors or warnings in this structure.
1105%
1106*/
1107MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1108 CacheView *cache_view,ExceptionInfo *exception)
1109{
cristy5c9e6f22010-09-17 17:31:01 +00001110 const int
1111 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001112
cristy4c08aed2011-07-01 19:47:50 +00001113 MagickBooleanType
1114 status;
1115
cristy3ed852e2009-09-05 21:47:34 +00001116 assert(cache_view != (CacheView *) NULL);
1117 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001118 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001119 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1120 cache_view->nexus_info[id],exception);
1121 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001122}