blob: 443f87974afc8dafdb1e025d923fcfb6121e2c05 [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);
cristyd99b5a52012-10-27 23:07:47 +0000170 cache_view->number_threads=GetOpenMPMaximumThreads();
171 if (GetMagickResourceLimit(ThreadResource) > cache_view->number_threads)
172 cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
173 if (cache_view->number_threads == 0)
174 cache_view->number_threads=1;
cristy3ed852e2009-09-05 21:47:34 +0000175 cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
176 cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
177 cache_view->debug=IsEventLogging();
178 cache_view->signature=MagickSignature;
179 if (cache_view->nexus_info == (NexusInfo **) NULL)
180 ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
181 return(cache_view);
182}
183
184/*
185%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
186% %
187% %
188% %
189% C l o n e C a c h e V i e w %
190% %
191% %
192% %
193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
194%
195% CloneCacheView() makes an exact copy of the specified cache view.
196%
197% The format of the CloneCacheView method is:
198%
199% CacheView *CloneCacheView(const CacheView *cache_view)
200%
201% A description of each parameter follows:
202%
203% o cache_view: the cache view.
204%
205*/
206MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
207{
208 CacheView
209 *clone_view;
210
211 assert(cache_view != (CacheView *) NULL);
212 assert(cache_view->signature == MagickSignature);
213 if (cache_view->debug != MagickFalse)
214 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
215 cache_view->image->filename);
cristye42639a2012-08-23 01:53:24 +0000216 clone_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
217 sizeof(*clone_view)));
cristy3ed852e2009-09-05 21:47:34 +0000218 if (clone_view == (CacheView *) NULL)
219 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
220 (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
221 clone_view->image=ReferenceImage(cache_view->image);
222 clone_view->number_threads=cache_view->number_threads;
223 clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
224 clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
225 clone_view->debug=cache_view->debug;
226 clone_view->signature=MagickSignature;
227 return(clone_view);
228}
229
230/*
231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232% %
233% %
234% %
235% D e s t r o y C a c h e V i e w %
236% %
237% %
238% %
239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
240%
241% DestroyCacheView() destroys the specified view returned by a previous call
242% to AcquireCacheView().
243%
244% The format of the DestroyCacheView method is:
245%
246% CacheView *DestroyCacheView(CacheView *cache_view)
247%
248% A description of each parameter follows:
249%
250% o cache_view: the cache view.
251%
252*/
253MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
254{
255 assert(cache_view != (CacheView *) NULL);
256 assert(cache_view->signature == MagickSignature);
257 if (cache_view->debug != MagickFalse)
258 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
259 cache_view->image->filename);
260 if (cache_view->nexus_info != (NexusInfo **) NULL)
261 cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
262 cache_view->number_threads);
263 cache_view->image=DestroyImage(cache_view->image);
264 cache_view->signature=(~MagickSignature);
cristy27d53d62012-07-29 23:30:07 +0000265 cache_view=(CacheView *) RelinquishAlignedMemory(cache_view);
cristy3ed852e2009-09-05 21:47:34 +0000266 return(cache_view);
267}
268
269/*
270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271% %
272% %
273% %
cristye7516622012-04-29 14:22:45 +0000274% 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 %
275% %
276% %
277% %
278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279%
280% GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
281% cache as defined by the geometry parameters. A pointer to the pixels is
282% returned if the pixels are transferred, otherwise a NULL is returned.
283%
284% The format of the GetCacheViewAuthenticPixels method is:
285%
286% Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
287% const ssize_t x,const ssize_t y,const size_t columns,
288% const size_t rows,ExceptionInfo *exception)
289%
290% A description of each parameter follows:
291%
292% o cache_view: the cache view.
293%
294% o x,y,columns,rows: These values define the perimeter of a region of
295% pixels.
296%
297% o exception: return any errors or warnings in this structure.
298%
299*/
300MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
301 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
302 ExceptionInfo *exception)
303{
304 const int
305 id = GetOpenMPThreadId();
306
307 Quantum
308 *pixels;
309
310 assert(cache_view != (CacheView *) NULL);
311 assert(cache_view->signature == MagickSignature);
312 assert(id < (int) cache_view->number_threads);
313 pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
314 cache_view->nexus_info[id],exception);
315 return(pixels);
316}
317
318/*
319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
320% %
321% %
322% %
323% 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 %
324% %
325% %
326% %
327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328%
329% GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
330% with the last call to SetCacheViewIndexes() or
331% GetCacheViewAuthenticMetacontent(). The meta-content are authentic and can
332% be updated.
333%
334% The format of the GetCacheViewAuthenticMetacontent() method is:
335%
336% void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
337%
338% A description of each parameter follows:
339%
340% o cache_view: the cache view.
341%
342*/
343MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
344{
345 const int
346 id = GetOpenMPThreadId();
347
348 void
349 *metacontent;
350
351 assert(cache_view != (CacheView *) NULL);
352 assert(cache_view->signature == MagickSignature);
353 assert(cache_view->image->cache != (Cache) NULL);
354 assert(id < (int) cache_view->number_threads);
355 metacontent=GetPixelCacheNexusMetacontent(cache_view->image->cache,
356 cache_view->nexus_info[id]);
357 return(metacontent);
358}
359
360/*
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362% %
363% %
364% %
365% 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 %
366% %
367% %
368% %
369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370%
371% GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
372% last call to QueueCacheViewAuthenticPixels() or
373% GetCacheViewAuthenticPixels(). The pixels are authentic and therefore can be
374% updated.
375%
376% The format of the GetCacheViewAuthenticPixelQueue() method is:
377%
378% Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
379%
380% A description of each parameter follows:
381%
382% o cache_view: the cache view.
383%
384*/
385MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
386{
387 const int
388 id = GetOpenMPThreadId();
389
390 Quantum
391 *pixels;
392
393 assert(cache_view != (CacheView *) NULL);
394 assert(cache_view->signature == MagickSignature);
395 assert(cache_view->image->cache != (Cache) NULL);
396 assert(id < (int) cache_view->number_threads);
397 pixels=GetPixelCacheNexusPixels(cache_view->image->cache,
398 cache_view->nexus_info[id]);
399 return(pixels);
400}
401
402/*
403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404% %
405% %
406% %
cristy3ed852e2009-09-05 21:47:34 +0000407% G e t C a c h e V i e w C o l o r s p a c e %
408% %
409% %
410% %
411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
412%
413% GetCacheViewColorspace() returns the image colorspace associated with the
414% specified view.
415%
416% The format of the GetCacheViewColorspace method is:
417%
418% ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
419%
420% A description of each parameter follows:
421%
422% o cache_view: the cache view.
423%
424*/
425MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
426{
427 assert(cache_view != (CacheView *) NULL);
428 assert(cache_view->signature == MagickSignature);
429 if (cache_view->debug != MagickFalse)
430 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
431 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000432 return(GetPixelCacheColorspace(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000433}
434
435/*
436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437% %
438% %
439% %
cristy3ed852e2009-09-05 21:47:34 +0000440+ G e t C a c h e V i e w E x t e n t %
441% %
442% %
443% %
444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
445%
446% GetCacheViewExtent() returns the extent of the pixels associated with the
447% last call to QueueCacheViewAuthenticPixels() or
448% GetCacheViewAuthenticPixels().
449%
450% The format of the GetCacheViewExtent() method is:
451%
452% MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
453%
454% A description of each parameter follows:
455%
456% o cache_view: the cache view.
457%
458*/
459MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
460{
cristy5c9e6f22010-09-17 17:31:01 +0000461 const int
462 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +0000463
cristy4c08aed2011-07-01 19:47:50 +0000464 MagickSizeType
465 extent;
466
cristy3ed852e2009-09-05 21:47:34 +0000467 assert(cache_view != (CacheView *) NULL);
468 assert(cache_view->signature == MagickSignature);
469 if (cache_view->debug != MagickFalse)
470 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
471 cache_view->image->filename);
472 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000473 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000474 extent=GetPixelCacheNexusExtent(cache_view->image->cache,
475 cache_view->nexus_info[id]);
476 return(extent);
cristy3ed852e2009-09-05 21:47:34 +0000477}
478
479/*
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481% %
482% %
483% %
cristye7516622012-04-29 14:22:45 +0000484% G e t C a c h e V i e w I m a g e %
485% %
486% %
487% %
488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489%
490% GetCacheViewImage() returns the image associated with the specified view.
491%
492% The format of the GetCacheViewImage method is:
493%
494% const Image *GetCacheViewImage(const CacheView *cache_view)
495%
496% A description of each parameter follows:
497%
498% o cache_view: the cache view.
499%
500*/
501MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
502{
503 assert(cache_view != (CacheView *) NULL);
504 assert(cache_view->signature == MagickSignature);
505 if (cache_view->debug != MagickFalse)
506 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
507 cache_view->image->filename);
508 return(cache_view->image);
509}
510
511/*
512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513% %
514% %
515% %
cristy3ed852e2009-09-05 21:47:34 +0000516% G e t C a c h e V i e w S t o r a g e C l a s s %
517% %
518% %
519% %
520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521%
cristye7516622012-04-29 14:22:45 +0000522% GetCacheViewStorageClass() returns the image storage class associated with
cristy3ed852e2009-09-05 21:47:34 +0000523% the specified view.
524%
525% The format of the GetCacheViewStorageClass method is:
526%
527% ClassType GetCacheViewStorageClass(const CacheView *cache_view)
528%
529% A description of each parameter follows:
530%
531% o cache_view: the cache view.
532%
533*/
534MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
535{
536 assert(cache_view != (CacheView *) NULL);
537 assert(cache_view->signature == MagickSignature);
538 if (cache_view->debug != MagickFalse)
539 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
540 cache_view->image->filename);
cristy0d267172011-04-25 20:13:48 +0000541 return(GetPixelCacheStorageClass(cache_view->image->cache));
cristy3ed852e2009-09-05 21:47:34 +0000542}
543
544/*
545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
546% %
547% %
548% %
cristy4c08aed2011-07-01 19:47:50 +0000549% 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 +0000550% %
551% %
552% %
553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554%
cristy4c08aed2011-07-01 19:47:50 +0000555% GetCacheViewVirtualMetacontent() returns the meta-content corresponding
556% with the last call to GetCacheViewVirtualMetacontent(). The meta-content
557% is virtual and therefore cannot be updated.
cristy3ed852e2009-09-05 21:47:34 +0000558%
cristy4c08aed2011-07-01 19:47:50 +0000559% The format of the GetCacheViewVirtualMetacontent() method is:
cristy3ed852e2009-09-05 21:47:34 +0000560%
cristy4c08aed2011-07-01 19:47:50 +0000561% const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000562% const CacheView *cache_view)
563%
564% A description of each parameter follows:
565%
566% o cache_view: the cache view.
567%
568*/
cristy4c08aed2011-07-01 19:47:50 +0000569MagickExport const void *GetCacheViewVirtualMetacontent(
cristy3ed852e2009-09-05 21:47:34 +0000570 const CacheView *cache_view)
571{
cristy5c9e6f22010-09-17 17:31:01 +0000572 const int
573 id = GetOpenMPThreadId();
cristy3ed852e2009-09-05 21:47:34 +0000574
cristy4c08aed2011-07-01 19:47:50 +0000575 const void
576 *metacontent;
577
cristy3ed852e2009-09-05 21:47:34 +0000578 assert(cache_view != (const CacheView *) NULL);
579 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000580 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000581 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000582 metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
583 cache_view->nexus_info[id]);
584 return(metacontent);
cristy3ed852e2009-09-05 21:47:34 +0000585}
586
587/*
588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589% %
590% %
591% %
592% 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 %
593% %
594% %
595% %
596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
597%
598% GetCacheViewVirtualPixelQueue() returns the the pixels associated with
599% the last call to GetCacheViewVirtualPixels(). The pixels are virtual
600% and therefore cannot be updated.
601%
602% The format of the GetCacheViewVirtualPixelQueue() method is:
603%
cristy4c08aed2011-07-01 19:47:50 +0000604% const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000605% const CacheView *cache_view)
606%
607% A description of each parameter follows:
608%
609% o cache_view: the cache view.
610%
611*/
cristy4c08aed2011-07-01 19:47:50 +0000612MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
cristy3ed852e2009-09-05 21:47:34 +0000613 const CacheView *cache_view)
614{
cristy5c9e6f22010-09-17 17:31:01 +0000615 const int
616 id = GetOpenMPThreadId();
617
cristy4c08aed2011-07-01 19:47:50 +0000618 const Quantum
619 *pixels;
620
cristy3ed852e2009-09-05 21:47:34 +0000621 assert(cache_view != (const CacheView *) NULL);
622 assert(cache_view->signature == MagickSignature);
cristy3ed852e2009-09-05 21:47:34 +0000623 assert(cache_view->image->cache != (Cache) NULL);
cristy4205a3c2010-09-12 20:19:59 +0000624 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000625 pixels=GetVirtualPixelsNexus(cache_view->image->cache,
626 cache_view->nexus_info[id]);
627 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +0000628}
629
630/*
631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632% %
633% %
634% %
635% 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 %
636% %
637% %
638% %
639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
640%
641% GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
642% disk pixel cache as defined by the geometry parameters. A pointer to the
643% pixels is returned if the pixels are transferred, otherwise a NULL is
644% returned.
645%
646% The format of the GetCacheViewVirtualPixels method is:
647%
cristy4c08aed2011-07-01 19:47:50 +0000648% const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000649% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristye076a6e2010-08-15 19:59:43 +0000650% const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000651%
652% A description of each parameter follows:
653%
654% o cache_view: the cache view.
655%
656% o x,y,columns,rows: These values define the perimeter of a region of
657% pixels.
658%
659% o exception: return any errors or warnings in this structure.
660%
661*/
cristy4c08aed2011-07-01 19:47:50 +0000662MagickExport const Quantum *GetCacheViewVirtualPixels(
cristybb503372010-05-27 20:51:26 +0000663 const CacheView *cache_view,const ssize_t x,const ssize_t y,
664 const size_t columns,const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000665{
cristy5c9e6f22010-09-17 17:31:01 +0000666 const int
667 id = GetOpenMPThreadId();
668
cristy4c08aed2011-07-01 19:47:50 +0000669 const Quantum
670 *pixels;
671
cristy3ed852e2009-09-05 21:47:34 +0000672 assert(cache_view != (CacheView *) NULL);
673 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000674 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +0000675 pixels=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000676 cache_view->virtual_pixel_method,x,y,columns,rows,
cristy4c08aed2011-07-01 19:47:50 +0000677 cache_view->nexus_info[id],exception);
678 return(pixels);
679}
680
681/*
682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
683% %
684% %
685% %
686% 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 %
687% %
688% %
689% %
690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
691%
692% GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
693% location. The image background color is returned if an error occurs.
694%
695% The format of the GetOneCacheViewAuthenticPixel method is:
696%
697% MagickBooleaNType GetOneCacheViewAuthenticPixel(
698% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000699% Quantum *pixel,ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000700%
701% A description of each parameter follows:
702%
703% o cache_view: the cache view.
704%
705% o x,y: These values define the offset of the pixel.
706%
707% o pixel: return a pixel at the specified (x,y) location.
708%
709% o exception: return any errors or warnings in this structure.
710%
711*/
712MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
cristy2ed42f62011-10-02 19:49:57 +0000713 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
714 ExceptionInfo *exception)
cristy4c08aed2011-07-01 19:47:50 +0000715{
716 const int
717 id = GetOpenMPThreadId();
718
719 Quantum
720 *p;
721
cristy2ed42f62011-10-02 19:49:57 +0000722 register ssize_t
723 i;
724
cristy4c08aed2011-07-01 19:47:50 +0000725 assert(cache_view != (CacheView *) NULL);
726 assert(cache_view->signature == MagickSignature);
cristy4c08aed2011-07-01 19:47:50 +0000727 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000728 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000729 p=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
730 cache_view->nexus_info[id],exception);
731 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000732 {
cristyd09f8802012-02-04 16:44:10 +0000733 PixelInfo
734 background_color;
735
736 background_color=cache_view->image->background_color;
737 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
738 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
739 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
740 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
741 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000742 return(MagickFalse);
743 }
744 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
745 {
746 PixelChannel
747 channel;
748
cristycf1296e2012-08-26 23:40:49 +0000749 channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000750 pixel[channel]=p[i];
751 }
cristy4c08aed2011-07-01 19:47:50 +0000752 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +0000753}
754
755/*
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757% %
758% %
759% %
760% 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 %
761% %
762% %
763% %
764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765%
766% GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
767% location. The image background color is returned if an error occurs. If
768% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
769%
770% The format of the GetOneCacheViewVirtualPixel method is:
771%
772% MagickBooleanType GetOneCacheViewVirtualPixel(
cristybb503372010-05-27 20:51:26 +0000773% const CacheView *cache_view,const ssize_t x,const ssize_t y,
cristy2ed42f62011-10-02 19:49:57 +0000774% Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000775%
776% A description of each parameter follows:
777%
778% o cache_view: the cache view.
779%
780% o x,y: These values define the offset of the pixel.
781%
782% o pixel: return a pixel at the specified (x,y) location.
783%
784% o exception: return any errors or warnings in this structure.
785%
786*/
787MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
cristy2ed42f62011-10-02 19:49:57 +0000788 const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
789 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000790{
cristy5c9e6f22010-09-17 17:31:01 +0000791 const int
792 id = GetOpenMPThreadId();
793
cristyf05d4942012-03-17 16:26:09 +0000794 register const Quantum
cristy4c08aed2011-07-01 19:47:50 +0000795 *p;
cristy3ed852e2009-09-05 21:47:34 +0000796
cristy2ed42f62011-10-02 19:49:57 +0000797 register ssize_t
798 i;
799
cristy3ed852e2009-09-05 21:47:34 +0000800 assert(cache_view != (CacheView *) NULL);
801 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000802 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000803 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000804 p=GetVirtualPixelsFromNexus(cache_view->image,
cristy3ed852e2009-09-05 21:47:34 +0000805 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
806 exception);
cristy4c08aed2011-07-01 19:47:50 +0000807 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000808 {
cristyd09f8802012-02-04 16:44:10 +0000809 PixelInfo
810 background_color;
811
812 background_color=cache_view->image->background_color;
813 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
814 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
815 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
816 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
817 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000818 return(MagickFalse);
819 }
820 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
821 {
822 PixelChannel
823 channel;
824
cristycf1296e2012-08-26 23:40:49 +0000825 channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000826 pixel[channel]=p[i];
827 }
cristy3ed852e2009-09-05 21:47:34 +0000828 return(MagickTrue);
829}
830
831/*
832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
833% %
834% %
835% %
cristyf05d4942012-03-17 16:26:09 +0000836% 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 %
837% %
838% %
839% %
840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
841%
842% GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
843% (x,y) location. The image background color is returned if an error occurs.
844% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
845%
846% The format of the GetOneCacheViewVirtualPixelInfo method is:
847%
848% MagickBooleanType GetOneCacheViewVirtualPixelInfo(
849% const CacheView *cache_view,const ssize_t x,const ssize_t y,
850% PixelInfo *pixel,ExceptionInfo *exception)
851%
852% A description of each parameter follows:
853%
854% o cache_view: the cache view.
855%
856% o x,y: These values define the offset of the pixel.
857%
858% o pixel: return a pixel at the specified (x,y) location.
859%
860% o exception: return any errors or warnings in this structure.
861%
862*/
863MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
864 const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
865 ExceptionInfo *exception)
866{
867 const int
868 id = GetOpenMPThreadId();
869
870 register const Quantum
871 *p;
872
873 assert(cache_view != (CacheView *) NULL);
874 assert(cache_view->signature == MagickSignature);
875 assert(id < (int) cache_view->number_threads);
cristyf82cff82012-04-16 16:54:17 +0000876 GetPixelInfo(cache_view->image,pixel);
cristyf05d4942012-03-17 16:26:09 +0000877 p=GetVirtualPixelsFromNexus(cache_view->image,
878 cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
879 exception);
cristyf05d4942012-03-17 16:26:09 +0000880 if (p == (const Quantum *) NULL)
881 return(MagickFalse);
882 GetPixelInfoPixel(cache_view->image,p,pixel);
883 return(MagickTrue);
884}
885
886/*
887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888% %
889% %
890% %
cristy3ed852e2009-09-05 21:47:34 +0000891% 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 %
892% %
893% %
894% %
895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896%
897% GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
898% the specified (x,y) location. The image background color is returned if an
899% error occurs. If you plan to modify the pixel, use
900% GetOneCacheViewAuthenticPixel() instead.
901%
902% The format of the GetOneCacheViewVirtualPixel method is:
903%
904% MagickBooleanType GetOneCacheViewVirtualMethodPixel(
905% const CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000906% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
cristy2ed42f62011-10-02 19:49:57 +0000907% const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000908%
909% A description of each parameter follows:
910%
911% o cache_view: the cache view.
912%
913% o virtual_pixel_method: the virtual pixel method.
914%
915% o x,y: These values define the offset of the pixel.
916%
917% o pixel: return a pixel at the specified (x,y) location.
918%
919% o exception: return any errors or warnings in this structure.
920%
921*/
922MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
923 const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
cristy2ed42f62011-10-02 19:49:57 +0000924 const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000925{
cristy5c9e6f22010-09-17 17:31:01 +0000926 const int
927 id = GetOpenMPThreadId();
928
cristy4c08aed2011-07-01 19:47:50 +0000929 const Quantum
930 *p;
cristy3ed852e2009-09-05 21:47:34 +0000931
cristy2ed42f62011-10-02 19:49:57 +0000932 register ssize_t
933 i;
934
cristy3ed852e2009-09-05 21:47:34 +0000935 assert(cache_view != (CacheView *) NULL);
936 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +0000937 assert(id < (int) cache_view->number_threads);
cristy2ed42f62011-10-02 19:49:57 +0000938 (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
cristy4c08aed2011-07-01 19:47:50 +0000939 p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
940 cache_view->nexus_info[id],exception);
941 if (p == (const Quantum *) NULL)
cristy2ed42f62011-10-02 19:49:57 +0000942 {
cristyd09f8802012-02-04 16:44:10 +0000943 PixelInfo
944 background_color;
945
946 background_color=cache_view->image->background_color;
947 pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
948 pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
949 pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
950 pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
951 pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
cristy2ed42f62011-10-02 19:49:57 +0000952 return(MagickFalse);
953 }
954 for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
955 {
956 PixelChannel
957 channel;
958
cristycf1296e2012-08-26 23:40:49 +0000959 channel=GetPixelChannelChannel(cache_view->image,i);
cristy2ed42f62011-10-02 19:49:57 +0000960 pixel[channel]=p[i];
961 }
cristy3ed852e2009-09-05 21:47:34 +0000962 return(MagickTrue);
963}
964
965/*
966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
967% %
968% %
969% %
970% 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 %
971% %
972% %
973% %
974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
975%
976% QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
977% disk pixel cache as defined by the geometry parameters. A pointer to the
978% pixels is returned if the pixels are transferred, otherwise a NULL is
979% returned.
980%
981% The format of the QueueCacheViewAuthenticPixels method is:
982%
cristy4c08aed2011-07-01 19:47:50 +0000983% Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristybb503372010-05-27 20:51:26 +0000984% const ssize_t x,const ssize_t y,const size_t columns,
985% const size_t rows,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000986%
987% A description of each parameter follows:
988%
989% o cache_view: the cache view.
990%
991% o x,y,columns,rows: These values define the perimeter of a region of
992% pixels.
993%
994% o exception: return any errors or warnings in this structure.
995%
996*/
cristy4c08aed2011-07-01 19:47:50 +0000997MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
cristy30097232010-07-01 02:16:30 +0000998 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
999 ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001000{
cristy5c9e6f22010-09-17 17:31:01 +00001001 const int
1002 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001003
cristy4c08aed2011-07-01 19:47:50 +00001004 Quantum
1005 *pixels;
1006
cristy3ed852e2009-09-05 21:47:34 +00001007 assert(cache_view != (CacheView *) NULL);
1008 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001009 assert(id < (int) cache_view->number_threads);
cristyc11dace2012-01-24 16:39:46 +00001010 pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
1011 MagickFalse,cache_view->nexus_info[id],exception);
cristy4c08aed2011-07-01 19:47:50 +00001012 return(pixels);
cristy3ed852e2009-09-05 21:47:34 +00001013}
1014
1015/*
1016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017% %
1018% %
1019% %
1020% S e t C a c h e V i e w S t o r a g e C l a s s %
1021% %
1022% %
1023% %
1024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025%
1026% SetCacheViewStorageClass() sets the image storage class associated with
1027% the specified view.
1028%
1029% The format of the SetCacheViewStorageClass method is:
1030%
1031% MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001032% const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001033%
1034% A description of each parameter follows:
1035%
1036% o cache_view: the cache view.
1037%
1038% o storage_class: the image storage class: PseudoClass or DirectClass.
1039%
cristyc82a27b2011-10-21 01:07:16 +00001040% o exception: return any errors or warnings in this structure.
1041%
cristy3ed852e2009-09-05 21:47:34 +00001042*/
1043MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
cristyc82a27b2011-10-21 01:07:16 +00001044 const ClassType storage_class,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001045{
1046 assert(cache_view != (CacheView *) NULL);
1047 assert(cache_view->signature == MagickSignature);
1048 if (cache_view->debug != MagickFalse)
1049 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1050 cache_view->image->filename);
cristyc82a27b2011-10-21 01:07:16 +00001051 return(SetImageStorageClass(cache_view->image,storage_class,exception));
cristy3ed852e2009-09-05 21:47:34 +00001052}
1053
1054/*
1055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1056% %
1057% %
1058% %
1059% 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 %
1060% %
1061% %
1062% %
1063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1064%
1065% SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1066% with the specified cache view.
1067%
1068% The format of the SetCacheViewVirtualPixelMethod method is:
1069%
1070% MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1071% const VirtualPixelMethod virtual_pixel_method)
1072%
1073% A description of each parameter follows:
1074%
1075% o cache_view: the cache view.
1076%
1077% o virtual_pixel_method: the virtual pixel method.
1078%
1079*/
1080MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1081 CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method)
1082{
1083 assert(cache_view != (CacheView *) NULL);
1084 assert(cache_view->signature == MagickSignature);
1085 if (cache_view->debug != MagickFalse)
1086 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1087 cache_view->image->filename);
1088 cache_view->virtual_pixel_method=virtual_pixel_method;
1089 return(MagickTrue);
1090}
1091
1092/*
1093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1094% %
1095% %
1096% %
1097% 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 %
1098% %
1099% %
1100% %
1101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1102%
1103% SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1104% or disk cache. It returns MagickTrue if the pixel region is flushed,
1105% otherwise MagickFalse.
1106%
1107% The format of the SyncCacheViewAuthenticPixels method is:
1108%
1109% MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1110% ExceptionInfo *exception)
1111%
1112% A description of each parameter follows:
1113%
1114% o cache_view: the cache view.
1115%
1116% o exception: return any errors or warnings in this structure.
1117%
1118*/
1119MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1120 CacheView *cache_view,ExceptionInfo *exception)
1121{
cristy5c9e6f22010-09-17 17:31:01 +00001122 const int
1123 id = GetOpenMPThreadId();
cristy4205a3c2010-09-12 20:19:59 +00001124
cristy4c08aed2011-07-01 19:47:50 +00001125 MagickBooleanType
1126 status;
1127
cristy3ed852e2009-09-05 21:47:34 +00001128 assert(cache_view != (CacheView *) NULL);
1129 assert(cache_view->signature == MagickSignature);
cristy4205a3c2010-09-12 20:19:59 +00001130 assert(id < (int) cache_view->number_threads);
cristy4c08aed2011-07-01 19:47:50 +00001131 status=SyncAuthenticPixelCacheNexus(cache_view->image,
1132 cache_view->nexus_info[id],exception);
1133 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001134}