Home | History | Annotate | Download | only in MagickCore
      1 /*
      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 %                                   Cristy                                    %
     23 %                               February 2000                                 %
     24 %                                                                             %
     25 %                                                                             %
     26 %  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
     27 %  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 /*
     48   Include declarations.
     49 */
     50 #include "MagickCore/studio.h"
     51 #include "MagickCore/cache.h"
     52 #include "MagickCore/cache-private.h"
     53 #include "MagickCore/cache-view.h"
     54 #include "MagickCore/memory_.h"
     55 #include "MagickCore/memory-private.h"
     56 #include "MagickCore/exception.h"
     57 #include "MagickCore/exception-private.h"
     58 #include "MagickCore/pixel-accessor.h"
     59 #include "MagickCore/resource_.h"
     60 #include "MagickCore/string_.h"
     61 #include "MagickCore/thread-private.h"
     62 
     63 /*
     65   Typedef declarations.
     66 */
     67 struct _CacheView
     68 {
     69   Image
     70     *image;
     71 
     72   VirtualPixelMethod
     73     virtual_pixel_method;
     74 
     75   size_t
     76     number_threads;
     77 
     78   NexusInfo
     79     **nexus_info;
     80 
     81   MagickBooleanType
     82     debug;
     83 
     84   size_t
     85     signature;
     86 };
     87 
     88 /*
     90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     91 %                                                                             %
     92 %                                                                             %
     93 %                                                                             %
     94 %   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                         %
     95 %                                                                             %
     96 %                                                                             %
     97 %                                                                             %
     98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     99 %
    100 %  AcquireAuthenticCacheView() acquires an authentic view into the pixel cache.
    101 %  It always succeeds but may return a warning or informational exception.
    102 %
    103 %  The format of the AcquireAuthenticCacheView method is:
    104 %
    105 %      CacheView *AcquireAuthenticCacheView(const Image *image,
    106 %        ExceptionInfo *exception)
    107 %
    108 %  A description of each parameter follows:
    109 %
    110 %    o image: the image.
    111 %
    112 %    o exception: return any errors or warnings in this structure.
    113 %
    114 */
    115 MagickExport CacheView *AcquireAuthenticCacheView(const Image *image,
    116   ExceptionInfo *exception)
    117 {
    118   CacheView
    119     *magick_restrict cache_view;
    120 
    121   cache_view=AcquireVirtualCacheView(image,exception);
    122   return(cache_view);
    123 }
    124 
    125 /*
    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 %  It always succeeds but may return a warning or informational exception.
    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 */
    153 MagickExport CacheView *AcquireVirtualCacheView(const Image *image,
    154   ExceptionInfo *exception)
    155 {
    156   CacheView
    157     *magick_restrict cache_view;
    158 
    159   magick_unreferenced(exception);
    160   assert(image != (Image *) NULL);
    161   assert(image->signature == MagickCoreSignature);
    162   if (image->debug != MagickFalse)
    163     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
    164 #if defined(MAGICKCORE_OPENCL_SUPPORT)
    165   SyncAuthenticOpenCLBuffer(image);
    166 #endif
    167   cache_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
    168     sizeof(*cache_view)));
    169   if (cache_view == (CacheView *) NULL)
    170     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
    171   (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view));
    172   cache_view->image=ReferenceImage((Image *) image);
    173   cache_view->number_threads=GetOpenMPMaximumThreads();
    174   if (GetMagickResourceLimit(ThreadResource) > cache_view->number_threads)
    175     cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
    176   if (cache_view->number_threads == 0)
    177     cache_view->number_threads=1;
    178   cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
    179   cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
    180   cache_view->debug=IsEventLogging();
    181   cache_view->signature=MagickCoreSignature;
    182   if (cache_view->nexus_info == (NexusInfo **) NULL)
    183     ThrowFatalException(CacheFatalError,"UnableToAcquireCacheView");
    184   return(cache_view);
    185 }
    186 
    187 /*
    189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    190 %                                                                             %
    191 %                                                                             %
    192 %                                                                             %
    193 %   C l o n e C a c h e V i e w                                               %
    194 %                                                                             %
    195 %                                                                             %
    196 %                                                                             %
    197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    198 %
    199 %  CloneCacheView()  makes an exact copy of the specified cache view.
    200 %
    201 %  The format of the CloneCacheView method is:
    202 %
    203 %      CacheView *CloneCacheView(const CacheView *cache_view)
    204 %
    205 %  A description of each parameter follows:
    206 %
    207 %    o cache_view: the cache view.
    208 %
    209 */
    210 MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
    211 {
    212   CacheView
    213     *magick_restrict clone_view;
    214 
    215   assert(cache_view != (CacheView *) NULL);
    216   assert(cache_view->signature == MagickCoreSignature);
    217   if (cache_view->debug != MagickFalse)
    218     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
    219       cache_view->image->filename);
    220   clone_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
    221     sizeof(*clone_view)));
    222   if (clone_view == (CacheView *) NULL)
    223     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
    224   (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
    225   clone_view->image=ReferenceImage(cache_view->image);
    226   clone_view->number_threads=cache_view->number_threads;
    227   clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
    228   clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
    229   clone_view->debug=cache_view->debug;
    230   clone_view->signature=MagickCoreSignature;
    231   return(clone_view);
    232 }
    233 
    234 /*
    236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    237 %                                                                             %
    238 %                                                                             %
    239 %                                                                             %
    240 %   D e s t r o y C a c h e V i e w                                           %
    241 %                                                                             %
    242 %                                                                             %
    243 %                                                                             %
    244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    245 %
    246 %  DestroyCacheView() destroys the specified view returned by a previous call
    247 %  to AcquireCacheView().
    248 %
    249 %  The format of the DestroyCacheView method is:
    250 %
    251 %      CacheView *DestroyCacheView(CacheView *cache_view)
    252 %
    253 %  A description of each parameter follows:
    254 %
    255 %    o cache_view: the cache view.
    256 %
    257 */
    258 MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
    259 {
    260   assert(cache_view != (CacheView *) NULL);
    261   assert(cache_view->signature == MagickCoreSignature);
    262   if (cache_view->debug != MagickFalse)
    263     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
    264       cache_view->image->filename);
    265   if (cache_view->nexus_info != (NexusInfo **) NULL)
    266     cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
    267       cache_view->number_threads);
    268   cache_view->image=DestroyImage(cache_view->image);
    269   cache_view->signature=(~MagickCoreSignature);
    270   cache_view=(CacheView *) RelinquishAlignedMemory(cache_view);
    271   return(cache_view);
    272 }
    273 
    274 /*
    276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    277 %                                                                             %
    278 %                                                                             %
    279 %                                                                             %
    280 %   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                     %
    281 %                                                                             %
    282 %                                                                             %
    283 %                                                                             %
    284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    285 %
    286 %  GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
    287 %  cache as defined by the geometry parameters.   A pointer to the pixels is
    288 %  returned if the pixels are transferred, otherwise a NULL is returned.
    289 %
    290 %  The format of the GetCacheViewAuthenticPixels method is:
    291 %
    292 %      Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
    293 %        const ssize_t x,const ssize_t y,const size_t columns,
    294 %        const size_t rows,ExceptionInfo *exception)
    295 %
    296 %  A description of each parameter follows:
    297 %
    298 %    o cache_view: the cache view.
    299 %
    300 %    o x,y,columns,rows:  These values define the perimeter of a region of
    301 %      pixels.
    302 %
    303 %    o exception: return any errors or warnings in this structure.
    304 %
    305 */
    306 MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
    307   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
    308   ExceptionInfo *exception)
    309 {
    310   const int
    311     id = GetOpenMPThreadId();
    312 
    313   Quantum
    314     *magick_restrict pixels;
    315 
    316   assert(cache_view != (CacheView *) NULL);
    317   assert(cache_view->signature == MagickCoreSignature);
    318   assert(id < (int) cache_view->number_threads);
    319   pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
    320     cache_view->nexus_info[id],exception);
    321   return(pixels);
    322 }
    323 
    324 /*
    326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    327 %                                                                             %
    328 %                                                                             %
    329 %                                                                             %
    330 %   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           %
    331 %                                                                             %
    332 %                                                                             %
    333 %                                                                             %
    334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    335 %
    336 %  GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
    337 %  with the last call to SetCacheViewIndexes() or
    338 %  GetCacheViewAuthenticMetacontent().  The meta-content are authentic and can
    339 %  be updated.
    340 %
    341 %  The format of the GetCacheViewAuthenticMetacontent() method is:
    342 %
    343 %      void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
    344 %
    345 %  A description of each parameter follows:
    346 %
    347 %    o cache_view: the cache view.
    348 %
    349 */
    350 MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
    351 {
    352   const int
    353     id = GetOpenMPThreadId();
    354 
    355   assert(cache_view != (CacheView *) NULL);
    356   assert(cache_view->signature == MagickCoreSignature);
    357   assert(cache_view->image->cache != (Cache) NULL);
    358   assert(id < (int) cache_view->number_threads);
    359   return(cache_view->nexus_info[id]->metacontent);
    360 }
    361 
    362 /*
    364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    365 %                                                                             %
    366 %                                                                             %
    367 %                                                                             %
    368 %   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             %
    369 %                                                                             %
    370 %                                                                             %
    371 %                                                                             %
    372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    373 %
    374 %  GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
    375 %  last call to QueueCacheViewAuthenticPixels() or
    376 %  GetCacheViewAuthenticPixels().  The pixels are authentic and therefore can be
    377 %  updated.
    378 %
    379 %  The format of the GetCacheViewAuthenticPixelQueue() method is:
    380 %
    381 %      Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
    382 %
    383 %  A description of each parameter follows:
    384 %
    385 %    o cache_view: the cache view.
    386 %
    387 */
    388 MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
    389 {
    390   const int
    391     id = GetOpenMPThreadId();
    392 
    393   assert(cache_view != (CacheView *) NULL);
    394   assert(cache_view->signature == MagickCoreSignature);
    395   assert(cache_view->image->cache != (Cache) NULL);
    396   assert(id < (int) cache_view->number_threads);
    397   return(cache_view->nexus_info[id]->pixels);
    398 }
    399 
    400 /*
    402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    403 %                                                                             %
    404 %                                                                             %
    405 %                                                                             %
    406 %   G e t C a c h e V i e w C o l o r s p a c e                               %
    407 %                                                                             %
    408 %                                                                             %
    409 %                                                                             %
    410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    411 %
    412 %  GetCacheViewColorspace() returns the image colorspace associated with the
    413 %  specified view.
    414 %
    415 %  The format of the GetCacheViewColorspace method is:
    416 %
    417 %      ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
    418 %
    419 %  A description of each parameter follows:
    420 %
    421 %    o cache_view: the cache view.
    422 %
    423 */
    424 MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
    425 {
    426   assert(cache_view != (CacheView *) NULL);
    427   assert(cache_view->signature == MagickCoreSignature);
    428   if (cache_view->debug != MagickFalse)
    429     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
    430       cache_view->image->filename);
    431   return(GetPixelCacheColorspace(cache_view->image->cache));
    432 }
    433 
    434 /*
    436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    437 %                                                                             %
    438 %                                                                             %
    439 %                                                                             %
    440 +   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 */
    459 MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
    460 {
    461   const int
    462     id = GetOpenMPThreadId();
    463 
    464   MagickSizeType
    465     extent;
    466 
    467   assert(cache_view != (CacheView *) NULL);
    468   assert(cache_view->signature == MagickCoreSignature);
    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);
    473   assert(id < (int) cache_view->number_threads);
    474   extent=GetPixelCacheNexusExtent(cache_view->image->cache,
    475     cache_view->nexus_info[id]);
    476   return(extent);
    477 }
    478 
    479 /*
    481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    482 %                                                                             %
    483 %                                                                             %
    484 %                                                                             %
    485 %   G e t C a c h e V i e w I m a g e                                         %
    486 %                                                                             %
    487 %                                                                             %
    488 %                                                                             %
    489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    490 %
    491 %  GetCacheViewImage() returns the image associated with the specified view.
    492 %
    493 %  The format of the GetCacheViewImage method is:
    494 %
    495 %      const Image *GetCacheViewImage(const CacheView *cache_view)
    496 %
    497 %  A description of each parameter follows:
    498 %
    499 %    o cache_view: the cache view.
    500 %
    501 */
    502 MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
    503 {
    504   assert(cache_view != (CacheView *) NULL);
    505   assert(cache_view->signature == MagickCoreSignature);
    506   if (cache_view->debug != MagickFalse)
    507     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
    508       cache_view->image->filename);
    509   return(cache_view->image);
    510 }
    511 
    512 /*
    514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    515 %                                                                             %
    516 %                                                                             %
    517 %                                                                             %
    518 %   G e t C a c h e V i e w S t o r a g e C l a s s                           %
    519 %                                                                             %
    520 %                                                                             %
    521 %                                                                             %
    522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    523 %
    524 %  GetCacheViewStorageClass() returns the image storage class associated with
    525 %  the specified view.
    526 %
    527 %  The format of the GetCacheViewStorageClass method is:
    528 %
    529 %      ClassType GetCacheViewStorageClass(const CacheView *cache_view)
    530 %
    531 %  A description of each parameter follows:
    532 %
    533 %    o cache_view: the cache view.
    534 %
    535 */
    536 MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
    537 {
    538   assert(cache_view != (CacheView *) NULL);
    539   assert(cache_view->signature == MagickCoreSignature);
    540   if (cache_view->debug != MagickFalse)
    541     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
    542       cache_view->image->filename);
    543   return(GetPixelCacheStorageClass(cache_view->image->cache));
    544 }
    545 
    546 /*
    548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    549 %                                                                             %
    550 %                                                                             %
    551 %                                                                             %
    552 %   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               %
    553 %                                                                             %
    554 %                                                                             %
    555 %                                                                             %
    556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    557 %
    558 %  GetCacheViewVirtualMetacontent() returns the meta-content corresponding
    559 %  with the last call to GetCacheViewVirtualMetacontent().  The meta-content
    560 %  is virtual and therefore cannot be updated.
    561 %
    562 %  The format of the GetCacheViewVirtualMetacontent() method is:
    563 %
    564 %      const void *GetCacheViewVirtualMetacontent(
    565 %        const CacheView *cache_view)
    566 %
    567 %  A description of each parameter follows:
    568 %
    569 %    o cache_view: the cache view.
    570 %
    571 */
    572 MagickExport const void *GetCacheViewVirtualMetacontent(
    573   const CacheView *cache_view)
    574 {
    575   const int
    576     id = GetOpenMPThreadId();
    577 
    578   const void
    579     *magick_restrict metacontent;
    580 
    581   assert(cache_view != (const CacheView *) NULL);
    582   assert(cache_view->signature == MagickCoreSignature);
    583   assert(cache_view->image->cache != (Cache) NULL);
    584   assert(id < (int) cache_view->number_threads);
    585   metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
    586     cache_view->nexus_info[id]);
    587   return(metacontent);
    588 }
    589 
    590 /*
    592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    593 %                                                                             %
    594 %                                                                             %
    595 %                                                                             %
    596 %   G e t C a c h e V i e w V i r t u a l P i x e l Q u e u e                 %
    597 %                                                                             %
    598 %                                                                             %
    599 %                                                                             %
    600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    601 %
    602 %  GetCacheViewVirtualPixelQueue() returns the the pixels associated with
    603 %  the last call to GetCacheViewVirtualPixels().  The pixels are virtual
    604 %  and therefore cannot be updated.
    605 %
    606 %  The format of the GetCacheViewVirtualPixelQueue() method is:
    607 %
    608 %      const Quantum *GetCacheViewVirtualPixelQueue(
    609 %        const CacheView *cache_view)
    610 %
    611 %  A description of each parameter follows:
    612 %
    613 %    o cache_view: the cache view.
    614 %
    615 */
    616 MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
    617   const CacheView *cache_view)
    618 {
    619   const int
    620     id = GetOpenMPThreadId();
    621 
    622   const Quantum
    623     *magick_restrict pixels;
    624 
    625   assert(cache_view != (const CacheView *) NULL);
    626   assert(cache_view->signature == MagickCoreSignature);
    627   assert(cache_view->image->cache != (Cache) NULL);
    628   assert(id < (int) cache_view->number_threads);
    629   pixels=GetVirtualPixelsNexus(cache_view->image->cache,
    630     cache_view->nexus_info[id]);
    631   return(pixels);
    632 }
    633 
    634 /*
    636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    637 %                                                                             %
    638 %                                                                             %
    639 %                                                                             %
    640 %   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                         %
    641 %                                                                             %
    642 %                                                                             %
    643 %                                                                             %
    644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    645 %
    646 %  GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
    647 %  disk pixel cache as defined by the geometry parameters.   A pointer to the
    648 %  pixels is returned if the pixels are transferred, otherwise a NULL is
    649 %  returned.
    650 %
    651 %  The format of the GetCacheViewVirtualPixels method is:
    652 %
    653 %      const Quantum *GetCacheViewVirtualPixels(
    654 %        const CacheView *cache_view,const ssize_t x,const ssize_t y,
    655 %        const size_t columns,const size_t rows,ExceptionInfo *exception)
    656 %
    657 %  A description of each parameter follows:
    658 %
    659 %    o cache_view: the cache view.
    660 %
    661 %    o x,y,columns,rows:  These values define the perimeter of a region of
    662 %      pixels.
    663 %
    664 %    o exception: return any errors or warnings in this structure.
    665 %
    666 */
    667 MagickExport const Quantum *GetCacheViewVirtualPixels(
    668   const CacheView *cache_view,const ssize_t x,const ssize_t y,
    669   const size_t columns,const size_t rows,ExceptionInfo *exception)
    670 {
    671   const int
    672     id = GetOpenMPThreadId();
    673 
    674   const Quantum
    675     *magick_restrict pixels;
    676 
    677   assert(cache_view != (CacheView *) NULL);
    678   assert(cache_view->signature == MagickCoreSignature);
    679   assert(id < (int) cache_view->number_threads);
    680   pixels=GetVirtualPixelsFromNexus(cache_view->image,
    681     cache_view->virtual_pixel_method,x,y,columns,rows,
    682     cache_view->nexus_info[id],exception);
    683   return(pixels);
    684 }
    685 
    686 /*
    688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    689 %                                                                             %
    690 %                                                                             %
    691 %                                                                             %
    692 %   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                 %
    693 %                                                                             %
    694 %                                                                             %
    695 %                                                                             %
    696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    697 %
    698 %  GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
    699 %  location.  The image background color is returned if an error occurs.
    700 %
    701 %  The format of the GetOneCacheViewAuthenticPixel method is:
    702 %
    703 %      MagickBooleaNType GetOneCacheViewAuthenticPixel(
    704 %        const CacheView *cache_view,const ssize_t x,const ssize_t y,
    705 %        Quantum *pixel,ExceptionInfo *exception)
    706 %
    707 %  A description of each parameter follows:
    708 %
    709 %    o cache_view: the cache view.
    710 %
    711 %    o x,y:  These values define the offset of the pixel.
    712 %
    713 %    o pixel: return a pixel at the specified (x,y) location.
    714 %
    715 %    o exception: return any errors or warnings in this structure.
    716 %
    717 */
    718 MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
    719   const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
    720   ExceptionInfo *exception)
    721 {
    722   const int
    723     id = GetOpenMPThreadId();
    724 
    725   Quantum
    726     *magick_restrict q;
    727 
    728   register ssize_t
    729     i;
    730 
    731   assert(cache_view != (CacheView *) NULL);
    732   assert(cache_view->signature == MagickCoreSignature);
    733   assert(id < (int) cache_view->number_threads);
    734   (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
    735   q=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
    736     cache_view->nexus_info[id],exception);
    737   if (q == (const Quantum *) NULL)
    738     {
    739       PixelInfo
    740         background_color;
    741 
    742       background_color=cache_view->image->background_color;
    743       pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
    744       pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
    745       pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
    746       pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
    747       pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
    748       return(MagickFalse);
    749     }
    750   for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
    751   {
    752     PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);
    753     pixel[channel]=q[i];
    754   }
    755   return(MagickTrue);
    756 }
    757 
    758 /*
    760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    761 %                                                                             %
    762 %                                                                             %
    763 %                                                                             %
    764 %   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                     %
    765 %                                                                             %
    766 %                                                                             %
    767 %                                                                             %
    768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    769 %
    770 %  GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
    771 %  location.  The image background color is returned if an error occurs.  If
    772 %  you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
    773 %
    774 %  The format of the GetOneCacheViewVirtualPixel method is:
    775 %
    776 %      MagickBooleanType GetOneCacheViewVirtualPixel(
    777 %        const CacheView *cache_view,const ssize_t x,const ssize_t y,
    778 %        Quantum *pixel,ExceptionInfo *exception)
    779 %
    780 %  A description of each parameter follows:
    781 %
    782 %    o cache_view: the cache view.
    783 %
    784 %    o x,y:  These values define the offset of the pixel.
    785 %
    786 %    o pixel: return a pixel at the specified (x,y) location.
    787 %
    788 %    o exception: return any errors or warnings in this structure.
    789 %
    790 */
    791 MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
    792   const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
    793   ExceptionInfo *exception)
    794 {
    795   const int
    796     id = GetOpenMPThreadId();
    797 
    798   register const Quantum
    799     *magick_restrict p;
    800 
    801   register ssize_t
    802     i;
    803 
    804   assert(cache_view != (CacheView *) NULL);
    805   assert(cache_view->signature == MagickCoreSignature);
    806   assert(id < (int) cache_view->number_threads);
    807   (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
    808   p=GetVirtualPixelsFromNexus(cache_view->image,
    809     cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
    810     exception);
    811   if (p == (const Quantum *) NULL)
    812     {
    813       PixelInfo
    814         background_color;
    815 
    816       background_color=cache_view->image->background_color;
    817       pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
    818       pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
    819       pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
    820       pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
    821       pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
    822       return(MagickFalse);
    823     }
    824   for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
    825   {
    826     PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);
    827     pixel[channel]=p[i];
    828   }
    829   return(MagickTrue);
    830 }
    831 
    832 /*
    834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    835 %                                                                             %
    836 %                                                                             %
    837 %                                                                             %
    838 %   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             %
    839 %                                                                             %
    840 %                                                                             %
    841 %                                                                             %
    842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    843 %
    844 %  GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
    845 %  (x,y) location.  The image background color is returned if an error occurs.
    846 %  If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
    847 %
    848 %  The format of the GetOneCacheViewVirtualPixelInfo method is:
    849 %
    850 %      MagickBooleanType GetOneCacheViewVirtualPixelInfo(
    851 %        const CacheView *cache_view,const ssize_t x,const ssize_t y,
    852 %        PixelInfo *pixel,ExceptionInfo *exception)
    853 %
    854 %  A description of each parameter follows:
    855 %
    856 %    o cache_view: the cache view.
    857 %
    858 %    o x,y:  These values define the offset of the pixel.
    859 %
    860 %    o pixel: return a pixel at the specified (x,y) location.
    861 %
    862 %    o exception: return any errors or warnings in this structure.
    863 %
    864 */
    865 MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
    866   const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
    867   ExceptionInfo *exception)
    868 {
    869   const int
    870     id = GetOpenMPThreadId();
    871 
    872   register const Quantum
    873     *magick_restrict p;
    874 
    875   assert(cache_view != (CacheView *) NULL);
    876   assert(cache_view->signature == MagickCoreSignature);
    877   assert(id < (int) cache_view->number_threads);
    878   GetPixelInfo(cache_view->image,pixel);
    879   p=GetVirtualPixelsFromNexus(cache_view->image,
    880     cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
    881     exception);
    882   if (p == (const Quantum *) NULL)
    883     return(MagickFalse);
    884   GetPixelInfoPixel(cache_view->image,p,pixel);
    885   return(MagickTrue);
    886 }
    887 
    888 /*
    890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    891 %                                                                             %
    892 %                                                                             %
    893 %                                                                             %
    894 %   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                     %
    895 %                                                                             %
    896 %                                                                             %
    897 %                                                                             %
    898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    899 %
    900 %  GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
    901 %  the specified (x,y) location.  The image background color is returned if an
    902 %  error occurs.  If you plan to modify the pixel, use
    903 %  GetOneCacheViewAuthenticPixel() instead.
    904 %
    905 %  The format of the GetOneCacheViewVirtualPixel method is:
    906 %
    907 %      MagickBooleanType GetOneCacheViewVirtualMethodPixel(
    908 %        const CacheView *cache_view,
    909 %        const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
    910 %        const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
    911 %
    912 %  A description of each parameter follows:
    913 %
    914 %    o cache_view: the cache view.
    915 %
    916 %    o virtual_pixel_method: the virtual pixel method.
    917 %
    918 %    o x,y:  These values define the offset of the pixel.
    919 %
    920 %    o pixel: return a pixel at the specified (x,y) location.
    921 %
    922 %    o exception: return any errors or warnings in this structure.
    923 %
    924 */
    925 MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
    926   const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
    927   const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
    928 {
    929   const int
    930     id = GetOpenMPThreadId();
    931 
    932   const Quantum
    933     *magick_restrict p;
    934 
    935   register ssize_t
    936     i;
    937 
    938   assert(cache_view != (CacheView *) NULL);
    939   assert(cache_view->signature == MagickCoreSignature);
    940   assert(id < (int) cache_view->number_threads);
    941   (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
    942   p=GetVirtualPixelsFromNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
    943     cache_view->nexus_info[id],exception);
    944   if (p == (const Quantum *) NULL)
    945     {
    946       PixelInfo
    947         background_color;
    948 
    949       background_color=cache_view->image->background_color;
    950       pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
    951       pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
    952       pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
    953       pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
    954       pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
    955       return(MagickFalse);
    956     }
    957   for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
    958   {
    959     PixelChannel channel=GetPixelChannelChannel(cache_view->image,i);
    960     pixel[channel]=p[i];
    961   }
    962   return(MagickTrue);
    963 }
    964 
    965 /*
    967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    968 %                                                                             %
    969 %                                                                             %
    970 %                                                                             %
    971 %   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                 %
    972 %                                                                             %
    973 %                                                                             %
    974 %                                                                             %
    975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    976 %
    977 %  QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
    978 %  disk pixel cache as defined by the geometry parameters.   A pointer to the
    979 %  pixels is returned if the pixels are transferred, otherwise a NULL is
    980 %  returned.
    981 %
    982 %  The format of the QueueCacheViewAuthenticPixels method is:
    983 %
    984 %      Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
    985 %        const ssize_t x,const ssize_t y,const size_t columns,
    986 %        const size_t rows,ExceptionInfo *exception)
    987 %
    988 %  A description of each parameter follows:
    989 %
    990 %    o cache_view: the cache view.
    991 %
    992 %    o x,y,columns,rows:  These values define the perimeter of a region of
    993 %      pixels.
    994 %
    995 %    o exception: return any errors or warnings in this structure.
    996 %
    997 */
    998 MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
    999   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
   1000   ExceptionInfo *exception)
   1001 {
   1002   const int
   1003     id = GetOpenMPThreadId();
   1004 
   1005   Quantum
   1006     *magick_restrict pixels;
   1007 
   1008   assert(cache_view != (CacheView *) NULL);
   1009   assert(cache_view->signature == MagickCoreSignature);
   1010   assert(id < (int) cache_view->number_threads);
   1011   pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
   1012     MagickFalse,cache_view->nexus_info[id],exception);
   1013   return(pixels);
   1014 }
   1015 
   1016 /*
   1018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1019 %                                                                             %
   1020 %                                                                             %
   1021 %                                                                             %
   1022 %   S e t C a c h e V i e w S t o r a g e C l a s s                           %
   1023 %                                                                             %
   1024 %                                                                             %
   1025 %                                                                             %
   1026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1027 %
   1028 %  SetCacheViewStorageClass() sets the image storage class associated with
   1029 %  the specified view.
   1030 %
   1031 %  The format of the SetCacheViewStorageClass method is:
   1032 %
   1033 %      MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
   1034 %        const ClassType storage_class,ExceptionInfo *exception)
   1035 %
   1036 %  A description of each parameter follows:
   1037 %
   1038 %    o cache_view: the cache view.
   1039 %
   1040 %    o storage_class: the image storage class: PseudoClass or DirectClass.
   1041 %
   1042 %    o exception: return any errors or warnings in this structure.
   1043 %
   1044 */
   1045 MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
   1046   const ClassType storage_class,ExceptionInfo *exception)
   1047 {
   1048   assert(cache_view != (CacheView *) NULL);
   1049   assert(cache_view->signature == MagickCoreSignature);
   1050   if (cache_view->debug != MagickFalse)
   1051     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
   1052       cache_view->image->filename);
   1053   return(SetImageStorageClass(cache_view->image,storage_class,exception));
   1054 }
   1055 
   1056 /*
   1058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1059 %                                                                             %
   1060 %                                                                             %
   1061 %                                                                             %
   1062 %   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               %
   1063 %                                                                             %
   1064 %                                                                             %
   1065 %                                                                             %
   1066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1067 %
   1068 %  SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
   1069 %  with the specified cache view.
   1070 %
   1071 %  The format of the SetCacheViewVirtualPixelMethod method is:
   1072 %
   1073 %      MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
   1074 %        const VirtualPixelMethod virtual_pixel_method)
   1075 %
   1076 %  A description of each parameter follows:
   1077 %
   1078 %    o cache_view: the cache view.
   1079 %
   1080 %    o virtual_pixel_method: the virtual pixel method.
   1081 %
   1082 */
   1083 MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
   1084   CacheView *magick_restrict cache_view,
   1085   const VirtualPixelMethod virtual_pixel_method)
   1086 {
   1087   assert(cache_view != (CacheView *) NULL);
   1088   assert(cache_view->signature == MagickCoreSignature);
   1089   if (cache_view->debug != MagickFalse)
   1090     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
   1091       cache_view->image->filename);
   1092   cache_view->virtual_pixel_method=virtual_pixel_method;
   1093   return(MagickTrue);
   1094 }
   1095 
   1096 /*
   1098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1099 %                                                                             %
   1100 %                                                                             %
   1101 %                                                                             %
   1102 %   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                   %
   1103 %                                                                             %
   1104 %                                                                             %
   1105 %                                                                             %
   1106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   1107 %
   1108 %  SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
   1109 %  or disk cache.  It returns MagickTrue if the pixel region is flushed,
   1110 %  otherwise MagickFalse.
   1111 %
   1112 %  The format of the SyncCacheViewAuthenticPixels method is:
   1113 %
   1114 %      MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
   1115 %        ExceptionInfo *exception)
   1116 %
   1117 %  A description of each parameter follows:
   1118 %
   1119 %    o cache_view: the cache view.
   1120 %
   1121 %    o exception: return any errors or warnings in this structure.
   1122 %
   1123 */
   1124 MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
   1125   CacheView *magick_restrict cache_view,ExceptionInfo *exception)
   1126 {
   1127   const int
   1128     id = GetOpenMPThreadId();
   1129 
   1130   MagickBooleanType
   1131     status;
   1132 
   1133   assert(cache_view != (CacheView *) NULL);
   1134   assert(cache_view->signature == MagickCoreSignature);
   1135   assert(id < (int) cache_view->number_threads);
   1136   status=SyncAuthenticPixelCacheNexus(cache_view->image,
   1137     cache_view->nexus_info[id],exception);
   1138   return(status);
   1139 }
   1140