blob: 70b695536ac32542166e389400d05e02a1cdc071 [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% %
cristye7516622012-04-29 14:22:45 +0000266% 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 %
267% %
268% %
269% %
270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271%
272% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
273% cache as defined by the geometry parameters. A pointer to the pixels is
274% returned if the pixels are transferred, otherwise a NULL is returned.
275%
276% The format of the GetCacheViewAuthenticPixels method is:
277%
278% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
279% const ssize_t x,const ssize_t y,const size_t columns,
280% const size_t rows,ExceptionInfo *exception)
281%
282% A description of each parameter follows:
283%
284% o cache_view: the cache view.
285%
286% o x,y,columns,rows: These values define the perimeter of a region of
287% pixels.
288%
289% o exception: return any errors or warnings in this structure.
290%
291*/
292MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
293 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
294 ExceptionInfo *exception)
295{
296 const int
297 id = GetOpenMPThreadId();
298
299 Quantum
300 *pixels;
301
302 assert(cache_view != (CacheView *) NULL);
303 assert(cache_view->signature == MagickSignature);
304 assert(id < (int) cache_view->number_threads);
305 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
306 cache_view->nexus_info[id],exception);
307 return(pixels);
308}
309
310/*
311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312% %
313% %
314% %
315% 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 %
316% %
317% %
318% %
319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
320%
321% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
322% with the last call to SetCacheViewIndexes() or
323% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
324% be updated.
325%
326% The format of the GetCacheViewAuthenticMetacontent() method is:
327%
328% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
329%
330% A description of each parameter follows:
331%
332% o cache_view: the cache view.
333%
334*/
335MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
336{
337 const int
338 id = GetOpenMPThreadId();
339
340 void
341 *metacontent;
342
343 assert(cache_view != (CacheView *) NULL);
344 assert(cache_view->signature == MagickSignature);
345 assert(cache_view->image->cache != (Cache) NULL);
346 assert(id < (int) cache_view->number_threads);
347 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
348 cache_view->nexus_info[id]);
349 return(metacontent);
350}
351
352/*
353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
354% %
355% %
356% %
357% 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 %
358% %
359% %
360% %
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362%
363% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
364% last call to QueueCacheViewAuthenticPixels() or
365% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
366% updated.
367%
368% The format of the GetCacheViewAuthenticPixelQueue() method is:
369%
370% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
371%
372% A description of each parameter follows:
373%
374% o cache_view: the cache view.
375%
376*/
377MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
378{
379 const int
380 id = GetOpenMPThreadId();
381
382 Quantum
383 *pixels;
384
385 assert(cache_view != (CacheView *) NULL);
386 assert(cache_view->signature == MagickSignature);
387 assert(cache_view->image->cache != (Cache) NULL);
388 assert(id < (int) cache_view->number_threads);
389 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
390 cache_view->nexus_info[id]);
391 return(pixels);
392}
393
394/*
395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396% %
397% %
398% %
cristy3ed852e2009-09-05 21:47:34 +0000399% G e t C a c h e V i e w C o l o r s p a c e %
400% %
401% %
402% %
403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404%
405% GetCacheViewColorspace() returns the image colorspace associated with the
406% specified view.
407%
408% The format of the GetCacheViewColorspace method is:
409%
410% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
411%
412% A description of each parameter follows:
413%
414% o cache_view: the cache view.
415%
416*/
417MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
418{
419 assert(cache_view != (CacheView *) NULL);
420 assert(cache_view->signature == MagickSignature);
421 if (cache_view->debug != MagickFalse)
422 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
423 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000424 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000425}
426
427/*
428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429% %
430% %
431% %
cristy3ed852e2009-09-05 21:47:34 +0000432+ G e t C a c h e V i e w E x t e n t %
433% %
434% %
435% %
436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437%
438% GetCacheViewExtent() returns the extent of the pixels associated with the
439% last call to QueueCacheViewAuthenticPixels() or
440% GetCacheViewAuthenticPixels().
441%
442% The format of the GetCacheViewExtent() method is:
443%
444% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
445%
446% A description of each parameter follows:
447%
448% o cache_view: the cache view.
449%
450*/
451MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
452{
cristy5c9e6f22010-09-17 17:31:01 +0000453 const int
454 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000455
cristy4c08aed2011-07-01 19:47:50 +0000456 MagickSizeType
457 extent;
458
cristy3ed852e2009-09-05 21:47:34 +0000459 assert(cache_view != (CacheView *) NULL);
460 assert(cache_view->signature == MagickSignature);
461 if (cache_view->debug != MagickFalse)
462 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
463 cache_view->image->filename);
464 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000465 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000466 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
467 cache_view->nexus_info[id]);
468 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000469}
470
471/*
472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473% %
474% %
475% %
cristye7516622012-04-29 14:22:45 +0000476% G e t C a c h e V i e w I m a g e %
477% %
478% %
479% %
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481%
482% GetCacheViewImage() returns the image associated with the specified view.
483%
484% The format of the GetCacheViewImage method is:
485%
486% const Image *GetCacheViewImage(const CacheView *cache_view)
487%
488% A description of each parameter follows:
489%
490% o cache_view: the cache view.
491%
492*/
493MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
494{
495 assert(cache_view != (CacheView *) NULL);
496 assert(cache_view->signature == MagickSignature);
497 if (cache_view->debug != MagickFalse)
498 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
499 cache_view->image->filename);
500 return(cache_view->image);
501}
502
503/*
504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
505% %
506% %
507% %
cristy3ed852e2009-09-05 21:47:34 +0000508% G e t C a c h e V i e w S t o r a g e C l a s s %
509% %
510% %
511% %
512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513%
cristye7516622012-04-29 14:22:45 +0000514% GetCacheViewStorageClass() returns the image storage class associated with
cristy3ed852e2009-09-05 21:47:34 +0000515% the specified view.
516%
517% The format of the GetCacheViewStorageClass method is:
518%
519% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
520%
521% A description of each parameter follows:
522%
523% o cache_view: the cache view.
524%
525*/
526MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
527{
528 assert(cache_view != (CacheView *) NULL);
529 assert(cache_view->signature == MagickSignature);
530 if (cache_view->debug != MagickFalse)
531 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
532 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000533 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000534}
535
536/*
537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
538% %
539% %
540% %
cristy4c08aed2011-07-01 19:47:50 +0000541% 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 +0000542% %
543% %
544% %
545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
546%
cristy4c08aed2011-07-01 19:47:50 +0000547% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
548% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
549% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000550%
cristy4c08aed2011-07-01 19:47:50 +0000551% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000552%
cristy4c08aed2011-07-01 19:47:50 +0000553% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000554% const CacheView *cache_view)
555%
556% A description of each parameter follows:
557%
558% o cache_view: the cache view.
559%
560*/
cristy4c08aed2011-07-01 19:47:50 +0000561MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000562 const CacheView *cache_view)
563{
cristy5c9e6f22010-09-17 17:31:01 +0000564 const int
565 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000566
cristy4c08aed2011-07-01 19:47:50 +0000567 const void
568 *metacontent;
569
cristy3ed852e2009-09-05 21:47:34 +0000570 assert(cache_view != (const CacheView *) NULL);
571 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000572 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000573 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000574 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
575 cache_view->nexus_info[id]);
576 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000577}
578
579/*
580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581% %
582% %
583% %
584% 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 %
585% %
586% %
587% %
588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589%
590% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
591% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
592% and therefore cannot be updated.
593%
594% The format of the GetCacheViewVirtualPixelQueue() method is:
595%
cristy4c08aed2011-07-01 19:47:50 +0000596% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000597% const CacheView *cache_view)
598%
599% A description of each parameter follows:
600%
601% o cache_view: the cache view.
602%
603*/
cristy4c08aed2011-07-01 19:47:50 +0000604MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000605 const CacheView *cache_view)
606{
cristy5c9e6f22010-09-17 17:31:01 +0000607 const int
608 id = GetOpenMPThreadId();
609
cristy4c08aed2011-07-01 19:47:50 +0000610 const Quantum
611 *pixels;
612
cristy3ed852e2009-09-05 21:47:34 +0000613 assert(cache_view != (const CacheView *) NULL);
614 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000615 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000616 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000617 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
618 cache_view->nexus_info[id]);
619 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000620}
621
622/*
623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
624% %
625% %
626% %
627% 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 %
628% %
629% %
630% %
631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632%
633% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
634% disk pixel cache as defined by the geometry parameters. A pointer to the
635% pixels is returned if the pixels are transferred, otherwise a NULL is
636% returned.
637%
638% The format of the GetCacheViewVirtualPixels method is:
639%
cristy4c08aed2011-07-01 19:47:50 +0000640% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000641% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000642% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000643%
644% A description of each parameter follows:
645%
646% o cache_view: the cache view.
647%
648% o x,y,columns,rows: These values define the perimeter of a region of
649% pixels.
650%
651% o exception: return any errors or warnings in this structure.
652%
653*/
cristy4c08aed2011-07-01 19:47:50 +0000654MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000655 const CacheView *cache_view,const ssize_t x,const ssize_t y,
656 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000657{
cristy5c9e6f22010-09-17 17:31:01 +0000658 const int
659 id = GetOpenMPThreadId();
660
cristy4c08aed2011-07-01 19:47:50 +0000661 const Quantum
662 *pixels;
663
cristy3ed852e2009-09-05 21:47:34 +0000664 assert(cache_view != (CacheView *) NULL);
665 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000666 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000667 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000668 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000669 cache_view->nexus_info[id],exception);
670 return(pixels);
671}
672
673/*
674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
675% %
676% %
677% %
678% 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 %
679% %
680% %
681% %
682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
683%
684% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
685% location. The image background color is returned if an error occurs.
686%
687% The format of the GetOneCacheViewAuthenticPixel method is:
688%
689% MagickBooleaNType GetOneCacheViewAuthenticPixel(
690% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000691% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000692%
693% A description of each parameter follows:
694%
695% o cache_view: the cache view.
696%
697% o x,y: These values define the offset of the pixel.
698%
699% o pixel: return a pixel at the specified (x,y) location.
700%
701% o exception: return any errors or warnings in this structure.
702%
703*/
704MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000705 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
706 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000707{
708 const int
709 id = GetOpenMPThreadId();
710
711 Quantum
712 *p;
713
cristy2ed42f62011-10-02 19:49:57 +0000714 register ssize_t
715 i;
716
cristy4c08aed2011-07-01 19:47:50 +0000717 assert(cache_view != (CacheView *) NULL);
718 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000719 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000720 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000721 p=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
722 cache_view->nexus_info[id],exception);
723 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000724 {
cristyd09f8802012-02-04 16:44:10 +0000725 PixelInfo
726 background_color;
727
728 background_color=cache_view->image->background_color;
729 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
730 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
731 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
732 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
733 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000734 return(MagickFalse);
735 }
736 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
737 {
738 PixelChannel
739 channel;
740
cristye2a912b2011-12-05 20:02:07 +0000741 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000742 pixel[channel]=p[i];
743 }
cristy4c08aed2011-07-01 19:47:50 +0000744 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000745}
746
747/*
748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749% %
750% %
751% %
752% 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 %
753% %
754% %
755% %
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757%
758% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
759% location. The image background color is returned if an error occurs. If
760% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
761%
762% The format of the GetOneCacheViewVirtualPixel method is:
763%
764% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000765% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000766% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000767%
768% A description of each parameter follows:
769%
770% o cache_view: the cache view.
771%
772% o x,y: These values define the offset of the pixel.
773%
774% o pixel: return a pixel at the specified (x,y) location.
775%
776% o exception: return any errors or warnings in this structure.
777%
778*/
779MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000780 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
781 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000782{
cristy5c9e6f22010-09-17 17:31:01 +0000783 const int
784 id = GetOpenMPThreadId();
785
cristyf05d4942012-03-17 16:26:09 +0000786 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000787 *p;
cristy3ed852e2009-09-05 21:47:34 +0000788
cristy2ed42f62011-10-02 19:49:57 +0000789 register ssize_t
790 i;
791
cristy3ed852e2009-09-05 21:47:34 +0000792 assert(cache_view != (CacheView *) NULL);
793 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000794 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000795 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000796 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000797 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
798 exception);
cristy4c08aed2011-07-01 19:47:50 +0000799 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000800 {
cristyd09f8802012-02-04 16:44:10 +0000801 PixelInfo
802 background_color;
803
804 background_color=cache_view->image->background_color;
805 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
806 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
807 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
808 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
809 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000810 return(MagickFalse);
811 }
812 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
813 {
814 PixelChannel
815 channel;
816
cristye2a912b2011-12-05 20:02:07 +0000817 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000818 pixel[channel]=p[i];
819 }
cristy3ed852e2009-09-05 21:47:34 +0000820 return(MagickTrue);
821}
822
823/*
824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
825% %
826% %
827% %
cristyf05d4942012-03-17 16:26:09 +0000828% 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 %
829% %
830% %
831% %
832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
833%
834% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
835% (x,y) location. The image background color is returned if an error occurs.
836% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
837%
838% The format of the GetOneCacheViewVirtualPixelInfo method is:
839%
840% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
841% const CacheView *cache_view,const ssize_t x,const ssize_t y,
842% PixelInfo *pixel,ExceptionInfo *exception)
843%
844% A description of each parameter follows:
845%
846% o cache_view: the cache view.
847%
848% o x,y: These values define the offset of the pixel.
849%
850% o pixel: return a pixel at the specified (x,y) location.
851%
852% o exception: return any errors or warnings in this structure.
853%
854*/
855MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
856 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
857 ExceptionInfo *exception)
858{
859 const int
860 id = GetOpenMPThreadId();
861
862 register const Quantum
863 *p;
864
865 assert(cache_view != (CacheView *) NULL);
866 assert(cache_view->signature == MagickSignature);
867 assert(id < (int) cache_view->number_threads);
cristyf82cff82012-04-16 16:54:17 +0000868 GetPixelInfo(cache_view->image,pixel);
cristyf05d4942012-03-17 16:26:09 +0000869 p=GetVirtualPixelsFromNexus(cache_view->image,
870 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
871 exception);
cristyf05d4942012-03-17 16:26:09 +0000872 if (p == (const Quantum *) NULL)
873 return(MagickFalse);
874 GetPixelInfoPixel(cache_view->image,p,pixel);
875 return(MagickTrue);
876}
877
878/*
879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
880% %
881% %
882% %
cristy3ed852e2009-09-05 21:47:34 +0000883% 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 %
884% %
885% %
886% %
887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888%
889% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
890% the specified (x,y) location. The image background color is returned if an
891% error occurs. If you plan to modify the pixel, use
892% GetOneCacheViewAuthenticPixel() instead.
893%
894% The format of the GetOneCacheViewVirtualPixel method is:
895%
896% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
897% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000898% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000899% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000900%
901% A description of each parameter follows:
902%
903% o cache_view: the cache view.
904%
905% o virtual_pixel_method: the virtual pixel method.
906%
907% o x,y: These values define the offset of the pixel.
908%
909% o pixel: return a pixel at the specified (x,y) location.
910%
911% o exception: return any errors or warnings in this structure.
912%
913*/
914MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
915 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000916 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000917{
cristy5c9e6f22010-09-17 17:31:01 +0000918 const int
919 id = GetOpenMPThreadId();
920
cristy4c08aed2011-07-01 19:47:50 +0000921 const Quantum
922 *p;
cristy3ed852e2009-09-05 21:47:34 +0000923
cristy2ed42f62011-10-02 19:49:57 +0000924 register ssize_t
925 i;
926
cristy3ed852e2009-09-05 21:47:34 +0000927 assert(cache_view != (CacheView *) NULL);
928 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000929 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000930 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000931 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
932 cache_view->nexus_info[id],exception);
933 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000934 {
cristyd09f8802012-02-04 16:44:10 +0000935 PixelInfo
936 background_color;
937
938 background_color=cache_view->image->background_color;
939 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
940 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
941 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
942 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
943 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000944 return(MagickFalse);
945 }
946 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
947 {
948 PixelChannel
949 channel;
950
cristye2a912b2011-12-05 20:02:07 +0000951 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000952 pixel[channel]=p[i];
953 }
cristy3ed852e2009-09-05 21:47:34 +0000954 return(MagickTrue);
955}
956
957/*
958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
959% %
960% %
961% %
962% 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 %
963% %
964% %
965% %
966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
967%
968% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
969% disk pixel cache as defined by the geometry parameters. A pointer to the
970% pixels is returned if the pixels are transferred, otherwise a NULL is
971% returned.
972%
973% The format of the QueueCacheViewAuthenticPixels method is:
974%
cristy4c08aed2011-07-01 19:47:50 +0000975% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000976% const ssize_t x,const ssize_t y,const size_t columns,
977% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000978%
979% A description of each parameter follows:
980%
981% o cache_view: the cache view.
982%
983% o x,y,columns,rows: These values define the perimeter of a region of
984% pixels.
985%
986% o exception: return any errors or warnings in this structure.
987%
988*/
cristy4c08aed2011-07-01 19:47:50 +0000989MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000990 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
991 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000992{
cristy5c9e6f22010-09-17 17:31:01 +0000993 const int
994 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000995
cristy4c08aed2011-07-01 19:47:50 +0000996 Quantum
997 *pixels;
998
cristy3ed852e2009-09-05 21:47:34 +0000999 assert(cache_view != (CacheView *) NULL);
1000 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001001 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +00001002 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
1003 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +00001004 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +00001005}
1006
1007/*
1008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1009% %
1010% %
1011% %
1012% S e t C a c h e V i e w S t o r a g e C l a s s %
1013% %
1014% %
1015% %
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017%
1018% SetCacheViewStorageClass() sets the image storage class associated with
1019% the specified view.
1020%
1021% The format of the SetCacheViewStorageClass method is:
1022%
1023% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001024% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001025%
1026% A description of each parameter follows:
1027%
1028% o cache_view: the cache view.
1029%
1030% o storage_class: the image storage class: PseudoClass or DirectClass.
1031%
cristyc82a27b2011-10-21 01:07:16 +00001032% o exception: return any errors or warnings in this structure.
1033%
cristy3ed852e2009-09-05 21:47:34 +00001034*/
1035MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001036 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001037{
1038 assert(cache_view != (CacheView *) NULL);
1039 assert(cache_view->signature == MagickSignature);
1040 if (cache_view->debug != MagickFalse)
1041 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1042 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +00001043 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +00001044}
1045
1046/*
1047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1048% %
1049% %
1050% %
1051% 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 %
1052% %
1053% %
1054% %
1055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1056%
1057% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1058% with the specified cache view.
1059%
1060% The format of the SetCacheViewVirtualPixelMethod method is:
1061%
1062% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1063% const VirtualPixelMethod virtual_pixel_method)
1064%
1065% A description of each parameter follows:
1066%
1067% o cache_view: the cache view.
1068%
1069% o virtual_pixel_method: the virtual pixel method.
1070%
1071*/
1072MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1073 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
1074{
1075 assert(cache_view != (CacheView *) NULL);
1076 assert(cache_view->signature == MagickSignature);
1077 if (cache_view->debug != MagickFalse)
1078 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1079 cache_view->image->filename);
1080 cache_view->virtual_pixel_method=virtual_pixel_method;
1081 return(MagickTrue);
1082}
1083
1084/*
1085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1086% %
1087% %
1088% %
1089% 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 %
1090% %
1091% %
1092% %
1093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1094%
1095% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1096% or disk cache. It returns MagickTrue if the pixel region is flushed,
1097% otherwise MagickFalse.
1098%
1099% The format of the SyncCacheViewAuthenticPixels method is:
1100%
1101% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1102% ExceptionInfo *exception)
1103%
1104% A description of each parameter follows:
1105%
1106% o cache_view: the cache view.
1107%
1108% o exception: return any errors or warnings in this structure.
1109%
1110*/
1111MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1112 CacheView *cache_view,ExceptionInfo *exception)
1113{
cristy5c9e6f22010-09-17 17:31:01 +00001114 const int
1115 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001116
cristy4c08aed2011-07-01 19:47:50 +00001117 MagickBooleanType
1118 status;
1119
cristy3ed852e2009-09-05 21:47:34 +00001120 assert(cache_view != (CacheView *) NULL);
1121 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001122 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001123 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1124 cache_view->nexus_info[id],exception);
1125 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001126}