blob: e51b4af32c09ce901d77cdcd5b450a06cc394ca9 [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"
cristyac245f82012-05-05 17:13:57 +000057#include "MagickCore/resource_.h"
cristy4c08aed2011-07-01 19:47:50 +000058#include "MagickCore/string_.h"
59#include "MagickCore/thread-private.h"
cristy3ed852e2009-09-05 21:47:34 +000060
61/*
62 Typedef declarations.
63*/
64struct _CacheView
65{
66 Image
67 *image;
68
69 VirtualPixelMethod
70 virtual_pixel_method;
71
cristybb503372010-05-27 20:51:26 +000072 size_t
cristy3ed852e2009-09-05 21:47:34 +000073 number_threads;
74
75 NexusInfo
76 **nexus_info;
77
78 MagickBooleanType
79 debug;
80
cristybb503372010-05-27 20:51:26 +000081 size_t
cristy3ed852e2009-09-05 21:47:34 +000082 signature;
83};
84
85/*
86%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87% %
88% %
89% %
cristydb070952012-04-20 14:33:00 +000090% 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 +000091% %
92% %
93% %
94%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95%
cristydb070952012-04-20 14:33:00 +000096% AcquireAuthenticCacheView() acquires an authentic view into the pixel cache.
cristy3ed852e2009-09-05 21:47:34 +000097%
cristydb070952012-04-20 14:33:00 +000098% The format of the AcquireAuthenticCacheView method is:
cristy3ed852e2009-09-05 21:47:34 +000099%
cristydb070952012-04-20 14:33:00 +0000100% CacheView *AcquireAuthenticCacheView(const Image *image,
101% ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000102%
103% A description of each parameter follows:
104%
105% o image: the image.
106%
cristydb070952012-04-20 14:33:00 +0000107% o exception: return any errors or warnings in this structure.
108%
cristy3ed852e2009-09-05 21:47:34 +0000109*/
cristydb070952012-04-20 14:33:00 +0000110MagickExport CacheView *AcquireAuthenticCacheView(const Image *image,
111 ExceptionInfo *exception)
112{
113 CacheView
114 *cache_view;
115
116 MagickBooleanType
117 status;
118
119 cache_view=AcquireVirtualCacheView(image,exception);
120 status=SyncImagePixelCache(cache_view->image,exception);
121 if (status == MagickFalse)
122 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
123 return(cache_view);
124}
125
126/*
127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128% %
129% %
130% %
131% A c q u i r e V i r t u a l C a c h e V i e w %
132% %
133% %
134% %
135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136%
137% AcquireVirtualCacheView() acquires a virtual view into the pixel cache,
138% using the VirtualPixelMethod that is defined within the given image itself.
139%
140% The format of the AcquireVirtualCacheView method is:
141%
142% CacheView *AcquireVirtualCacheView(const Image *image,
143% ExceptionInfo *exception)
144%
145% A description of each parameter follows:
146%
147% o image: the image.
148%
149% o exception: return any errors or warnings in this structure.
150%
151*/
152MagickExport CacheView *AcquireVirtualCacheView(const Image *image,
153 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000154{
155 CacheView
156 *cache_view;
157
158 assert(image != (Image *) NULL);
159 assert(image->signature == MagickSignature);
160 if (image->debug != MagickFalse)
161 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
cristydb070952012-04-20 14:33:00 +0000162 (void) exception;
cristya64b85d2011-09-14 01:02:31 +0000163 cache_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*cache_view));
cristy3ed852e2009-09-05 21:47:34 +0000164 if (cache_view == (CacheView *) NULL)
165 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
166 (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view));
167 cache_view->image=ReferenceImage((Image *) image);
cristye5a74172012-05-09 13:51:24 +0000168 cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
cristy3ed852e2009-09-05 21:47:34 +0000169 cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
170 cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
171 cache_view->debug=IsEventLogging();
172 cache_view->signature=MagickSignature;
173 if (cache_view->nexus_info == (NexusInfo **) NULL)
174 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
175 return(cache_view);
176}
177
178/*
179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180% %
181% %
182% %
183% C l o n e C a c h e V i e w %
184% %
185% %
186% %
187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188%
189% CloneCacheView() makes an exact copy of the specified cache view.
190%
191% The format of the CloneCacheView method is:
192%
193% CacheView *CloneCacheView(const CacheView *cache_view)
194%
195% A description of each parameter follows:
196%
197% o cache_view: the cache view.
198%
199*/
200MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
201{
202 CacheView
203 *clone_view;
204
205 assert(cache_view != (CacheView *) NULL);
206 assert(cache_view->signature == MagickSignature);
207 if (cache_view->debug != MagickFalse)
208 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
209 cache_view->image->filename);
cristya64b85d2011-09-14 01:02:31 +0000210 clone_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*clone_view));
cristy3ed852e2009-09-05 21:47:34 +0000211 if (clone_view == (CacheView *) NULL)
212 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
213 (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
214 clone_view->image=ReferenceImage(cache_view->image);
215 clone_view->number_threads=cache_view->number_threads;
216 clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
217 clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
218 clone_view->debug=cache_view->debug;
219 clone_view->signature=MagickSignature;
220 return(clone_view);
221}
222
223/*
224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225% %
226% %
227% %
228% D e s t r o y C a c h e V i e w %
229% %
230% %
231% %
232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233%
234% DestroyCacheView() destroys the specified view returned by a previous call
235% to AcquireCacheView().
236%
237% The format of the DestroyCacheView method is:
238%
239% CacheView *DestroyCacheView(CacheView *cache_view)
240%
241% A description of each parameter follows:
242%
243% o cache_view: the cache view.
244%
245*/
246MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
247{
248 assert(cache_view != (CacheView *) NULL);
249 assert(cache_view->signature == MagickSignature);
250 if (cache_view->debug != MagickFalse)
251 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
252 cache_view->image->filename);
253 if (cache_view->nexus_info != (NexusInfo **) NULL)
254 cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
255 cache_view->number_threads);
256 cache_view->image=DestroyImage(cache_view->image);
257 cache_view->signature=(~MagickSignature);
cristyb41ee102010-10-04 16:46:15 +0000258 cache_view=(CacheView *) RelinquishMagickMemory(cache_view);
cristy3ed852e2009-09-05 21:47:34 +0000259 return(cache_view);
260}
261
262/*
263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264% %
265% %
266% %
cristye7516622012-04-29 14:22:45 +0000267% 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 %
268% %
269% %
270% %
271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272%
273% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
274% cache as defined by the geometry parameters. A pointer to the pixels is
275% returned if the pixels are transferred, otherwise a NULL is returned.
276%
277% The format of the GetCacheViewAuthenticPixels method is:
278%
279% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
280% const ssize_t x,const ssize_t y,const size_t columns,
281% const size_t rows,ExceptionInfo *exception)
282%
283% A description of each parameter follows:
284%
285% o cache_view: the cache view.
286%
287% o x,y,columns,rows: These values define the perimeter of a region of
288% pixels.
289%
290% o exception: return any errors or warnings in this structure.
291%
292*/
293MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
294 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
295 ExceptionInfo *exception)
296{
297 const int
298 id = GetOpenMPThreadId();
299
300 Quantum
301 *pixels;
302
303 assert(cache_view != (CacheView *) NULL);
304 assert(cache_view->signature == MagickSignature);
305 assert(id < (int) cache_view->number_threads);
306 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
307 cache_view->nexus_info[id],exception);
308 return(pixels);
309}
310
311/*
312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
313% %
314% %
315% %
316% 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 %
317% %
318% %
319% %
320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
321%
322% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
323% with the last call to SetCacheViewIndexes() or
324% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
325% be updated.
326%
327% The format of the GetCacheViewAuthenticMetacontent() method is:
328%
329% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
330%
331% A description of each parameter follows:
332%
333% o cache_view: the cache view.
334%
335*/
336MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
337{
338 const int
339 id = GetOpenMPThreadId();
340
341 void
342 *metacontent;
343
344 assert(cache_view != (CacheView *) NULL);
345 assert(cache_view->signature == MagickSignature);
346 assert(cache_view->image->cache != (Cache) NULL);
347 assert(id < (int) cache_view->number_threads);
348 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
349 cache_view->nexus_info[id]);
350 return(metacontent);
351}
352
353/*
354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355% %
356% %
357% %
358% 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 %
359% %
360% %
361% %
362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363%
364% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
365% last call to QueueCacheViewAuthenticPixels() or
366% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
367% updated.
368%
369% The format of the GetCacheViewAuthenticPixelQueue() method is:
370%
371% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
372%
373% A description of each parameter follows:
374%
375% o cache_view: the cache view.
376%
377*/
378MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
379{
380 const int
381 id = GetOpenMPThreadId();
382
383 Quantum
384 *pixels;
385
386 assert(cache_view != (CacheView *) NULL);
387 assert(cache_view->signature == MagickSignature);
388 assert(cache_view->image->cache != (Cache) NULL);
389 assert(id < (int) cache_view->number_threads);
390 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
391 cache_view->nexus_info[id]);
392 return(pixels);
393}
394
395/*
396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397% %
398% %
399% %
cristy3ed852e2009-09-05 21:47:34 +0000400% G e t C a c h e V i e w C o l o r s p a c e %
401% %
402% %
403% %
404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
405%
406% GetCacheViewColorspace() returns the image colorspace associated with the
407% specified view.
408%
409% The format of the GetCacheViewColorspace method is:
410%
411% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
412%
413% A description of each parameter follows:
414%
415% o cache_view: the cache view.
416%
417*/
418MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
419{
420 assert(cache_view != (CacheView *) NULL);
421 assert(cache_view->signature == MagickSignature);
422 if (cache_view->debug != MagickFalse)
423 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
424 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000425 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000426}
427
428/*
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430% %
431% %
432% %
cristy3ed852e2009-09-05 21:47:34 +0000433+ G e t C a c h e V i e w E x t e n t %
434% %
435% %
436% %
437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
438%
439% GetCacheViewExtent() returns the extent of the pixels associated with the
440% last call to QueueCacheViewAuthenticPixels() or
441% GetCacheViewAuthenticPixels().
442%
443% The format of the GetCacheViewExtent() method is:
444%
445% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
446%
447% A description of each parameter follows:
448%
449% o cache_view: the cache view.
450%
451*/
452MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
453{
cristy5c9e6f22010-09-17 17:31:01 +0000454 const int
455 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000456
cristy4c08aed2011-07-01 19:47:50 +0000457 MagickSizeType
458 extent;
459
cristy3ed852e2009-09-05 21:47:34 +0000460 assert(cache_view != (CacheView *) NULL);
461 assert(cache_view->signature == MagickSignature);
462 if (cache_view->debug != MagickFalse)
463 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
464 cache_view->image->filename);
465 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000466 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000467 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
468 cache_view->nexus_info[id]);
469 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000470}
471
472/*
473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474% %
475% %
476% %
cristye7516622012-04-29 14:22:45 +0000477% G e t C a c h e V i e w I m a g e %
478% %
479% %
480% %
481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
482%
483% GetCacheViewImage() returns the image associated with the specified view.
484%
485% The format of the GetCacheViewImage method is:
486%
487% const Image *GetCacheViewImage(const CacheView *cache_view)
488%
489% A description of each parameter follows:
490%
491% o cache_view: the cache view.
492%
493*/
494MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
495{
496 assert(cache_view != (CacheView *) NULL);
497 assert(cache_view->signature == MagickSignature);
498 if (cache_view->debug != MagickFalse)
499 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
500 cache_view->image->filename);
501 return(cache_view->image);
502}
503
504/*
505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
506% %
507% %
508% %
cristy3ed852e2009-09-05 21:47:34 +0000509% G e t C a c h e V i e w S t o r a g e C l a s s %
510% %
511% %
512% %
513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514%
cristye7516622012-04-29 14:22:45 +0000515% GetCacheViewStorageClass() returns the image storage class associated with
cristy3ed852e2009-09-05 21:47:34 +0000516% the specified view.
517%
518% The format of the GetCacheViewStorageClass method is:
519%
520% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
521%
522% A description of each parameter follows:
523%
524% o cache_view: the cache view.
525%
526*/
527MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
528{
529 assert(cache_view != (CacheView *) NULL);
530 assert(cache_view->signature == MagickSignature);
531 if (cache_view->debug != MagickFalse)
532 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
533 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000534 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000535}
536
537/*
538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539% %
540% %
541% %
cristy4c08aed2011-07-01 19:47:50 +0000542% 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 +0000543% %
544% %
545% %
546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
547%
cristy4c08aed2011-07-01 19:47:50 +0000548% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
549% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
550% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000551%
cristy4c08aed2011-07-01 19:47:50 +0000552% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000553%
cristy4c08aed2011-07-01 19:47:50 +0000554% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000555% const CacheView *cache_view)
556%
557% A description of each parameter follows:
558%
559% o cache_view: the cache view.
560%
561*/
cristy4c08aed2011-07-01 19:47:50 +0000562MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000563 const CacheView *cache_view)
564{
cristy5c9e6f22010-09-17 17:31:01 +0000565 const int
566 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000567
cristy4c08aed2011-07-01 19:47:50 +0000568 const void
569 *metacontent;
570
cristy3ed852e2009-09-05 21:47:34 +0000571 assert(cache_view != (const CacheView *) NULL);
572 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000573 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000574 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000575 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
576 cache_view->nexus_info[id]);
577 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000578}
579
580/*
581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
582% %
583% %
584% %
585% 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 %
586% %
587% %
588% %
589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
590%
591% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
592% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
593% and therefore cannot be updated.
594%
595% The format of the GetCacheViewVirtualPixelQueue() method is:
596%
cristy4c08aed2011-07-01 19:47:50 +0000597% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000598% const CacheView *cache_view)
599%
600% A description of each parameter follows:
601%
602% o cache_view: the cache view.
603%
604*/
cristy4c08aed2011-07-01 19:47:50 +0000605MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000606 const CacheView *cache_view)
607{
cristy5c9e6f22010-09-17 17:31:01 +0000608 const int
609 id = GetOpenMPThreadId();
610
cristy4c08aed2011-07-01 19:47:50 +0000611 const Quantum
612 *pixels;
613
cristy3ed852e2009-09-05 21:47:34 +0000614 assert(cache_view != (const CacheView *) NULL);
615 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000616 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000617 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000618 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
619 cache_view->nexus_info[id]);
620 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000621}
622
623/*
624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
625% %
626% %
627% %
628% 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 %
629% %
630% %
631% %
632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
633%
634% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
635% disk pixel cache as defined by the geometry parameters. A pointer to the
636% pixels is returned if the pixels are transferred, otherwise a NULL is
637% returned.
638%
639% The format of the GetCacheViewVirtualPixels method is:
640%
cristy4c08aed2011-07-01 19:47:50 +0000641% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000642% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000643% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000644%
645% A description of each parameter follows:
646%
647% o cache_view: the cache view.
648%
649% o x,y,columns,rows: These values define the perimeter of a region of
650% pixels.
651%
652% o exception: return any errors or warnings in this structure.
653%
654*/
cristy4c08aed2011-07-01 19:47:50 +0000655MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000656 const CacheView *cache_view,const ssize_t x,const ssize_t y,
657 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000658{
cristy5c9e6f22010-09-17 17:31:01 +0000659 const int
660 id = GetOpenMPThreadId();
661
cristy4c08aed2011-07-01 19:47:50 +0000662 const Quantum
663 *pixels;
664
cristy3ed852e2009-09-05 21:47:34 +0000665 assert(cache_view != (CacheView *) NULL);
666 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000667 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000668 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000669 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000670 cache_view->nexus_info[id],exception);
671 return(pixels);
672}
673
674/*
675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
676% %
677% %
678% %
679% 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 %
680% %
681% %
682% %
683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
684%
685% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
686% location. The image background color is returned if an error occurs.
687%
688% The format of the GetOneCacheViewAuthenticPixel method is:
689%
690% MagickBooleaNType GetOneCacheViewAuthenticPixel(
691% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000692% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000693%
694% A description of each parameter follows:
695%
696% o cache_view: the cache view.
697%
698% o x,y: These values define the offset of the pixel.
699%
700% o pixel: return a pixel at the specified (x,y) location.
701%
702% o exception: return any errors or warnings in this structure.
703%
704*/
705MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000706 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
707 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000708{
709 const int
710 id = GetOpenMPThreadId();
711
712 Quantum
713 *p;
714
cristy2ed42f62011-10-02 19:49:57 +0000715 register ssize_t
716 i;
717
cristy4c08aed2011-07-01 19:47:50 +0000718 assert(cache_view != (CacheView *) NULL);
719 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000720 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000721 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000722 p=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
723 cache_view->nexus_info[id],exception);
724 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000725 {
cristyd09f8802012-02-04 16:44:10 +0000726 PixelInfo
727 background_color;
728
729 background_color=cache_view->image->background_color;
730 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
731 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
732 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
733 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
734 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000735 return(MagickFalse);
736 }
737 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
738 {
739 PixelChannel
740 channel;
741
cristye2a912b2011-12-05 20:02:07 +0000742 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000743 pixel[channel]=p[i];
744 }
cristy4c08aed2011-07-01 19:47:50 +0000745 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000746}
747
748/*
749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
750% %
751% %
752% %
753% 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 %
754% %
755% %
756% %
757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
758%
759% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
760% location. The image background color is returned if an error occurs. If
761% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
762%
763% The format of the GetOneCacheViewVirtualPixel method is:
764%
765% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000766% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000767% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000768%
769% A description of each parameter follows:
770%
771% o cache_view: the cache view.
772%
773% o x,y: These values define the offset of the pixel.
774%
775% o pixel: return a pixel at the specified (x,y) location.
776%
777% o exception: return any errors or warnings in this structure.
778%
779*/
780MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000781 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
782 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000783{
cristy5c9e6f22010-09-17 17:31:01 +0000784 const int
785 id = GetOpenMPThreadId();
786
cristyf05d4942012-03-17 16:26:09 +0000787 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000788 *p;
cristy3ed852e2009-09-05 21:47:34 +0000789
cristy2ed42f62011-10-02 19:49:57 +0000790 register ssize_t
791 i;
792
cristy3ed852e2009-09-05 21:47:34 +0000793 assert(cache_view != (CacheView *) NULL);
794 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000795 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000796 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000797 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000798 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
799 exception);
cristy4c08aed2011-07-01 19:47:50 +0000800 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000801 {
cristyd09f8802012-02-04 16:44:10 +0000802 PixelInfo
803 background_color;
804
805 background_color=cache_view->image->background_color;
806 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
807 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
808 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
809 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
810 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000811 return(MagickFalse);
812 }
813 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
814 {
815 PixelChannel
816 channel;
817
cristye2a912b2011-12-05 20:02:07 +0000818 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000819 pixel[channel]=p[i];
820 }
cristy3ed852e2009-09-05 21:47:34 +0000821 return(MagickTrue);
822}
823
824/*
825%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
826% %
827% %
828% %
cristyf05d4942012-03-17 16:26:09 +0000829% 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 %
830% %
831% %
832% %
833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
834%
835% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
836% (x,y) location. The image background color is returned if an error occurs.
837% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
838%
839% The format of the GetOneCacheViewVirtualPixelInfo method is:
840%
841% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
842% const CacheView *cache_view,const ssize_t x,const ssize_t y,
843% PixelInfo *pixel,ExceptionInfo *exception)
844%
845% A description of each parameter follows:
846%
847% o cache_view: the cache view.
848%
849% o x,y: These values define the offset of the pixel.
850%
851% o pixel: return a pixel at the specified (x,y) location.
852%
853% o exception: return any errors or warnings in this structure.
854%
855*/
856MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
857 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
858 ExceptionInfo *exception)
859{
860 const int
861 id = GetOpenMPThreadId();
862
863 register const Quantum
864 *p;
865
866 assert(cache_view != (CacheView *) NULL);
867 assert(cache_view->signature == MagickSignature);
868 assert(id < (int) cache_view->number_threads);
cristyf82cff82012-04-16 16:54:17 +0000869 GetPixelInfo(cache_view->image,pixel);
cristyf05d4942012-03-17 16:26:09 +0000870 p=GetVirtualPixelsFromNexus(cache_view->image,
871 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
872 exception);
cristyf05d4942012-03-17 16:26:09 +0000873 if (p == (const Quantum *) NULL)
874 return(MagickFalse);
875 GetPixelInfoPixel(cache_view->image,p,pixel);
876 return(MagickTrue);
877}
878
879/*
880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
881% %
882% %
883% %
cristy3ed852e2009-09-05 21:47:34 +0000884% 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 %
885% %
886% %
887% %
888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
889%
890% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
891% the specified (x,y) location. The image background color is returned if an
892% error occurs. If you plan to modify the pixel, use
893% GetOneCacheViewAuthenticPixel() instead.
894%
895% The format of the GetOneCacheViewVirtualPixel method is:
896%
897% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
898% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000899% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000900% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000901%
902% A description of each parameter follows:
903%
904% o cache_view: the cache view.
905%
906% o virtual_pixel_method: the virtual pixel method.
907%
908% o x,y: These values define the offset of the pixel.
909%
910% o pixel: return a pixel at the specified (x,y) location.
911%
912% o exception: return any errors or warnings in this structure.
913%
914*/
915MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
916 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000917 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000918{
cristy5c9e6f22010-09-17 17:31:01 +0000919 const int
920 id = GetOpenMPThreadId();
921
cristy4c08aed2011-07-01 19:47:50 +0000922 const Quantum
923 *p;
cristy3ed852e2009-09-05 21:47:34 +0000924
cristy2ed42f62011-10-02 19:49:57 +0000925 register ssize_t
926 i;
927
cristy3ed852e2009-09-05 21:47:34 +0000928 assert(cache_view != (CacheView *) NULL);
929 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000930 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000931 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000932 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
933 cache_view->nexus_info[id],exception);
934 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000935 {
cristyd09f8802012-02-04 16:44:10 +0000936 PixelInfo
937 background_color;
938
939 background_color=cache_view->image->background_color;
940 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
941 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
942 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
943 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
944 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000945 return(MagickFalse);
946 }
947 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
948 {
949 PixelChannel
950 channel;
951
cristye2a912b2011-12-05 20:02:07 +0000952 channel=GetPixelChannelMapChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000953 pixel[channel]=p[i];
954 }
cristy3ed852e2009-09-05 21:47:34 +0000955 return(MagickTrue);
956}
957
958/*
959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
960% %
961% %
962% %
963% 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 %
964% %
965% %
966% %
967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
968%
969% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
970% disk pixel cache as defined by the geometry parameters. A pointer to the
971% pixels is returned if the pixels are transferred, otherwise a NULL is
972% returned.
973%
974% The format of the QueueCacheViewAuthenticPixels method is:
975%
cristy4c08aed2011-07-01 19:47:50 +0000976% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000977% const ssize_t x,const ssize_t y,const size_t columns,
978% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000979%
980% A description of each parameter follows:
981%
982% o cache_view: the cache view.
983%
984% o x,y,columns,rows: These values define the perimeter of a region of
985% pixels.
986%
987% o exception: return any errors or warnings in this structure.
988%
989*/
cristy4c08aed2011-07-01 19:47:50 +0000990MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000991 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
992 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000993{
cristy5c9e6f22010-09-17 17:31:01 +0000994 const int
995 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000996
cristy4c08aed2011-07-01 19:47:50 +0000997 Quantum
998 *pixels;
999
cristy3ed852e2009-09-05 21:47:34 +00001000 assert(cache_view != (CacheView *) NULL);
1001 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001002 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +00001003 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
1004 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +00001005 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +00001006}
1007
1008/*
1009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1010% %
1011% %
1012% %
1013% S e t C a c h e V i e w S t o r a g e C l a s s %
1014% %
1015% %
1016% %
1017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1018%
1019% SetCacheViewStorageClass() sets the image storage class associated with
1020% the specified view.
1021%
1022% The format of the SetCacheViewStorageClass method is:
1023%
1024% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001025% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001026%
1027% A description of each parameter follows:
1028%
1029% o cache_view: the cache view.
1030%
1031% o storage_class: the image storage class: PseudoClass or DirectClass.
1032%
cristyc82a27b2011-10-21 01:07:16 +00001033% o exception: return any errors or warnings in this structure.
1034%
cristy3ed852e2009-09-05 21:47:34 +00001035*/
1036MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001037 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001038{
1039 assert(cache_view != (CacheView *) NULL);
1040 assert(cache_view->signature == MagickSignature);
1041 if (cache_view->debug != MagickFalse)
1042 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1043 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +00001044 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +00001045}
1046
1047/*
1048%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1049% %
1050% %
1051% %
1052% 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 %
1053% %
1054% %
1055% %
1056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1057%
1058% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1059% with the specified cache view.
1060%
1061% The format of the SetCacheViewVirtualPixelMethod method is:
1062%
1063% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1064% const VirtualPixelMethod virtual_pixel_method)
1065%
1066% A description of each parameter follows:
1067%
1068% o cache_view: the cache view.
1069%
1070% o virtual_pixel_method: the virtual pixel method.
1071%
1072*/
1073MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1074 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
1075{
1076 assert(cache_view != (CacheView *) NULL);
1077 assert(cache_view->signature == MagickSignature);
1078 if (cache_view->debug != MagickFalse)
1079 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1080 cache_view->image->filename);
1081 cache_view->virtual_pixel_method=virtual_pixel_method;
1082 return(MagickTrue);
1083}
1084
1085/*
1086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1087% %
1088% %
1089% %
1090% 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 %
1091% %
1092% %
1093% %
1094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1095%
1096% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1097% or disk cache. It returns MagickTrue if the pixel region is flushed,
1098% otherwise MagickFalse.
1099%
1100% The format of the SyncCacheViewAuthenticPixels method is:
1101%
1102% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1103% ExceptionInfo *exception)
1104%
1105% A description of each parameter follows:
1106%
1107% o cache_view: the cache view.
1108%
1109% o exception: return any errors or warnings in this structure.
1110%
1111*/
1112MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1113 CacheView *cache_view,ExceptionInfo *exception)
1114{
cristy5c9e6f22010-09-17 17:31:01 +00001115 const int
1116 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001117
cristy4c08aed2011-07-01 19:47:50 +00001118 MagickBooleanType
1119 status;
1120
cristy3ed852e2009-09-05 21:47:34 +00001121 assert(cache_view != (CacheView *) NULL);
1122 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001123 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001124 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1125 cache_view->nexus_info[id],exception);
1126 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001127}