blob: e14fdefb66e1fb823736251237ab29d13aea52ba [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% %
cristy1454be72011-12-19 01:52:48 +000026% Copyright 1999-2012 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"
54#include "MagickCore/exception.h"
55#include "MagickCore/exception-private.h"
56#include "MagickCore/pixel-accessor.h"
57#include "MagickCore/string_.h"
58#include "MagickCore/thread-private.h"
cristy3ed852e2009-09-05 21:47:34 +000059
60/*
61 Typedef declarations.
62*/
63struct _CacheView
64{
65 Image
66 *image;
67
68 VirtualPixelMethod
69 virtual_pixel_method;
70
cristybb503372010-05-27 20:51:26 +000071 size_t
cristy3ed852e2009-09-05 21:47:34 +000072 number_threads;
73
74 NexusInfo
75 **nexus_info;
76
77 MagickBooleanType
78 debug;
79
cristybb503372010-05-27 20:51:26 +000080 size_t
cristy3ed852e2009-09-05 21:47:34 +000081 signature;
82};
83
84/*
85%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86% %
87% %
88% %
89% A c q u i r e C a c h e V i e w %
90% %
91% %
92% %
93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94%
95% AcquireCacheView() acquires a view into the pixel cache, using the
96% VirtualPixelMethod that is defined within the given image itself.
97%
98% The format of the AcquireCacheView method is:
99%
100% CacheView *AcquireCacheView(const Image *image)
101%
102% A description of each parameter follows:
103%
104% o image: the image.
105%
106*/
107MagickExport CacheView *AcquireCacheView(const Image *image)
108{
109 CacheView
110 *cache_view;
111
112 assert(image != (Image *) NULL);
113 assert(image->signature == MagickSignature);
114 if (image->debug != MagickFalse)
115 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
cristya64b85d2011-09-14 01:02:31 +0000116 cache_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*cache_view));
cristy3ed852e2009-09-05 21:47:34 +0000117 if (cache_view == (CacheView *) NULL)
118 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
119 (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view));
120 cache_view->image=ReferenceImage((Image *) image);
121 cache_view->number_threads=GetOpenMPMaximumThreads();
122 cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
123 cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
124 cache_view->debug=IsEventLogging();
125 cache_view->signature=MagickSignature;
126 if (cache_view->nexus_info == (NexusInfo **) NULL)
127 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
128 return(cache_view);
129}
130
131/*
132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133% %
134% %
135% %
136% C l o n e C a c h e V i e w %
137% %
138% %
139% %
140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141%
142% CloneCacheView() makes an exact copy of the specified cache view.
143%
144% The format of the CloneCacheView method is:
145%
146% CacheView *CloneCacheView(const CacheView *cache_view)
147%
148% A description of each parameter follows:
149%
150% o cache_view: the cache view.
151%
152*/
153MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
154{
155 CacheView
156 *clone_view;
157
158 assert(cache_view != (CacheView *) NULL);
159 assert(cache_view->signature == MagickSignature);
160 if (cache_view->debug != MagickFalse)
161 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
162 cache_view->image->filename);
cristya64b85d2011-09-14 01:02:31 +0000163 clone_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*clone_view));
cristy3ed852e2009-09-05 21:47:34 +0000164 if (clone_view == (CacheView *) NULL)
165 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
166 (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
167 clone_view->image=ReferenceImage(cache_view->image);
168 clone_view->number_threads=cache_view->number_threads;
169 clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
170 clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
171 clone_view->debug=cache_view->debug;
172 clone_view->signature=MagickSignature;
173 return(clone_view);
174}
175
176/*
177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
178% %
179% %
180% %
181% D e s t r o y C a c h e V i e w %
182% %
183% %
184% %
185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186%
187% DestroyCacheView() destroys the specified view returned by a previous call
188% to AcquireCacheView().
189%
190% The format of the DestroyCacheView method is:
191%
192% CacheView *DestroyCacheView(CacheView *cache_view)
193%
194% A description of each parameter follows:
195%
196% o cache_view: the cache view.
197%
198*/
199MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
200{
201 assert(cache_view != (CacheView *) NULL);
202 assert(cache_view->signature == MagickSignature);
203 if (cache_view->debug != MagickFalse)
204 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
205 cache_view->image->filename);
206 if (cache_view->nexus_info != (NexusInfo **) NULL)
207 cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
208 cache_view->number_threads);
209 cache_view->image=DestroyImage(cache_view->image);
210 cache_view->signature=(~MagickSignature);
cristyb41ee102010-10-04 16:46:15 +0000211 cache_view=(CacheView *) RelinquishMagickMemory(cache_view);
cristy3ed852e2009-09-05 21:47:34 +0000212 return(cache_view);
213}
214
215/*
216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
217% %
218% %
219% %
220% G e t C a c h e V i e w C o l o r s p a c e %
221% %
222% %
223% %
224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225%
226% GetCacheViewColorspace() returns the image colorspace associated with the
227% specified view.
228%
229% The format of the GetCacheViewColorspace method is:
230%
231% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
232%
233% A description of each parameter follows:
234%
235% o cache_view: the cache view.
236%
237*/
238MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
239{
240 assert(cache_view != (CacheView *) NULL);
241 assert(cache_view->signature == MagickSignature);
242 if (cache_view->debug != MagickFalse)
243 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
244 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000245 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000246}
247
248/*
249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
250% %
251% %
252% %
cristy3ed852e2009-09-05 21:47:34 +0000253+ G e t C a c h e V i e w E x t e n t %
254% %
255% %
256% %
257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258%
259% GetCacheViewExtent() returns the extent of the pixels associated with the
260% last call to QueueCacheViewAuthenticPixels() or
261% GetCacheViewAuthenticPixels().
262%
263% The format of the GetCacheViewExtent() method is:
264%
265% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
266%
267% A description of each parameter follows:
268%
269% o cache_view: the cache view.
270%
271*/
272MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
273{
cristy5c9e6f22010-09-17 17:31:01 +0000274 const int
275 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000276
cristy4c08aed2011-07-01 19:47:50 +0000277 MagickSizeType
278 extent;
279
cristy3ed852e2009-09-05 21:47:34 +0000280 assert(cache_view != (CacheView *) NULL);
281 assert(cache_view->signature == MagickSignature);
282 if (cache_view->debug != MagickFalse)
283 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
284 cache_view->image->filename);
285 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000286 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000287 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
288 cache_view->nexus_info[id]);
289 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000290}
291
292/*
293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294% %
295% %
296% %
297% G e t C a c h e V i e w S t o r a g e C l a s s %
298% %
299% %
300% %
301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302%
303% GetCacheViewStorageClass() returns the image storage class associated with
304% the specified view.
305%
306% The format of the GetCacheViewStorageClass method is:
307%
308% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
309%
310% A description of each parameter follows:
311%
312% o cache_view: the cache view.
313%
314*/
315MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
316{
317 assert(cache_view != (CacheView *) NULL);
318 assert(cache_view->signature == MagickSignature);
319 if (cache_view->debug != MagickFalse)
320 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
321 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000322 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000323}
324
325/*
326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327% %
328% %
329% %
330% 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 %
331% %
332% %
333% %
334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335%
336% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
337% cache as defined by the geometry parameters. A pointer to the pixels is
338% returned if the pixels are transferred, otherwise a NULL is returned.
339%
340% The format of the GetCacheViewAuthenticPixels method is:
341%
cristy4c08aed2011-07-01 19:47:50 +0000342% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000343% const ssize_t x,const ssize_t y,const size_t columns,
344% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000345%
346% A description of each parameter follows:
347%
348% o cache_view: the cache view.
349%
350% o x,y,columns,rows: These values define the perimeter of a region of
351% pixels.
352%
353*/
cristy4c08aed2011-07-01 19:47:50 +0000354MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000355 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
356 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000357{
cristy5c9e6f22010-09-17 17:31:01 +0000358 const int
359 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000360
cristy4c08aed2011-07-01 19:47:50 +0000361 Quantum
cristy3ed852e2009-09-05 21:47:34 +0000362 *pixels;
363
364 assert(cache_view != (CacheView *) NULL);
365 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000366 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000367 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
cristy3ed852e2009-09-05 21:47:34 +0000368 cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +0000369 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000370}
371
372/*
373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374% %
375% %
376% %
cristy4c08aed2011-07-01 19:47:50 +0000377% 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 %
cristy3ed852e2009-09-05 21:47:34 +0000378% %
379% %
380% %
381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
382%
cristy4c08aed2011-07-01 19:47:50 +0000383% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
384% with the last call to SetCacheViewIndexes() or
385% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
386% be updated.
cristy3ed852e2009-09-05 21:47:34 +0000387%
cristy4c08aed2011-07-01 19:47:50 +0000388% The format of the GetCacheViewAuthenticMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000389%
cristy4c08aed2011-07-01 19:47:50 +0000390% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000391%
392% A description of each parameter follows:
393%
394% o cache_view: the cache view.
395%
396*/
cristy4c08aed2011-07-01 19:47:50 +0000397MagickExport void *GetCacheViewAuthenticMetacontent(
398 CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000399{
cristy5c9e6f22010-09-17 17:31:01 +0000400 const int
401 id = GetOpenMPThreadId();
402
cristy4c08aed2011-07-01 19:47:50 +0000403 void
404 *metacontent;
405
cristy3ed852e2009-09-05 21:47:34 +0000406 assert(cache_view != (CacheView *) NULL);
407 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000408 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000409 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000410 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
411 cache_view->nexus_info[id]);
412 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000413}
414
415/*
416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
417% %
418% %
419% %
420% 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 %
421% %
422% %
423% %
424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425%
426% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
427% last call to QueueCacheViewAuthenticPixels() or
428% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
429% updated.
430%
431% The format of the GetCacheViewAuthenticPixelQueue() method is:
432%
cristy4c08aed2011-07-01 19:47:50 +0000433% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000434%
435% A description of each parameter follows:
436%
437% o cache_view: the cache view.
438%
439*/
cristy4c08aed2011-07-01 19:47:50 +0000440MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000441{
cristy5c9e6f22010-09-17 17:31:01 +0000442 const int
443 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000444
cristy4c08aed2011-07-01 19:47:50 +0000445 Quantum
446 *pixels;
447
cristy3ed852e2009-09-05 21:47:34 +0000448 assert(cache_view != (CacheView *) NULL);
449 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000450 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000451 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000452 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
453 cache_view->nexus_info[id]);
454 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000455}
456
457/*
458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
459% %
460% %
461% %
cristy4c08aed2011-07-01 19:47:50 +0000462% 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 +0000463% %
464% %
465% %
466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
467%
cristy4c08aed2011-07-01 19:47:50 +0000468% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
469% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
470% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000471%
cristy4c08aed2011-07-01 19:47:50 +0000472% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000473%
cristy4c08aed2011-07-01 19:47:50 +0000474% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000475% const CacheView *cache_view)
476%
477% A description of each parameter follows:
478%
479% o cache_view: the cache view.
480%
481*/
cristy4c08aed2011-07-01 19:47:50 +0000482MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000483 const CacheView *cache_view)
484{
cristy5c9e6f22010-09-17 17:31:01 +0000485 const int
486 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000487
cristy4c08aed2011-07-01 19:47:50 +0000488 const void
489 *metacontent;
490
cristy3ed852e2009-09-05 21:47:34 +0000491 assert(cache_view != (const CacheView *) NULL);
492 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000493 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000494 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000495 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
496 cache_view->nexus_info[id]);
497 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000498}
499
500/*
501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502% %
503% %
504% %
505% 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 %
506% %
507% %
508% %
509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
510%
511% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
512% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
513% and therefore cannot be updated.
514%
515% The format of the GetCacheViewVirtualPixelQueue() method is:
516%
cristy4c08aed2011-07-01 19:47:50 +0000517% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000518% const CacheView *cache_view)
519%
520% A description of each parameter follows:
521%
522% o cache_view: the cache view.
523%
524*/
cristy4c08aed2011-07-01 19:47:50 +0000525MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000526 const CacheView *cache_view)
527{
cristy5c9e6f22010-09-17 17:31:01 +0000528 const int
529 id = GetOpenMPThreadId();
530
cristy4c08aed2011-07-01 19:47:50 +0000531 const Quantum
532 *pixels;
533
cristy3ed852e2009-09-05 21:47:34 +0000534 assert(cache_view != (const CacheView *) NULL);
535 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000536 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000537 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000538 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
539 cache_view->nexus_info[id]);
540 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000541}
542
543/*
544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545% %
546% %
547% %
548% 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 %
549% %
550% %
551% %
552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553%
554% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
555% disk pixel cache as defined by the geometry parameters. A pointer to the
556% pixels is returned if the pixels are transferred, otherwise a NULL is
557% returned.
558%
559% The format of the GetCacheViewVirtualPixels method is:
560%
cristy4c08aed2011-07-01 19:47:50 +0000561% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000562% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000563% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000564%
565% A description of each parameter follows:
566%
567% o cache_view: the cache view.
568%
569% o x,y,columns,rows: These values define the perimeter of a region of
570% pixels.
571%
572% o exception: return any errors or warnings in this structure.
573%
574*/
cristy4c08aed2011-07-01 19:47:50 +0000575MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000576 const CacheView *cache_view,const ssize_t x,const ssize_t y,
577 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000578{
cristy5c9e6f22010-09-17 17:31:01 +0000579 const int
580 id = GetOpenMPThreadId();
581
cristy4c08aed2011-07-01 19:47:50 +0000582 const Quantum
583 *pixels;
584
cristy3ed852e2009-09-05 21:47:34 +0000585 assert(cache_view != (CacheView *) NULL);
586 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000587 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000588 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000589 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000590 cache_view->nexus_info[id],exception);
591 return(pixels);
592}
593
594/*
595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
596% %
597% %
598% %
599% 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 %
600% %
601% %
602% %
603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
604%
605% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
606% location. The image background color is returned if an error occurs.
607%
608% The format of the GetOneCacheViewAuthenticPixel method is:
609%
610% MagickBooleaNType GetOneCacheViewAuthenticPixel(
611% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000612% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000613%
614% A description of each parameter follows:
615%
616% o cache_view: the cache view.
617%
618% o x,y: These values define the offset of the pixel.
619%
620% o pixel: return a pixel at the specified (x,y) location.
621%
622% o exception: return any errors or warnings in this structure.
623%
624*/
625MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000626 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
627 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000628{
629 const int
630 id = GetOpenMPThreadId();
631
632 Quantum
633 *p;
634
cristy2ed42f62011-10-02 19:49:57 +0000635 register ssize_t
636 i;
637
cristy4c08aed2011-07-01 19:47:50 +0000638 assert(cache_view != (CacheView *) NULL);
639 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000640 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000641 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000642 p=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
643 cache_view->nexus_info[id],exception);
644 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000645 {
cristyd09f8802012-02-04 16:44:10 +0000646 PixelInfo
647 background_color;
648
649 background_color=cache_view->image->background_color;
650 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
651 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
652 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
653 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
654 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000655 return(MagickFalse);
656 }
657 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
658 {
659 PixelChannel
660 channel;
661
cristye2a912b2011-12-05 20:02:07 +0000662 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000663 pixel[channel]=p[i];
664 }
cristy4c08aed2011-07-01 19:47:50 +0000665 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000666}
667
668/*
669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
670% %
671% %
672% %
673% 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 %
674% %
675% %
676% %
677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
678%
679% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
680% location. The image background color is returned if an error occurs. If
681% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
682%
683% The format of the GetOneCacheViewVirtualPixel method is:
684%
685% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000686% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000687% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000688%
689% A description of each parameter follows:
690%
691% o cache_view: the cache view.
692%
693% o x,y: These values define the offset of the pixel.
694%
695% o pixel: return a pixel at the specified (x,y) location.
696%
697% o exception: return any errors or warnings in this structure.
698%
699*/
700MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000701 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
702 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000703{
cristy5c9e6f22010-09-17 17:31:01 +0000704 const int
705 id = GetOpenMPThreadId();
706
cristyf05d4942012-03-17 16:26:09 +0000707 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000708 *p;
cristy3ed852e2009-09-05 21:47:34 +0000709
cristy2ed42f62011-10-02 19:49:57 +0000710 register ssize_t
711 i;
712
cristy3ed852e2009-09-05 21:47:34 +0000713 assert(cache_view != (CacheView *) NULL);
714 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000715 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000716 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000717 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000718 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
719 exception);
cristy4c08aed2011-07-01 19:47:50 +0000720 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000721 {
cristyd09f8802012-02-04 16:44:10 +0000722 PixelInfo
723 background_color;
724
725 background_color=cache_view->image->background_color;
726 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
727 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
728 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
729 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
730 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000731 return(MagickFalse);
732 }
733 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
734 {
735 PixelChannel
736 channel;
737
cristye2a912b2011-12-05 20:02:07 +0000738 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000739 pixel[channel]=p[i];
740 }
cristy3ed852e2009-09-05 21:47:34 +0000741 return(MagickTrue);
742}
743
744/*
745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
746% %
747% %
748% %
cristyf05d4942012-03-17 16:26:09 +0000749% 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 %
750% %
751% %
752% %
753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
754%
755% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
756% (x,y) location. The image background color is returned if an error occurs.
757% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
758%
759% The format of the GetOneCacheViewVirtualPixelInfo method is:
760%
761% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
762% const CacheView *cache_view,const ssize_t x,const ssize_t y,
763% PixelInfo *pixel,ExceptionInfo *exception)
764%
765% A description of each parameter follows:
766%
767% o cache_view: the cache view.
768%
769% o x,y: These values define the offset of the pixel.
770%
771% o pixel: return a pixel at the specified (x,y) location.
772%
773% o exception: return any errors or warnings in this structure.
774%
775*/
776MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
777 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
778 ExceptionInfo *exception)
779{
780 const int
781 id = GetOpenMPThreadId();
782
783 register const Quantum
784 *p;
785
786 assert(cache_view != (CacheView *) NULL);
787 assert(cache_view->signature == MagickSignature);
788 assert(id < (int) cache_view->number_threads);
cristyf05d4942012-03-17 16:26:09 +0000789 p=GetVirtualPixelsFromNexus(cache_view->image,
790 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
791 exception);
792 GetPixelInfo(cache_view->image,pixel);
793 if (p == (const Quantum *) NULL)
794 return(MagickFalse);
795 GetPixelInfoPixel(cache_view->image,p,pixel);
796 return(MagickTrue);
797}
798
799/*
800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
801% %
802% %
803% %
cristy3ed852e2009-09-05 21:47:34 +0000804% 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 %
805% %
806% %
807% %
808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809%
810% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
811% the specified (x,y) location. The image background color is returned if an
812% error occurs. If you plan to modify the pixel, use
813% GetOneCacheViewAuthenticPixel() instead.
814%
815% The format of the GetOneCacheViewVirtualPixel method is:
816%
817% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
818% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000819% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000820% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000821%
822% A description of each parameter follows:
823%
824% o cache_view: the cache view.
825%
826% o virtual_pixel_method: the virtual pixel method.
827%
828% o x,y: These values define the offset of the pixel.
829%
830% o pixel: return a pixel at the specified (x,y) location.
831%
832% o exception: return any errors or warnings in this structure.
833%
834*/
835MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
836 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000837 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000838{
cristy5c9e6f22010-09-17 17:31:01 +0000839 const int
840 id = GetOpenMPThreadId();
841
cristy4c08aed2011-07-01 19:47:50 +0000842 const Quantum
843 *p;
cristy3ed852e2009-09-05 21:47:34 +0000844
cristy2ed42f62011-10-02 19:49:57 +0000845 register ssize_t
846 i;
847
cristy3ed852e2009-09-05 21:47:34 +0000848 assert(cache_view != (CacheView *) NULL);
849 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000850 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000851 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000852 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
853 cache_view->nexus_info[id],exception);
854 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000855 {
cristyd09f8802012-02-04 16:44:10 +0000856 PixelInfo
857 background_color;
858
859 background_color=cache_view->image->background_color;
860 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
861 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
862 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
863 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
864 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000865 return(MagickFalse);
866 }
867 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
868 {
869 PixelChannel
870 channel;
871
cristye2a912b2011-12-05 20:02:07 +0000872 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000873 pixel[channel]=p[i];
874 }
cristy3ed852e2009-09-05 21:47:34 +0000875 return(MagickTrue);
876}
877
878/*
879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
880% %
881% %
882% %
883% 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 %
884% %
885% %
886% %
887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888%
889% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
890% disk pixel cache as defined by the geometry parameters. A pointer to the
891% pixels is returned if the pixels are transferred, otherwise a NULL is
892% returned.
893%
894% The format of the QueueCacheViewAuthenticPixels method is:
895%
cristy4c08aed2011-07-01 19:47:50 +0000896% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000897% const ssize_t x,const ssize_t y,const size_t columns,
898% const size_t rows,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 x,y,columns,rows: These values define the perimeter of a region of
905% pixels.
906%
907% o exception: return any errors or warnings in this structure.
908%
909*/
cristy4c08aed2011-07-01 19:47:50 +0000910MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000911 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
912 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000913{
cristy5c9e6f22010-09-17 17:31:01 +0000914 const int
915 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000916
cristy4c08aed2011-07-01 19:47:50 +0000917 Quantum
918 *pixels;
919
cristy3ed852e2009-09-05 21:47:34 +0000920 assert(cache_view != (CacheView *) NULL);
921 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000922 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +0000923 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
924 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +0000925 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000926}
927
928/*
929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
930% %
931% %
932% %
933% S e t C a c h e V i e w S t o r a g e C l a s s %
934% %
935% %
936% %
937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
938%
939% SetCacheViewStorageClass() sets the image storage class associated with
940% the specified view.
941%
942% The format of the SetCacheViewStorageClass method is:
943%
944% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +0000945% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000946%
947% A description of each parameter follows:
948%
949% o cache_view: the cache view.
950%
951% o storage_class: the image storage class: PseudoClass or DirectClass.
952%
cristyc82a27b2011-10-21 01:07:16 +0000953% o exception: return any errors or warnings in this structure.
954%
cristy3ed852e2009-09-05 21:47:34 +0000955*/
956MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +0000957 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000958{
959 assert(cache_view != (CacheView *) NULL);
960 assert(cache_view->signature == MagickSignature);
961 if (cache_view->debug != MagickFalse)
962 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
963 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +0000964 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +0000965}
966
967/*
968%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
969% %
970% %
971% %
972% 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 %
973% %
974% %
975% %
976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
977%
978% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
979% with the specified cache view.
980%
981% The format of the SetCacheViewVirtualPixelMethod method is:
982%
983% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
984% const VirtualPixelMethod virtual_pixel_method)
985%
986% A description of each parameter follows:
987%
988% o cache_view: the cache view.
989%
990% o virtual_pixel_method: the virtual pixel method.
991%
992*/
993MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
994 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
995{
996 assert(cache_view != (CacheView *) NULL);
997 assert(cache_view->signature == MagickSignature);
998 if (cache_view->debug != MagickFalse)
999 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1000 cache_view->image->filename);
1001 cache_view->virtual_pixel_method=virtual_pixel_method;
1002 return(MagickTrue);
1003}
1004
1005/*
1006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1007% %
1008% %
1009% %
1010% 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 %
1011% %
1012% %
1013% %
1014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1015%
1016% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1017% or disk cache. It returns MagickTrue if the pixel region is flushed,
1018% otherwise MagickFalse.
1019%
1020% The format of the SyncCacheViewAuthenticPixels method is:
1021%
1022% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1023% ExceptionInfo *exception)
1024%
1025% A description of each parameter follows:
1026%
1027% o cache_view: the cache view.
1028%
1029% o exception: return any errors or warnings in this structure.
1030%
1031*/
1032MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1033 CacheView *cache_view,ExceptionInfo *exception)
1034{
cristy5c9e6f22010-09-17 17:31:01 +00001035 const int
1036 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001037
cristy4c08aed2011-07-01 19:47:50 +00001038 MagickBooleanType
1039 status;
1040
cristy3ed852e2009-09-05 21:47:34 +00001041 assert(cache_view != (CacheView *) NULL);
1042 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001043 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001044 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1045 cache_view->nexus_info[id],exception);
1046 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001047}