blob: 00fef6ae8d649c3534e6189dfea00918c46c3f57 [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"
cristye42639a2012-08-23 01:53:24 +000054#include "MagickCore/memory-private.h"
cristy4c08aed2011-07-01 19:47:50 +000055#include "MagickCore/exception.h"
56#include "MagickCore/exception-private.h"
57#include "MagickCore/pixel-accessor.h"
cristyac245f82012-05-05 17:13:57 +000058#include "MagickCore/resource_.h"
cristy4c08aed2011-07-01 19:47:50 +000059#include "MagickCore/string_.h"
60#include "MagickCore/thread-private.h"
cristy3ed852e2009-09-05 21:47:34 +000061
62/*
63 Typedef declarations.
64*/
65struct _CacheView
66{
67 Image
68 *image;
69
70 VirtualPixelMethod
71 virtual_pixel_method;
72
cristybb503372010-05-27 20:51:26 +000073 size_t
cristy3ed852e2009-09-05 21:47:34 +000074 number_threads;
75
76 NexusInfo
77 **nexus_info;
78
79 MagickBooleanType
80 debug;
81
cristybb503372010-05-27 20:51:26 +000082 size_t
cristy3ed852e2009-09-05 21:47:34 +000083 signature;
84};
85
86/*
87%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88% %
89% %
90% %
cristydb070952012-04-20 14:33:00 +000091% A c q u i r e A u t h e n t i c C a c h e V i e w %
cristy3ed852e2009-09-05 21:47:34 +000092% %
93% %
94% %
95%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96%
cristydb070952012-04-20 14:33:00 +000097% AcquireAuthenticCacheView() acquires an authentic view into the pixel cache.
cristy3ed852e2009-09-05 21:47:34 +000098%
cristydb070952012-04-20 14:33:00 +000099% The format of the AcquireAuthenticCacheView method is:
cristy3ed852e2009-09-05 21:47:34 +0000100%
cristydb070952012-04-20 14:33:00 +0000101% CacheView *AcquireAuthenticCacheView(const Image *image,
102% ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000103%
104% A description of each parameter follows:
105%
106% o image: the image.
107%
cristydb070952012-04-20 14:33:00 +0000108% o exception: return any errors or warnings in this structure.
109%
cristy3ed852e2009-09-05 21:47:34 +0000110*/
cristydb070952012-04-20 14:33:00 +0000111MagickExport CacheView *AcquireAuthenticCacheView(const Image *image,
112 ExceptionInfo *exception)
113{
114 CacheView
115 *cache_view;
116
117 MagickBooleanType
118 status;
119
120 cache_view=AcquireVirtualCacheView(image,exception);
121 status=SyncImagePixelCache(cache_view->image,exception);
122 if (status == MagickFalse)
123 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
124 return(cache_view);
125}
126
127/*
128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129% %
130% %
131% %
132% A c q u i r e V i r t u a l C a c h e V i e w %
133% %
134% %
135% %
136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137%
138% AcquireVirtualCacheView() acquires a virtual view into the pixel cache,
139% using the VirtualPixelMethod that is defined within the given image itself.
140%
141% The format of the AcquireVirtualCacheView method is:
142%
143% CacheView *AcquireVirtualCacheView(const Image *image,
144% ExceptionInfo *exception)
145%
146% A description of each parameter follows:
147%
148% o image: the image.
149%
150% o exception: return any errors or warnings in this structure.
151%
152*/
153MagickExport CacheView *AcquireVirtualCacheView(const Image *image,
154 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000155{
156 CacheView
157 *cache_view;
158
159 assert(image != (Image *) NULL);
160 assert(image->signature == MagickSignature);
161 if (image->debug != MagickFalse)
162 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
cristydb070952012-04-20 14:33:00 +0000163 (void) exception;
cristye42639a2012-08-23 01:53:24 +0000164 cache_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
165 sizeof(*cache_view)));
cristy3ed852e2009-09-05 21:47:34 +0000166 if (cache_view == (CacheView *) NULL)
167 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
168 (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view));
169 cache_view->image=ReferenceImage((Image *) image);
cristy9357bdd2012-07-30 12:28:34 +0000170 cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
cristy3ed852e2009-09-05 21:47:34 +0000171 cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
172 cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
173 cache_view->debug=IsEventLogging();
174 cache_view->signature=MagickSignature;
175 if (cache_view->nexus_info == (NexusInfo **) NULL)
176 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
177 return(cache_view);
178}
179
180/*
181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182% %
183% %
184% %
185% C l o n e C a c h e V i e w %
186% %
187% %
188% %
189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
190%
191% CloneCacheView() makes an exact copy of the specified cache view.
192%
193% The format of the CloneCacheView method is:
194%
195% CacheView *CloneCacheView(const CacheView *cache_view)
196%
197% A description of each parameter follows:
198%
199% o cache_view: the cache view.
200%
201*/
202MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
203{
204 CacheView
205 *clone_view;
206
207 assert(cache_view != (CacheView *) NULL);
208 assert(cache_view->signature == MagickSignature);
209 if (cache_view->debug != MagickFalse)
210 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
211 cache_view->image->filename);
cristye42639a2012-08-23 01:53:24 +0000212 clone_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
213 sizeof(*clone_view)));
cristy3ed852e2009-09-05 21:47:34 +0000214 if (clone_view == (CacheView *) NULL)
215 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
216 (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
217 clone_view->image=ReferenceImage(cache_view->image);
218 clone_view->number_threads=cache_view->number_threads;
219 clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
220 clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
221 clone_view->debug=cache_view->debug;
222 clone_view->signature=MagickSignature;
223 return(clone_view);
224}
225
226/*
227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
228% %
229% %
230% %
231% D e s t r o y C a c h e V i e w %
232% %
233% %
234% %
235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
236%
237% DestroyCacheView() destroys the specified view returned by a previous call
238% to AcquireCacheView().
239%
240% The format of the DestroyCacheView method is:
241%
242% CacheView *DestroyCacheView(CacheView *cache_view)
243%
244% A description of each parameter follows:
245%
246% o cache_view: the cache view.
247%
248*/
249MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
250{
251 assert(cache_view != (CacheView *) NULL);
252 assert(cache_view->signature == MagickSignature);
253 if (cache_view->debug != MagickFalse)
254 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
255 cache_view->image->filename);
256 if (cache_view->nexus_info != (NexusInfo **) NULL)
257 cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
258 cache_view->number_threads);
259 cache_view->image=DestroyImage(cache_view->image);
260 cache_view->signature=(~MagickSignature);
cristy27d53d62012-07-29 23:30:07 +0000261 cache_view=(CacheView *) RelinquishAlignedMemory(cache_view);
cristy3ed852e2009-09-05 21:47:34 +0000262 return(cache_view);
263}
264
265/*
266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267% %
268% %
269% %
cristye7516622012-04-29 14:22:45 +0000270% 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 %
271% %
272% %
273% %
274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275%
276% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
277% cache as defined by the geometry parameters. A pointer to the pixels is
278% returned if the pixels are transferred, otherwise a NULL is returned.
279%
280% The format of the GetCacheViewAuthenticPixels method is:
281%
282% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
283% const ssize_t x,const ssize_t y,const size_t columns,
284% const size_t rows,ExceptionInfo *exception)
285%
286% A description of each parameter follows:
287%
288% o cache_view: the cache view.
289%
290% o x,y,columns,rows: These values define the perimeter of a region of
291% pixels.
292%
293% o exception: return any errors or warnings in this structure.
294%
295*/
296MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
297 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
298 ExceptionInfo *exception)
299{
300 const int
301 id = GetOpenMPThreadId();
302
303 Quantum
304 *pixels;
305
306 assert(cache_view != (CacheView *) NULL);
307 assert(cache_view->signature == MagickSignature);
308 assert(id < (int) cache_view->number_threads);
309 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
310 cache_view->nexus_info[id],exception);
311 return(pixels);
312}
313
314/*
315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
316% %
317% %
318% %
319% 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 %
320% %
321% %
322% %
323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324%
325% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
326% with the last call to SetCacheViewIndexes() or
327% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
328% be updated.
329%
330% The format of the GetCacheViewAuthenticMetacontent() method is:
331%
332% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
333%
334% A description of each parameter follows:
335%
336% o cache_view: the cache view.
337%
338*/
339MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
340{
341 const int
342 id = GetOpenMPThreadId();
343
344 void
345 *metacontent;
346
347 assert(cache_view != (CacheView *) NULL);
348 assert(cache_view->signature == MagickSignature);
349 assert(cache_view->image->cache != (Cache) NULL);
350 assert(id < (int) cache_view->number_threads);
351 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
352 cache_view->nexus_info[id]);
353 return(metacontent);
354}
355
356/*
357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358% %
359% %
360% %
361% 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 %
362% %
363% %
364% %
365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
366%
367% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
368% last call to QueueCacheViewAuthenticPixels() or
369% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
370% updated.
371%
372% The format of the GetCacheViewAuthenticPixelQueue() method is:
373%
374% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
375%
376% A description of each parameter follows:
377%
378% o cache_view: the cache view.
379%
380*/
381MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
382{
383 const int
384 id = GetOpenMPThreadId();
385
386 Quantum
387 *pixels;
388
389 assert(cache_view != (CacheView *) NULL);
390 assert(cache_view->signature == MagickSignature);
391 assert(cache_view->image->cache != (Cache) NULL);
392 assert(id < (int) cache_view->number_threads);
393 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
394 cache_view->nexus_info[id]);
395 return(pixels);
396}
397
398/*
399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400% %
401% %
402% %
cristy3ed852e2009-09-05 21:47:34 +0000403% G e t C a c h e V i e w C o l o r s p a c e %
404% %
405% %
406% %
407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408%
409% GetCacheViewColorspace() returns the image colorspace associated with the
410% specified view.
411%
412% The format of the GetCacheViewColorspace method is:
413%
414% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
415%
416% A description of each parameter follows:
417%
418% o cache_view: the cache view.
419%
420*/
421MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
422{
423 assert(cache_view != (CacheView *) NULL);
424 assert(cache_view->signature == MagickSignature);
425 if (cache_view->debug != MagickFalse)
426 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
427 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000428 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000429}
430
431/*
432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433% %
434% %
435% %
cristy3ed852e2009-09-05 21:47:34 +0000436+ G e t C a c h e V i e w E x t e n t %
437% %
438% %
439% %
440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
441%
442% GetCacheViewExtent() returns the extent of the pixels associated with the
443% last call to QueueCacheViewAuthenticPixels() or
444% GetCacheViewAuthenticPixels().
445%
446% The format of the GetCacheViewExtent() method is:
447%
448% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
449%
450% A description of each parameter follows:
451%
452% o cache_view: the cache view.
453%
454*/
455MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
456{
cristy5c9e6f22010-09-17 17:31:01 +0000457 const int
458 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000459
cristy4c08aed2011-07-01 19:47:50 +0000460 MagickSizeType
461 extent;
462
cristy3ed852e2009-09-05 21:47:34 +0000463 assert(cache_view != (CacheView *) NULL);
464 assert(cache_view->signature == MagickSignature);
465 if (cache_view->debug != MagickFalse)
466 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
467 cache_view->image->filename);
468 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000469 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000470 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
471 cache_view->nexus_info[id]);
472 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000473}
474
475/*
476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
477% %
478% %
479% %
cristye7516622012-04-29 14:22:45 +0000480% G e t C a c h e V i e w I m a g e %
481% %
482% %
483% %
484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
485%
486% GetCacheViewImage() returns the image associated with the specified view.
487%
488% The format of the GetCacheViewImage method is:
489%
490% const Image *GetCacheViewImage(const CacheView *cache_view)
491%
492% A description of each parameter follows:
493%
494% o cache_view: the cache view.
495%
496*/
497MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
498{
499 assert(cache_view != (CacheView *) NULL);
500 assert(cache_view->signature == MagickSignature);
501 if (cache_view->debug != MagickFalse)
502 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
503 cache_view->image->filename);
504 return(cache_view->image);
505}
506
507/*
508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509% %
510% %
511% %
cristy3ed852e2009-09-05 21:47:34 +0000512% G e t C a c h e V i e w S t o r a g e C l a s s %
513% %
514% %
515% %
516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
517%
cristye7516622012-04-29 14:22:45 +0000518% GetCacheViewStorageClass() returns the image storage class associated with
cristy3ed852e2009-09-05 21:47:34 +0000519% the specified view.
520%
521% The format of the GetCacheViewStorageClass method is:
522%
523% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
524%
525% A description of each parameter follows:
526%
527% o cache_view: the cache view.
528%
529*/
530MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
531{
532 assert(cache_view != (CacheView *) NULL);
533 assert(cache_view->signature == MagickSignature);
534 if (cache_view->debug != MagickFalse)
535 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
536 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000537 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000538}
539
540/*
541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542% %
543% %
544% %
cristy4c08aed2011-07-01 19:47:50 +0000545% 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 +0000546% %
547% %
548% %
549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550%
cristy4c08aed2011-07-01 19:47:50 +0000551% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
552% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
553% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000554%
cristy4c08aed2011-07-01 19:47:50 +0000555% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000556%
cristy4c08aed2011-07-01 19:47:50 +0000557% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000558% const CacheView *cache_view)
559%
560% A description of each parameter follows:
561%
562% o cache_view: the cache view.
563%
564*/
cristy4c08aed2011-07-01 19:47:50 +0000565MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000566 const CacheView *cache_view)
567{
cristy5c9e6f22010-09-17 17:31:01 +0000568 const int
569 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000570
cristy4c08aed2011-07-01 19:47:50 +0000571 const void
572 *metacontent;
573
cristy3ed852e2009-09-05 21:47:34 +0000574 assert(cache_view != (const CacheView *) NULL);
575 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000576 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000577 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000578 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
579 cache_view->nexus_info[id]);
580 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000581}
582
583/*
584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585% %
586% %
587% %
588% 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 %
589% %
590% %
591% %
592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
593%
594% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
595% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
596% and therefore cannot be updated.
597%
598% The format of the GetCacheViewVirtualPixelQueue() method is:
599%
cristy4c08aed2011-07-01 19:47:50 +0000600% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000601% const CacheView *cache_view)
602%
603% A description of each parameter follows:
604%
605% o cache_view: the cache view.
606%
607*/
cristy4c08aed2011-07-01 19:47:50 +0000608MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000609 const CacheView *cache_view)
610{
cristy5c9e6f22010-09-17 17:31:01 +0000611 const int
612 id = GetOpenMPThreadId();
613
cristy4c08aed2011-07-01 19:47:50 +0000614 const Quantum
615 *pixels;
616
cristy3ed852e2009-09-05 21:47:34 +0000617 assert(cache_view != (const CacheView *) NULL);
618 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000619 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000620 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000621 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
622 cache_view->nexus_info[id]);
623 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000624}
625
626/*
627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628% %
629% %
630% %
631% 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 %
632% %
633% %
634% %
635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
636%
637% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
638% disk pixel cache as defined by the geometry parameters. A pointer to the
639% pixels is returned if the pixels are transferred, otherwise a NULL is
640% returned.
641%
642% The format of the GetCacheViewVirtualPixels method is:
643%
cristy4c08aed2011-07-01 19:47:50 +0000644% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000645% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000646% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000647%
648% A description of each parameter follows:
649%
650% o cache_view: the cache view.
651%
652% o x,y,columns,rows: These values define the perimeter of a region of
653% pixels.
654%
655% o exception: return any errors or warnings in this structure.
656%
657*/
cristy4c08aed2011-07-01 19:47:50 +0000658MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000659 const CacheView *cache_view,const ssize_t x,const ssize_t y,
660 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000661{
cristy5c9e6f22010-09-17 17:31:01 +0000662 const int
663 id = GetOpenMPThreadId();
664
cristy4c08aed2011-07-01 19:47:50 +0000665 const Quantum
666 *pixels;
667
cristy3ed852e2009-09-05 21:47:34 +0000668 assert(cache_view != (CacheView *) NULL);
669 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000670 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000671 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000672 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000673 cache_view->nexus_info[id],exception);
674 return(pixels);
675}
676
677/*
678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
679% %
680% %
681% %
682% 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 %
683% %
684% %
685% %
686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
687%
688% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
689% location. The image background color is returned if an error occurs.
690%
691% The format of the GetOneCacheViewAuthenticPixel method is:
692%
693% MagickBooleaNType GetOneCacheViewAuthenticPixel(
694% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000695% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000696%
697% A description of each parameter follows:
698%
699% o cache_view: the cache view.
700%
701% o x,y: These values define the offset of the pixel.
702%
703% o pixel: return a pixel at the specified (x,y) location.
704%
705% o exception: return any errors or warnings in this structure.
706%
707*/
708MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000709 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
710 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000711{
712 const int
713 id = GetOpenMPThreadId();
714
715 Quantum
716 *p;
717
cristy2ed42f62011-10-02 19:49:57 +0000718 register ssize_t
719 i;
720
cristy4c08aed2011-07-01 19:47:50 +0000721 assert(cache_view != (CacheView *) NULL);
722 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000723 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000724 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000725 p=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
726 cache_view->nexus_info[id],exception);
727 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000728 {
cristyd09f8802012-02-04 16:44:10 +0000729 PixelInfo
730 background_color;
731
732 background_color=cache_view->image->background_color;
733 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
734 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
735 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
736 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
737 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000738 return(MagickFalse);
739 }
740 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
741 {
742 PixelChannel
743 channel;
744
cristycf1296e2012-08-26 23:40:49 +0000745 channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000746 pixel[channel]=p[i];
747 }
cristy4c08aed2011-07-01 19:47:50 +0000748 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000749}
750
751/*
752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
753% %
754% %
755% %
756% 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 %
757% %
758% %
759% %
760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
761%
762% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
763% location. The image background color is returned if an error occurs. If
764% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
765%
766% The format of the GetOneCacheViewVirtualPixel method is:
767%
768% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000769% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000770% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000771%
772% A description of each parameter follows:
773%
774% o cache_view: the cache view.
775%
776% o x,y: These values define the offset of the pixel.
777%
778% o pixel: return a pixel at the specified (x,y) location.
779%
780% o exception: return any errors or warnings in this structure.
781%
782*/
783MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000784 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
785 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000786{
cristy5c9e6f22010-09-17 17:31:01 +0000787 const int
788 id = GetOpenMPThreadId();
789
cristyf05d4942012-03-17 16:26:09 +0000790 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000791 *p;
cristy3ed852e2009-09-05 21:47:34 +0000792
cristy2ed42f62011-10-02 19:49:57 +0000793 register ssize_t
794 i;
795
cristy3ed852e2009-09-05 21:47:34 +0000796 assert(cache_view != (CacheView *) NULL);
797 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000798 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000799 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000800 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000801 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
802 exception);
cristy4c08aed2011-07-01 19:47:50 +0000803 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000804 {
cristyd09f8802012-02-04 16:44:10 +0000805 PixelInfo
806 background_color;
807
808 background_color=cache_view->image->background_color;
809 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
810 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
811 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
812 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
813 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000814 return(MagickFalse);
815 }
816 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
817 {
818 PixelChannel
819 channel;
820
cristycf1296e2012-08-26 23:40:49 +0000821 channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000822 pixel[channel]=p[i];
823 }
cristy3ed852e2009-09-05 21:47:34 +0000824 return(MagickTrue);
825}
826
827/*
828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
829% %
830% %
831% %
cristyf05d4942012-03-17 16:26:09 +0000832% 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 %
833% %
834% %
835% %
836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837%
838% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
839% (x,y) location. The image background color is returned if an error occurs.
840% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
841%
842% The format of the GetOneCacheViewVirtualPixelInfo method is:
843%
844% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
845% const CacheView *cache_view,const ssize_t x,const ssize_t y,
846% PixelInfo *pixel,ExceptionInfo *exception)
847%
848% A description of each parameter follows:
849%
850% o cache_view: the cache view.
851%
852% o x,y: These values define the offset of the pixel.
853%
854% o pixel: return a pixel at the specified (x,y) location.
855%
856% o exception: return any errors or warnings in this structure.
857%
858*/
859MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
860 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
861 ExceptionInfo *exception)
862{
863 const int
864 id = GetOpenMPThreadId();
865
866 register const Quantum
867 *p;
868
869 assert(cache_view != (CacheView *) NULL);
870 assert(cache_view->signature == MagickSignature);
871 assert(id < (int) cache_view->number_threads);
cristyf82cff82012-04-16 16:54:17 +0000872 GetPixelInfo(cache_view->image,pixel);
cristyf05d4942012-03-17 16:26:09 +0000873 p=GetVirtualPixelsFromNexus(cache_view->image,
874 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
875 exception);
cristyf05d4942012-03-17 16:26:09 +0000876 if (p == (const Quantum *) NULL)
877 return(MagickFalse);
878 GetPixelInfoPixel(cache_view->image,p,pixel);
879 return(MagickTrue);
880}
881
882/*
883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
884% %
885% %
886% %
cristy3ed852e2009-09-05 21:47:34 +0000887% 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 %
888% %
889% %
890% %
891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
892%
893% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
894% the specified (x,y) location. The image background color is returned if an
895% error occurs. If you plan to modify the pixel, use
896% GetOneCacheViewAuthenticPixel() instead.
897%
898% The format of the GetOneCacheViewVirtualPixel method is:
899%
900% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
901% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000902% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000903% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000904%
905% A description of each parameter follows:
906%
907% o cache_view: the cache view.
908%
909% o virtual_pixel_method: the virtual pixel method.
910%
911% o x,y: These values define the offset of the pixel.
912%
913% o pixel: return a pixel at the specified (x,y) location.
914%
915% o exception: return any errors or warnings in this structure.
916%
917*/
918MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
919 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000920 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000921{
cristy5c9e6f22010-09-17 17:31:01 +0000922 const int
923 id = GetOpenMPThreadId();
924
cristy4c08aed2011-07-01 19:47:50 +0000925 const Quantum
926 *p;
cristy3ed852e2009-09-05 21:47:34 +0000927
cristy2ed42f62011-10-02 19:49:57 +0000928 register ssize_t
929 i;
930
cristy3ed852e2009-09-05 21:47:34 +0000931 assert(cache_view != (CacheView *) NULL);
932 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000933 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000934 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000935 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
936 cache_view->nexus_info[id],exception);
937 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000938 {
cristyd09f8802012-02-04 16:44:10 +0000939 PixelInfo
940 background_color;
941
942 background_color=cache_view->image->background_color;
943 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
944 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
945 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
946 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
947 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000948 return(MagickFalse);
949 }
950 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
951 {
952 PixelChannel
953 channel;
954
cristycf1296e2012-08-26 23:40:49 +0000955 channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000956 pixel[channel]=p[i];
957 }
cristy3ed852e2009-09-05 21:47:34 +0000958 return(MagickTrue);
959}
960
961/*
962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
963% %
964% %
965% %
966% 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 %
967% %
968% %
969% %
970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
971%
972% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
973% disk pixel cache as defined by the geometry parameters. A pointer to the
974% pixels is returned if the pixels are transferred, otherwise a NULL is
975% returned.
976%
977% The format of the QueueCacheViewAuthenticPixels method is:
978%
cristy4c08aed2011-07-01 19:47:50 +0000979% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000980% const ssize_t x,const ssize_t y,const size_t columns,
981% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000982%
983% A description of each parameter follows:
984%
985% o cache_view: the cache view.
986%
987% o x,y,columns,rows: These values define the perimeter of a region of
988% pixels.
989%
990% o exception: return any errors or warnings in this structure.
991%
992*/
cristy4c08aed2011-07-01 19:47:50 +0000993MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000994 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
995 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000996{
cristy5c9e6f22010-09-17 17:31:01 +0000997 const int
998 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000999
cristy4c08aed2011-07-01 19:47:50 +00001000 Quantum
1001 *pixels;
1002
cristy3ed852e2009-09-05 21:47:34 +00001003 assert(cache_view != (CacheView *) NULL);
1004 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001005 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +00001006 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
1007 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +00001008 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +00001009}
1010
1011/*
1012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1013% %
1014% %
1015% %
1016% S e t C a c h e V i e w S t o r a g e C l a s s %
1017% %
1018% %
1019% %
1020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1021%
1022% SetCacheViewStorageClass() sets the image storage class associated with
1023% the specified view.
1024%
1025% The format of the SetCacheViewStorageClass method is:
1026%
1027% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001028% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001029%
1030% A description of each parameter follows:
1031%
1032% o cache_view: the cache view.
1033%
1034% o storage_class: the image storage class: PseudoClass or DirectClass.
1035%
cristyc82a27b2011-10-21 01:07:16 +00001036% o exception: return any errors or warnings in this structure.
1037%
cristy3ed852e2009-09-05 21:47:34 +00001038*/
1039MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001040 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001041{
1042 assert(cache_view != (CacheView *) NULL);
1043 assert(cache_view->signature == MagickSignature);
1044 if (cache_view->debug != MagickFalse)
1045 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1046 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +00001047 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +00001048}
1049
1050/*
1051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052% %
1053% %
1054% %
1055% 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 %
1056% %
1057% %
1058% %
1059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1060%
1061% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1062% with the specified cache view.
1063%
1064% The format of the SetCacheViewVirtualPixelMethod method is:
1065%
1066% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1067% const VirtualPixelMethod virtual_pixel_method)
1068%
1069% A description of each parameter follows:
1070%
1071% o cache_view: the cache view.
1072%
1073% o virtual_pixel_method: the virtual pixel method.
1074%
1075*/
1076MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1077 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
1078{
1079 assert(cache_view != (CacheView *) NULL);
1080 assert(cache_view->signature == MagickSignature);
1081 if (cache_view->debug != MagickFalse)
1082 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1083 cache_view->image->filename);
1084 cache_view->virtual_pixel_method=virtual_pixel_method;
1085 return(MagickTrue);
1086}
1087
1088/*
1089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1090% %
1091% %
1092% %
1093% 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 %
1094% %
1095% %
1096% %
1097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1098%
1099% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1100% or disk cache. It returns MagickTrue if the pixel region is flushed,
1101% otherwise MagickFalse.
1102%
1103% The format of the SyncCacheViewAuthenticPixels method is:
1104%
1105% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1106% ExceptionInfo *exception)
1107%
1108% A description of each parameter follows:
1109%
1110% o cache_view: the cache view.
1111%
1112% o exception: return any errors or warnings in this structure.
1113%
1114*/
1115MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1116 CacheView *cache_view,ExceptionInfo *exception)
1117{
cristy5c9e6f22010-09-17 17:31:01 +00001118 const int
1119 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001120
cristy4c08aed2011-07-01 19:47:50 +00001121 MagickBooleanType
1122 status;
1123
cristy3ed852e2009-09-05 21:47:34 +00001124 assert(cache_view != (CacheView *) NULL);
1125 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001126 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001127 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1128 cache_view->nexus_info[id],exception);
1129 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001130}