blob: 2d95ced45336ecd276445c451ba50e91cb5891c3 [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% %
cristydb070952012-04-20 14:33:00 +000089% 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 +000090% %
91% %
92% %
93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94%
cristydb070952012-04-20 14:33:00 +000095% AcquireAuthenticCacheView() acquires an authentic view into the pixel cache.
cristy3ed852e2009-09-05 21:47:34 +000096%
cristydb070952012-04-20 14:33:00 +000097% The format of the AcquireAuthenticCacheView method is:
cristy3ed852e2009-09-05 21:47:34 +000098%
cristydb070952012-04-20 14:33:00 +000099% CacheView *AcquireAuthenticCacheView(const Image *image,
100% ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000101%
102% A description of each parameter follows:
103%
104% o image: the image.
105%
cristydb070952012-04-20 14:33:00 +0000106% o exception: return any errors or warnings in this structure.
107%
cristy3ed852e2009-09-05 21:47:34 +0000108*/
cristydb070952012-04-20 14:33:00 +0000109MagickExport CacheView *AcquireAuthenticCacheView(const Image *image,
110 ExceptionInfo *exception)
111{
112 CacheView
113 *cache_view;
114
115 MagickBooleanType
116 status;
117
118 cache_view=AcquireVirtualCacheView(image,exception);
119 status=SyncImagePixelCache(cache_view->image,exception);
120 if (status == MagickFalse)
121 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
122 return(cache_view);
123}
124
125/*
126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127% %
128% %
129% %
130% A c q u i r e V i r t u a l C a c h e V i e w %
131% %
132% %
133% %
134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135%
136% AcquireVirtualCacheView() acquires a virtual view into the pixel cache,
137% using the VirtualPixelMethod that is defined within the given image itself.
138%
139% The format of the AcquireVirtualCacheView method is:
140%
141% CacheView *AcquireVirtualCacheView(const Image *image,
142% ExceptionInfo *exception)
143%
144% A description of each parameter follows:
145%
146% o image: the image.
147%
148% o exception: return any errors or warnings in this structure.
149%
150*/
151MagickExport CacheView *AcquireVirtualCacheView(const Image *image,
152 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000153{
154 CacheView
155 *cache_view;
156
157 assert(image != (Image *) NULL);
158 assert(image->signature == MagickSignature);
159 if (image->debug != MagickFalse)
160 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
cristydb070952012-04-20 14:33:00 +0000161 (void) exception;
cristya64b85d2011-09-14 01:02:31 +0000162 cache_view=(CacheView *) AcquireQuantumMemory(1,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);
167 cache_view->number_threads=GetOpenMPMaximumThreads();
168 cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
169 cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
170 cache_view->debug=IsEventLogging();
171 cache_view->signature=MagickSignature;
172 if (cache_view->nexus_info == (NexusInfo **) NULL)
173 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
174 return(cache_view);
175}
176
177/*
178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
179% %
180% %
181% %
182% C l o n e C a c h e V i e w %
183% %
184% %
185% %
186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187%
188% CloneCacheView() makes an exact copy of the specified cache view.
189%
190% The format of the CloneCacheView method is:
191%
192% CacheView *CloneCacheView(const CacheView *cache_view)
193%
194% A description of each parameter follows:
195%
196% o cache_view: the cache view.
197%
198*/
199MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
200{
201 CacheView
202 *clone_view;
203
204 assert(cache_view != (CacheView *) NULL);
205 assert(cache_view->signature == MagickSignature);
206 if (cache_view->debug != MagickFalse)
207 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
208 cache_view->image->filename);
cristya64b85d2011-09-14 01:02:31 +0000209 clone_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*clone_view));
cristy3ed852e2009-09-05 21:47:34 +0000210 if (clone_view == (CacheView *) NULL)
211 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
212 (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
213 clone_view->image=ReferenceImage(cache_view->image);
214 clone_view->number_threads=cache_view->number_threads;
215 clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
216 clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
217 clone_view->debug=cache_view->debug;
218 clone_view->signature=MagickSignature;
219 return(clone_view);
220}
221
222/*
223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
224% %
225% %
226% %
227% D e s t r o y C a c h e V i e w %
228% %
229% %
230% %
231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232%
233% DestroyCacheView() destroys the specified view returned by a previous call
234% to AcquireCacheView().
235%
236% The format of the DestroyCacheView method is:
237%
238% CacheView *DestroyCacheView(CacheView *cache_view)
239%
240% A description of each parameter follows:
241%
242% o cache_view: the cache view.
243%
244*/
245MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
246{
247 assert(cache_view != (CacheView *) NULL);
248 assert(cache_view->signature == MagickSignature);
249 if (cache_view->debug != MagickFalse)
250 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
251 cache_view->image->filename);
252 if (cache_view->nexus_info != (NexusInfo **) NULL)
253 cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
254 cache_view->number_threads);
255 cache_view->image=DestroyImage(cache_view->image);
256 cache_view->signature=(~MagickSignature);
cristyb41ee102010-10-04 16:46:15 +0000257 cache_view=(CacheView *) RelinquishMagickMemory(cache_view);
cristy3ed852e2009-09-05 21:47:34 +0000258 return(cache_view);
259}
260
261/*
262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263% %
264% %
265% %
266% G e t C a c h e V i e w C o l o r s p a c e %
267% %
268% %
269% %
270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271%
272% GetCacheViewColorspace() returns the image colorspace associated with the
273% specified view.
274%
275% The format of the GetCacheViewColorspace method is:
276%
277% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
278%
279% A description of each parameter follows:
280%
281% o cache_view: the cache view.
282%
283*/
284MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
285{
286 assert(cache_view != (CacheView *) NULL);
287 assert(cache_view->signature == MagickSignature);
288 if (cache_view->debug != MagickFalse)
289 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
290 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000291 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000292}
293
294/*
295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296% %
297% %
298% %
cristy3ed852e2009-09-05 21:47:34 +0000299+ G e t C a c h e V i e w E x t e n t %
300% %
301% %
302% %
303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304%
305% GetCacheViewExtent() returns the extent of the pixels associated with the
306% last call to QueueCacheViewAuthenticPixels() or
307% GetCacheViewAuthenticPixels().
308%
309% The format of the GetCacheViewExtent() method is:
310%
311% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
312%
313% A description of each parameter follows:
314%
315% o cache_view: the cache view.
316%
317*/
318MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
319{
cristy5c9e6f22010-09-17 17:31:01 +0000320 const int
321 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000322
cristy4c08aed2011-07-01 19:47:50 +0000323 MagickSizeType
324 extent;
325
cristy3ed852e2009-09-05 21:47:34 +0000326 assert(cache_view != (CacheView *) NULL);
327 assert(cache_view->signature == MagickSignature);
328 if (cache_view->debug != MagickFalse)
329 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
330 cache_view->image->filename);
331 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000332 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000333 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
334 cache_view->nexus_info[id]);
335 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000336}
337
338/*
339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340% %
341% %
342% %
343% G e t C a c h e V i e w S t o r a g e C l a s s %
344% %
345% %
346% %
347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348%
349% GetCacheViewStorageClass() returns the image storage class associated with
350% the specified view.
351%
352% The format of the GetCacheViewStorageClass method is:
353%
354% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
355%
356% A description of each parameter follows:
357%
358% o cache_view: the cache view.
359%
360*/
361MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
362{
363 assert(cache_view != (CacheView *) NULL);
364 assert(cache_view->signature == MagickSignature);
365 if (cache_view->debug != MagickFalse)
366 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
367 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000368 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000369}
370
371/*
372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
373% %
374% %
375% %
376% 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 %
377% %
378% %
379% %
380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
381%
382% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
383% cache as defined by the geometry parameters. A pointer to the pixels is
384% returned if the pixels are transferred, otherwise a NULL is returned.
385%
386% The format of the GetCacheViewAuthenticPixels method is:
387%
cristy4c08aed2011-07-01 19:47:50 +0000388% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000389% const ssize_t x,const ssize_t y,const size_t columns,
390% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000391%
392% A description of each parameter follows:
393%
394% o cache_view: the cache view.
395%
396% o x,y,columns,rows: These values define the perimeter of a region of
397% pixels.
398%
cristydb070952012-04-20 14:33:00 +0000399% o exception: return any errors or warnings in this structure.
400%
cristy3ed852e2009-09-05 21:47:34 +0000401*/
cristy4c08aed2011-07-01 19:47:50 +0000402MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000403 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
404 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000405{
cristy5c9e6f22010-09-17 17:31:01 +0000406 const int
407 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000408
cristy4c08aed2011-07-01 19:47:50 +0000409 Quantum
cristy3ed852e2009-09-05 21:47:34 +0000410 *pixels;
411
412 assert(cache_view != (CacheView *) NULL);
413 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000414 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000415 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
cristy3ed852e2009-09-05 21:47:34 +0000416 cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +0000417 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000418}
419
420/*
421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
422% %
423% %
424% %
cristy4c08aed2011-07-01 19:47:50 +0000425% 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 +0000426% %
427% %
428% %
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430%
cristy4c08aed2011-07-01 19:47:50 +0000431% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
432% with the last call to SetCacheViewIndexes() or
433% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
434% be updated.
cristy3ed852e2009-09-05 21:47:34 +0000435%
cristy4c08aed2011-07-01 19:47:50 +0000436% The format of the GetCacheViewAuthenticMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000437%
cristy4c08aed2011-07-01 19:47:50 +0000438% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000439%
440% A description of each parameter follows:
441%
442% o cache_view: the cache view.
443%
444*/
cristy4c08aed2011-07-01 19:47:50 +0000445MagickExport void *GetCacheViewAuthenticMetacontent(
446 CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000447{
cristy5c9e6f22010-09-17 17:31:01 +0000448 const int
449 id = GetOpenMPThreadId();
450
cristy4c08aed2011-07-01 19:47:50 +0000451 void
452 *metacontent;
453
cristy3ed852e2009-09-05 21:47:34 +0000454 assert(cache_view != (CacheView *) NULL);
455 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000456 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000457 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000458 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
459 cache_view->nexus_info[id]);
460 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000461}
462
463/*
464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
465% %
466% %
467% %
468% 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 %
469% %
470% %
471% %
472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473%
474% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
475% last call to QueueCacheViewAuthenticPixels() or
476% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
477% updated.
478%
479% The format of the GetCacheViewAuthenticPixelQueue() method is:
480%
cristy4c08aed2011-07-01 19:47:50 +0000481% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000482%
483% A description of each parameter follows:
484%
485% o cache_view: the cache view.
486%
487*/
cristy4c08aed2011-07-01 19:47:50 +0000488MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
cristy3ed852e2009-09-05 21:47:34 +0000489{
cristy5c9e6f22010-09-17 17:31:01 +0000490 const int
491 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000492
cristy4c08aed2011-07-01 19:47:50 +0000493 Quantum
494 *pixels;
495
cristy3ed852e2009-09-05 21:47:34 +0000496 assert(cache_view != (CacheView *) NULL);
497 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000498 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000499 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000500 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
501 cache_view->nexus_info[id]);
502 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000503}
504
505/*
506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507% %
508% %
509% %
cristy4c08aed2011-07-01 19:47:50 +0000510% 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 +0000511% %
512% %
513% %
514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
515%
cristy4c08aed2011-07-01 19:47:50 +0000516% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
517% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
518% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000519%
cristy4c08aed2011-07-01 19:47:50 +0000520% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000521%
cristy4c08aed2011-07-01 19:47:50 +0000522% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000523% const CacheView *cache_view)
524%
525% A description of each parameter follows:
526%
527% o cache_view: the cache view.
528%
529*/
cristy4c08aed2011-07-01 19:47:50 +0000530MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000531 const CacheView *cache_view)
532{
cristy5c9e6f22010-09-17 17:31:01 +0000533 const int
534 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000535
cristy4c08aed2011-07-01 19:47:50 +0000536 const void
537 *metacontent;
538
cristy3ed852e2009-09-05 21:47:34 +0000539 assert(cache_view != (const CacheView *) NULL);
540 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000541 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000542 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000543 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
544 cache_view->nexus_info[id]);
545 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000546}
547
548/*
549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550% %
551% %
552% %
553% 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 %
554% %
555% %
556% %
557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
558%
559% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
560% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
561% and therefore cannot be updated.
562%
563% The format of the GetCacheViewVirtualPixelQueue() method is:
564%
cristy4c08aed2011-07-01 19:47:50 +0000565% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000566% const CacheView *cache_view)
567%
568% A description of each parameter follows:
569%
570% o cache_view: the cache view.
571%
572*/
cristy4c08aed2011-07-01 19:47:50 +0000573MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000574 const CacheView *cache_view)
575{
cristy5c9e6f22010-09-17 17:31:01 +0000576 const int
577 id = GetOpenMPThreadId();
578
cristy4c08aed2011-07-01 19:47:50 +0000579 const Quantum
580 *pixels;
581
cristy3ed852e2009-09-05 21:47:34 +0000582 assert(cache_view != (const CacheView *) NULL);
583 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000584 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000585 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000586 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
587 cache_view->nexus_info[id]);
588 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000589}
590
591/*
592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
593% %
594% %
595% %
596% 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 %
597% %
598% %
599% %
600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
601%
602% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
603% disk pixel cache as defined by the geometry parameters. A pointer to the
604% pixels is returned if the pixels are transferred, otherwise a NULL is
605% returned.
606%
607% The format of the GetCacheViewVirtualPixels method is:
608%
cristy4c08aed2011-07-01 19:47:50 +0000609% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000610% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000611% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000612%
613% A description of each parameter follows:
614%
615% o cache_view: the cache view.
616%
617% o x,y,columns,rows: These values define the perimeter of a region of
618% pixels.
619%
620% o exception: return any errors or warnings in this structure.
621%
622*/
cristy4c08aed2011-07-01 19:47:50 +0000623MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000624 const CacheView *cache_view,const ssize_t x,const ssize_t y,
625 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000626{
cristy5c9e6f22010-09-17 17:31:01 +0000627 const int
628 id = GetOpenMPThreadId();
629
cristy4c08aed2011-07-01 19:47:50 +0000630 const Quantum
631 *pixels;
632
cristy3ed852e2009-09-05 21:47:34 +0000633 assert(cache_view != (CacheView *) NULL);
634 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000635 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000636 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000637 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000638 cache_view->nexus_info[id],exception);
639 return(pixels);
640}
641
642/*
643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
644% %
645% %
646% %
647% 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 %
648% %
649% %
650% %
651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
652%
653% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
654% location. The image background color is returned if an error occurs.
655%
656% The format of the GetOneCacheViewAuthenticPixel method is:
657%
658% MagickBooleaNType GetOneCacheViewAuthenticPixel(
659% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000660% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000661%
662% A description of each parameter follows:
663%
664% o cache_view: the cache view.
665%
666% o x,y: These values define the offset of the pixel.
667%
668% o pixel: return a pixel at the specified (x,y) location.
669%
670% o exception: return any errors or warnings in this structure.
671%
672*/
673MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000674 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
675 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000676{
677 const int
678 id = GetOpenMPThreadId();
679
680 Quantum
681 *p;
682
cristy2ed42f62011-10-02 19:49:57 +0000683 register ssize_t
684 i;
685
cristy4c08aed2011-07-01 19:47:50 +0000686 assert(cache_view != (CacheView *) NULL);
687 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000688 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000689 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000690 p=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
691 cache_view->nexus_info[id],exception);
692 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000693 {
cristyd09f8802012-02-04 16:44:10 +0000694 PixelInfo
695 background_color;
696
697 background_color=cache_view->image->background_color;
698 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
699 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
700 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
701 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
702 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000703 return(MagickFalse);
704 }
705 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
706 {
707 PixelChannel
708 channel;
709
cristye2a912b2011-12-05 20:02:07 +0000710 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000711 pixel[channel]=p[i];
712 }
cristy4c08aed2011-07-01 19:47:50 +0000713 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000714}
715
716/*
717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
718% %
719% %
720% %
721% 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 %
722% %
723% %
724% %
725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
726%
727% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
728% location. The image background color is returned if an error occurs. If
729% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
730%
731% The format of the GetOneCacheViewVirtualPixel method is:
732%
733% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000734% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000735% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000736%
737% A description of each parameter follows:
738%
739% o cache_view: the cache view.
740%
741% o x,y: These values define the offset of the pixel.
742%
743% o pixel: return a pixel at the specified (x,y) location.
744%
745% o exception: return any errors or warnings in this structure.
746%
747*/
748MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000749 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
750 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000751{
cristy5c9e6f22010-09-17 17:31:01 +0000752 const int
753 id = GetOpenMPThreadId();
754
cristyf05d4942012-03-17 16:26:09 +0000755 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000756 *p;
cristy3ed852e2009-09-05 21:47:34 +0000757
cristy2ed42f62011-10-02 19:49:57 +0000758 register ssize_t
759 i;
760
cristy3ed852e2009-09-05 21:47:34 +0000761 assert(cache_view != (CacheView *) NULL);
762 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000763 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000764 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000765 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000766 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
767 exception);
cristy4c08aed2011-07-01 19:47:50 +0000768 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000769 {
cristyd09f8802012-02-04 16:44:10 +0000770 PixelInfo
771 background_color;
772
773 background_color=cache_view->image->background_color;
774 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
775 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
776 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
777 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
778 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000779 return(MagickFalse);
780 }
781 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
782 {
783 PixelChannel
784 channel;
785
cristye2a912b2011-12-05 20:02:07 +0000786 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000787 pixel[channel]=p[i];
788 }
cristy3ed852e2009-09-05 21:47:34 +0000789 return(MagickTrue);
790}
791
792/*
793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
794% %
795% %
796% %
cristyf05d4942012-03-17 16:26:09 +0000797% 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 %
798% %
799% %
800% %
801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
802%
803% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
804% (x,y) location. The image background color is returned if an error occurs.
805% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
806%
807% The format of the GetOneCacheViewVirtualPixelInfo method is:
808%
809% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
810% const CacheView *cache_view,const ssize_t x,const ssize_t y,
811% PixelInfo *pixel,ExceptionInfo *exception)
812%
813% A description of each parameter follows:
814%
815% o cache_view: the cache view.
816%
817% o x,y: These values define the offset of the pixel.
818%
819% o pixel: return a pixel at the specified (x,y) location.
820%
821% o exception: return any errors or warnings in this structure.
822%
823*/
824MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
825 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
826 ExceptionInfo *exception)
827{
828 const int
829 id = GetOpenMPThreadId();
830
831 register const Quantum
832 *p;
833
834 assert(cache_view != (CacheView *) NULL);
835 assert(cache_view->signature == MagickSignature);
836 assert(id < (int) cache_view->number_threads);
cristyf82cff82012-04-16 16:54:17 +0000837 GetPixelInfo(cache_view->image,pixel);
cristyf05d4942012-03-17 16:26:09 +0000838 p=GetVirtualPixelsFromNexus(cache_view->image,
839 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
840 exception);
cristyf05d4942012-03-17 16:26:09 +0000841 if (p == (const Quantum *) NULL)
842 return(MagickFalse);
843 GetPixelInfoPixel(cache_view->image,p,pixel);
844 return(MagickTrue);
845}
846
847/*
848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
849% %
850% %
851% %
cristy3ed852e2009-09-05 21:47:34 +0000852% 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 %
853% %
854% %
855% %
856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
857%
858% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
859% the specified (x,y) location. The image background color is returned if an
860% error occurs. If you plan to modify the pixel, use
861% GetOneCacheViewAuthenticPixel() instead.
862%
863% The format of the GetOneCacheViewVirtualPixel method is:
864%
865% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
866% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000867% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000868% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000869%
870% A description of each parameter follows:
871%
872% o cache_view: the cache view.
873%
874% o virtual_pixel_method: the virtual pixel method.
875%
876% o x,y: These values define the offset of the pixel.
877%
878% o pixel: return a pixel at the specified (x,y) location.
879%
880% o exception: return any errors or warnings in this structure.
881%
882*/
883MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
884 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000885 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000886{
cristy5c9e6f22010-09-17 17:31:01 +0000887 const int
888 id = GetOpenMPThreadId();
889
cristy4c08aed2011-07-01 19:47:50 +0000890 const Quantum
891 *p;
cristy3ed852e2009-09-05 21:47:34 +0000892
cristy2ed42f62011-10-02 19:49:57 +0000893 register ssize_t
894 i;
895
cristy3ed852e2009-09-05 21:47:34 +0000896 assert(cache_view != (CacheView *) NULL);
897 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000898 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000899 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000900 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
901 cache_view->nexus_info[id],exception);
902 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000903 {
cristyd09f8802012-02-04 16:44:10 +0000904 PixelInfo
905 background_color;
906
907 background_color=cache_view->image->background_color;
908 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
909 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
910 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
911 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
912 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000913 return(MagickFalse);
914 }
915 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
916 {
917 PixelChannel
918 channel;
919
cristye2a912b2011-12-05 20:02:07 +0000920 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000921 pixel[channel]=p[i];
922 }
cristy3ed852e2009-09-05 21:47:34 +0000923 return(MagickTrue);
924}
925
926/*
927%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
928% %
929% %
930% %
931% 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 %
932% %
933% %
934% %
935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
936%
937% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
938% disk pixel cache as defined by the geometry parameters. A pointer to the
939% pixels is returned if the pixels are transferred, otherwise a NULL is
940% returned.
941%
942% The format of the QueueCacheViewAuthenticPixels method is:
943%
cristy4c08aed2011-07-01 19:47:50 +0000944% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000945% const ssize_t x,const ssize_t y,const size_t columns,
946% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000947%
948% A description of each parameter follows:
949%
950% o cache_view: the cache view.
951%
952% o x,y,columns,rows: These values define the perimeter of a region of
953% pixels.
954%
955% o exception: return any errors or warnings in this structure.
956%
957*/
cristy4c08aed2011-07-01 19:47:50 +0000958MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000959 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
960 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000961{
cristy5c9e6f22010-09-17 17:31:01 +0000962 const int
963 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000964
cristy4c08aed2011-07-01 19:47:50 +0000965 Quantum
966 *pixels;
967
cristy3ed852e2009-09-05 21:47:34 +0000968 assert(cache_view != (CacheView *) NULL);
969 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000970 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +0000971 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
972 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +0000973 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000974}
975
976/*
977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
978% %
979% %
980% %
981% S e t C a c h e V i e w S t o r a g e C l a s s %
982% %
983% %
984% %
985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
986%
987% SetCacheViewStorageClass() sets the image storage class associated with
988% the specified view.
989%
990% The format of the SetCacheViewStorageClass method is:
991%
992% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +0000993% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000994%
995% A description of each parameter follows:
996%
997% o cache_view: the cache view.
998%
999% o storage_class: the image storage class: PseudoClass or DirectClass.
1000%
cristyc82a27b2011-10-21 01:07:16 +00001001% o exception: return any errors or warnings in this structure.
1002%
cristy3ed852e2009-09-05 21:47:34 +00001003*/
1004MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001005 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001006{
1007 assert(cache_view != (CacheView *) NULL);
1008 assert(cache_view->signature == MagickSignature);
1009 if (cache_view->debug != MagickFalse)
1010 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1011 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +00001012 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +00001013}
1014
1015/*
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017% %
1018% %
1019% %
1020% 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 %
1021% %
1022% %
1023% %
1024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025%
1026% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1027% with the specified cache view.
1028%
1029% The format of the SetCacheViewVirtualPixelMethod method is:
1030%
1031% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1032% const VirtualPixelMethod virtual_pixel_method)
1033%
1034% A description of each parameter follows:
1035%
1036% o cache_view: the cache view.
1037%
1038% o virtual_pixel_method: the virtual pixel method.
1039%
1040*/
1041MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1042 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
1043{
1044 assert(cache_view != (CacheView *) NULL);
1045 assert(cache_view->signature == MagickSignature);
1046 if (cache_view->debug != MagickFalse)
1047 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1048 cache_view->image->filename);
1049 cache_view->virtual_pixel_method=virtual_pixel_method;
1050 return(MagickTrue);
1051}
1052
1053/*
1054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1055% %
1056% %
1057% %
1058% 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 %
1059% %
1060% %
1061% %
1062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1063%
1064% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1065% or disk cache. It returns MagickTrue if the pixel region is flushed,
1066% otherwise MagickFalse.
1067%
1068% The format of the SyncCacheViewAuthenticPixels method is:
1069%
1070% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1071% ExceptionInfo *exception)
1072%
1073% A description of each parameter follows:
1074%
1075% o cache_view: the cache view.
1076%
1077% o exception: return any errors or warnings in this structure.
1078%
1079*/
1080MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1081 CacheView *cache_view,ExceptionInfo *exception)
1082{
cristy5c9e6f22010-09-17 17:31:01 +00001083 const int
1084 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001085
cristy4c08aed2011-07-01 19:47:50 +00001086 MagickBooleanType
1087 status;
1088
cristy3ed852e2009-09-05 21:47:34 +00001089 assert(cache_view != (CacheView *) NULL);
1090 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001091 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001092 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1093 cache_view->nexus_info[id],exception);
1094 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001095}