13ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
23ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
43ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
53ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
63ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                      PPPP   IIIII  X   X  EEEEE  L                          %
73ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                      P   P    I     X X   E      L                          %
83ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                      PPPP     I      X    EEE    L                          %
93ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                      P        I     X X   E      L                          %
103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                      P      IIIII  X   X  EEEEE  LLLLL                      %
113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%            IIIII  TTTTT EEEEE  RRRR    AAA   TTTTT   OOO   RRRR             %
133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%              I      T   E      R   R  A   A    T    O   O  R   R            %
143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%              I      T   EEE    RRRR   AAAAA    T    O   O  RRRR             %
153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%              I      T   E      R R    A   A    T    O   O  R R              %
163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%            IIIII    T   EEEEE  R  R   A   A    T     OOO   R  R             %
173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                   ImageMagick Image Pixel Iterator Methods                  %
203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                              Software Design                                %
22de984cdc3631106b1cbbb8d3972b76a0fc27e8e8cristy%                                   Cristy                                    %
233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                March 2003                                   %
243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
267ce65e7125a4e1df1a274ce373c537a9df9c16cdCristy%  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  dedicated to making software imaging solutions freely available.           %
283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  You may not use this file except in compliance with the License.  You may  %
303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  obtain a copy of the License at                                            %
313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    http://www.imagemagick.org/script/license.php                            %
333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  Unless required by applicable law or agreed to in writing, software        %
353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  distributed under the License is distributed on an "AS IS" BASIS,          %
363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  See the License for the specific language governing permissions and        %
383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  limitations under the License.                                             %
393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  Include declarations.
483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
494c08aed51c5899665ade97263692328eea4af106cristy#include "MagickWand/studio.h"
504c08aed51c5899665ade97263692328eea4af106cristy#include "MagickWand/MagickWand.h"
514c08aed51c5899665ade97263692328eea4af106cristy#include "MagickWand/magick-wand-private.h"
524c08aed51c5899665ade97263692328eea4af106cristy#include "MagickWand/pixel-iterator.h"
534c08aed51c5899665ade97263692328eea4af106cristy#include "MagickWand/pixel-wand.h"
544c08aed51c5899665ade97263692328eea4af106cristy#include "MagickWand/wand.h"
553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  Define declarations.
583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define PixelIteratorId  "PixelIterator"
603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  Typedef declarations.
633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
643ed852eea50f9d4cd633efb8c2b054b8e33c253cristystruct _PixelIterator
653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
66bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t
673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    id;
683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char
70151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy    name[MagickPathExtent];
713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  ExceptionInfo
733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *exception;
743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  CacheView
763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *view;
773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  RectangleInfo
793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    region;
803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  MagickBooleanType
82a89dd1754cb0d91d27735def18faff913a369be4anthony    active;           /* user has been given pixel data */
833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
84bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  ssize_t
853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    y;
863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  PixelWand
883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    **pixel_wands;
893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  MagickBooleanType
913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    debug;
923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
93bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t
943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    signature;
953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy};
963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   C l e a r P i x e l I t e r a t o r                                       %
1033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  ClearPixelIterator() clear resources associated with a PixelIterator.
1093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the ClearPixelIterator method is:
1113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
11255d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%      void ClearPixelIterator(PixelIterator *iterator)
1133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
1153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
1173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
1193ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport void ClearPixelIterator(PixelIterator *iterator)
1203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
1213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (const PixelIterator *) NULL);
122e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
1233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
1243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
1253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->pixel_wands=DestroyPixelWands(iterator->pixel_wands,
1263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->region.width);
1273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  ClearMagickException(iterator->exception);
1283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->pixel_wands=NewPixelWands(iterator->region.width);
1293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->active=MagickFalse;
1303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->y=0;
1313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->debug=IsEventLogging();
1323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
1333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
1353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   C l o n e P i x e l I t e r a t o r                                       %
1403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  ClonePixelIterator() makes an exact copy of the specified iterator.
1463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the ClonePixelIterator method is:
1483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
1503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
1523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the magick iterator.
1543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
1553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
1563ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
1573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
1583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  PixelIterator
1593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *clone_iterator;
1603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
162e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
1633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
1643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
1657d5bdf3a3794ed110446de0695a638254b7b9884cristy  clone_iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*clone_iterator));
1663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (clone_iterator == (PixelIterator *) NULL)
1673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
1683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      iterator->name);
1693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  (void) ResetMagickMemory(clone_iterator,0,sizeof(*clone_iterator));
1703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->id=AcquireWandId();
171151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy  (void) FormatLocaleString(clone_iterator->name,MagickPathExtent,"%s-%.20g",
172e8c25f9b4c9fb72cad6db08eeda58c7c5784014ecristy    PixelIteratorId,(double) clone_iterator->id);
1733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->exception=AcquireExceptionInfo();
1743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  InheritException(clone_iterator->exception,iterator->exception);
1753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->view=CloneCacheView(iterator->view);
1763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->region=iterator->region;
1773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->active=iterator->active;
1783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->y=iterator->y;
1793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->pixel_wands=ClonePixelWands((const PixelWand **)
1803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->pixel_wands,iterator->region.width);
1813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  clone_iterator->debug=iterator->debug;
1823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (clone_iterator->debug != MagickFalse)
1833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
1843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      clone_iterator->name);
185e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  clone_iterator->signature=MagickWandSignature;
1863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(clone_iterator);
1873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
1883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
1903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   D e s t r o y P i x e l I t e r a t o r                                   %
1953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
1983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  DestroyPixelIterator() deallocates resources associated with a PixelIterator.
2013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the DestroyPixelIterator method is:
2033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      PixelIterator *DestroyPixelIterator(PixelIterator *iterator)
2053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
2073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
2093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
2113ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport PixelIterator *DestroyPixelIterator(PixelIterator *iterator)
2123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
2133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (const PixelIterator *) NULL);
214e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
2153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
2163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
2173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->view=DestroyCacheView(iterator->view);
2183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->pixel_wands=DestroyPixelWands(iterator->pixel_wands,
2193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->region.width);
2203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->exception=DestroyExceptionInfo(iterator->exception);
221e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  iterator->signature=(~MagickWandSignature);
2223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  RelinquishWandId(iterator->id);
2233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator=(PixelIterator *) RelinquishMagickMemory(iterator);
2243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator);
2253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
2263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
2283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   I s P i x e l I t e r a t o r                                             %
2333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  IsPixelIterator() returns MagickTrue if the iterator is verified as a pixel
2393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  iterator.
2403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the IsPixelIterator method is:
2423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      MagickBooleanType IsPixelIterator(const PixelIterator *iterator)
2443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
2463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the magick iterator.
2483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
2503ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport MagickBooleanType IsPixelIterator(const PixelIterator *iterator)
2513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
2523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  size_t
2533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    length;
2543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator == (const PixelIterator *) NULL)
2563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return(MagickFalse);
257e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  if (iterator->signature != MagickWandSignature)
2583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return(MagickFalse);
2593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  length=strlen(PixelIteratorId);
2603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (LocaleNCompare(iterator->name,PixelIteratorId,length) != 0)
2613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return(MagickFalse);
2623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(MagickTrue);
2633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
2643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
2663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   N e w P i x e l I t e r a t o r                                           %
2713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
2743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  NewPixelIterator() returns a new pixel iterator.
2773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the NewPixelIterator method is:
2793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
280197d0578fe2c0d6268cfa7492902843de6395049cristy%      PixelIterator *NewPixelIterator(MagickWand *wand)
2813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
2833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o wand: the magick wand.
2853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
2863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
2873ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport PixelIterator *NewPixelIterator(MagickWand *wand)
2883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
2893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  const char
2903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *quantum;
2913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
292db070957cf6bf959df9283a482377e8854c3d4d2cristy  ExceptionInfo
293db070957cf6bf959df9283a482377e8854c3d4d2cristy    *exception;
294db070957cf6bf959df9283a482377e8854c3d4d2cristy
2953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  Image
2963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *image;
2973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  PixelIterator
2993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *iterator;
3003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
301bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t
3023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    depth;
3033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  CacheView
3053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *view;
3063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  depth=MAGICKCORE_QUANTUM_DEPTH;
3083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  quantum=GetMagickQuantumDepth(&depth);
3093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (depth != MAGICKCORE_QUANTUM_DEPTH)
3103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
3113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(wand != (MagickWand *) NULL);
3123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  image=GetImageFromMagickWand(wand);
3133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (image == (Image *) NULL)
3143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return((PixelIterator *) NULL);
315db070957cf6bf959df9283a482377e8854c3d4d2cristy  exception=AcquireExceptionInfo();
31646ff2676b1044ea4101ac7a59b83289cd8f6cfdacristy  view=AcquireVirtualCacheView(image,exception);
3173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (view == (CacheView *) NULL)
3183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return((PixelIterator *) NULL);
31973bd4a51b419e914565bdf204bf1540dc4c8ee26cristy  iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*iterator));
3203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator == (PixelIterator *) NULL)
3213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
3223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      GetExceptionMessage(errno));
3233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  (void) ResetMagickMemory(iterator,0,sizeof(*iterator));
3243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->id=AcquireWandId();
325151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy  (void) FormatLocaleString(iterator->name,MagickPathExtent,"%s-%.20g",
326e8c25f9b4c9fb72cad6db08eeda58c7c5784014ecristy    PixelIteratorId,(double) iterator->id);
327db070957cf6bf959df9283a482377e8854c3d4d2cristy  iterator->exception=exception;
3283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->view=view;
3293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  SetGeometry(image,&iterator->region);
3303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.width=image->columns;
3313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.height=image->rows;
3323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.x=0;
3333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.y=0;
3343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->pixel_wands=NewPixelWands(iterator->region.width);
3353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->y=0;
3363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->debug=IsEventLogging();
3373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
3383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
339e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  iterator->signature=MagickWandSignature;
3403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator);
3413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
3423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
3443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l C l e a r I t e r a t o r E x c e p t i o n                     %
3493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelClearIteratorException() clear any exceptions associated with the
3553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  iterator.
3563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelClearIteratorException method is:
3583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
35955d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%      MagickBooleanType PixelClearIteratorException(PixelIterator *iterator)
3603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
3623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
36355d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%    o iterator: the pixel iterator.
3643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
3663ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport MagickBooleanType PixelClearIteratorException(
3673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  PixelIterator *iterator)
3683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
3693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
370e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
3713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
3723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
3733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  ClearMagickException(iterator->exception);
3743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(MagickTrue);
3753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
3763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
3783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   N e w P i x e l R e g i o n I t e r a t o r                               %
3833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
3863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  NewPixelRegionIterator() returns a new pixel iterator.
3893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the NewPixelRegionIterator method is:
3913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3920da2c571f84e83df2e3aaa4b04c48e43b0e906f1cristy%      PixelIterator *NewPixelRegionIterator(MagickWand *wand,const ssize_t x,
393bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy%        const ssize_t y,const size_t width,const size_t height)
3943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
3963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o wand: the magick wand.
3983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
3993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o x,y,columns,rows:  These values define the perimeter of a region of
4003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      pixels.
4013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
4032e8bde0a7e91bad5252fc38331e56b23cd487726cristyWandExport PixelIterator *NewPixelRegionIterator(MagickWand *wand,
4042e8bde0a7e91bad5252fc38331e56b23cd487726cristy  const ssize_t x,const ssize_t y,const size_t width,const size_t height)
4053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
4062e8bde0a7e91bad5252fc38331e56b23cd487726cristy  CacheView
4072e8bde0a7e91bad5252fc38331e56b23cd487726cristy    *view;
4082e8bde0a7e91bad5252fc38331e56b23cd487726cristy
4093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  const char
4103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *quantum;
4113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
412db070957cf6bf959df9283a482377e8854c3d4d2cristy  ExceptionInfo
413db070957cf6bf959df9283a482377e8854c3d4d2cristy    *exception;
414db070957cf6bf959df9283a482377e8854c3d4d2cristy
4153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  Image
4163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *image;
4173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  PixelIterator
4193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *iterator;
4203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
421bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t
4223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    depth;
4233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(wand != (MagickWand *) NULL);
4253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  depth=MAGICKCORE_QUANTUM_DEPTH;
4263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  quantum=GetMagickQuantumDepth(&depth);
4273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (depth != MAGICKCORE_QUANTUM_DEPTH)
4283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
42936ac3435a50239bc3564618ff2602ec2336bf3cbcristy  if ((width == 0) || (height == 0))
4303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(WandError,"ZeroRegionSize",quantum);
4313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  image=GetImageFromMagickWand(wand);
4323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (image == (Image *) NULL)
4333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return((PixelIterator *) NULL);
434db070957cf6bf959df9283a482377e8854c3d4d2cristy  exception=AcquireExceptionInfo();
43546ff2676b1044ea4101ac7a59b83289cd8f6cfdacristy  view=AcquireVirtualCacheView(image,exception);
4363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (view == (CacheView *) NULL)
4373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return((PixelIterator *) NULL);
43873bd4a51b419e914565bdf204bf1540dc4c8ee26cristy  iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*iterator));
4393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator == (PixelIterator *) NULL)
4403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
4413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      wand->name);
4423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  (void) ResetMagickMemory(iterator,0,sizeof(*iterator));
4433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->id=AcquireWandId();
444151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy  (void) FormatLocaleString(iterator->name,MagickPathExtent,"%s-%.20g",
445e8c25f9b4c9fb72cad6db08eeda58c7c5784014ecristy    PixelIteratorId,(double) iterator->id);
446db070957cf6bf959df9283a482377e8854c3d4d2cristy  iterator->exception=exception;
4473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->view=view;
4483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  SetGeometry(image,&iterator->region);
4493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.width=width;
4503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.height=height;
4513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.x=x;
4523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->region.y=y;
4533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->pixel_wands=NewPixelWands(iterator->region.width);
4543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->y=0;
4553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->debug=IsEventLogging();
4563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
4573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
458e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  iterator->signature=MagickWandSignature;
4593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator);
4603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
4613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
4633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
4653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
4663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
4673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l G e t C u r r e n t I t e r a t o r R o w                       %
4683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
4693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
4703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
4713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelGetCurrentIteratorRow() returns the current row as an array of pixel
4743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  wands from the pixel iterator.
4753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelGetCurrentIteratorRow method is:
4773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      PixelWand **PixelGetCurrentIteratorRow(PixelIterator *iterator,
479bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy%        size_t *number_wands)
4803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
4823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
4843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o number_wands: the number of pixel wands.
4863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
4873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
4883ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport PixelWand **PixelGetCurrentIteratorRow(PixelIterator *iterator,
489bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t *number_wands)
4903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
4914c08aed51c5899665ade97263692328eea4af106cristy  register const Quantum
4923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *pixels;
4933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
494bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  register ssize_t
4953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    x;
4963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
498e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
4993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
5003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
5013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *number_wands=0;
5023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->active=MagickTrue;
5033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  pixels=GetCacheViewVirtualPixels(iterator->view,iterator->region.x,
5043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->region.y+iterator->y,iterator->region.width,1,
5053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->exception);
5064c08aed51c5899665ade97263692328eea4af106cristy  if (pixels == (const Quantum *) NULL)
507cad4e1b9691af480db55fb597175db5f3e7d6acccristy    return((PixelWand **) NULL);
508bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  for (x=0; x < (ssize_t) iterator->region.width; x++)
5094c08aed51c5899665ade97263692328eea4af106cristy  {
510e751662f8175c76e55da86bbf90d1a7d02425b9acristy    PixelSetQuantumPixel(GetCacheViewImage(iterator->view),pixels,
511e751662f8175c76e55da86bbf90d1a7d02425b9acristy      iterator->pixel_wands[x]);
512e751662f8175c76e55da86bbf90d1a7d02425b9acristy    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
5134c08aed51c5899665ade97263692328eea4af106cristy  }
5143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *number_wands=iterator->region.width;
5153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator->pixel_wands);
5163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
5173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
5183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
5193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l G e t I t e r a t o r E x c e p t i o n                         %
5243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelGetIteratorException() returns the severity, reason, and description of
5303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  any error that occurs when using other methods in this API.
5313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelGetIteratorException method is:
5333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
53455d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%      char *PixelGetIteratorException(const PixelIterator *iterator,
5353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%        ExceptionType *severity)
5363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
5383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
5403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o severity: the severity of the error is returned here.
5423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
5443ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport char *PixelGetIteratorException(const PixelIterator *iterator,
5453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  ExceptionType *severity)
5463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
5473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char
5483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *description;
5493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
5503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (const PixelIterator *) NULL);
551e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
5523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
5533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
5543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(severity != (ExceptionType *) NULL);
5553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *severity=iterator->exception->severity;
556151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy  description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent,
5573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    sizeof(*description));
5583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (description == (char *) NULL)
5593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
5603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      iterator->name);
5613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *description='\0';
5623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->exception->reason != (char *) NULL)
5633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) CopyMagickString(description,GetLocaleExceptionMessage(
564151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy      iterator->exception->severity,iterator->exception->reason),MagickPathExtent);
5653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->exception->description != (char *) NULL)
5663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
567151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy      (void) ConcatenateMagickString(description," (",MagickPathExtent);
5683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
5693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        iterator->exception->severity,iterator->exception->description),
570151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy        MagickPathExtent);
571151b66dffc9e3c2e8c4f8cdaca37ff987ca0f497cristy      (void) ConcatenateMagickString(description,")",MagickPathExtent);
5723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
5733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(description);
5743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
5753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
5763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
5773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l G e t E x c e p t i o n T y p e                                 %
5823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
5853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
58755d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%  PixelGetIteratorExceptionType() the exception type associated with the
58855d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%  iterator.  If no exception has occurred, UndefinedExceptionType is returned.
5893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelGetIteratorExceptionType method is:
5913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
59255d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%      ExceptionType PixelGetIteratorExceptionType(
59355d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%        const PixelIterator *iterator)
5943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
5963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
59755d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy%    o iterator: the pixel iterator.
5983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
5993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
6003ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport ExceptionType PixelGetIteratorExceptionType(
60155d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy  const PixelIterator *iterator)
6023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
60355d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy  assert(iterator != (const PixelIterator *) NULL);
604e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
60555d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy  if (iterator->debug != MagickFalse)
60655d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
60755d6880edb0cc2eeaea9d895fca9c80f88f57fb0cristy  return(iterator->exception->severity);
6083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
6093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
6103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
6113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l G e t I t e r a t o r R o w                                     %
6163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelGetIteratorRow() returns the current pixel iterator row.
6223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelGetIteratorRow method is:
6243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      MagickBooleanType PixelGetIteratorRow(PixelIterator *iterator)
6263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
6283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
6303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
632bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristyWandExport ssize_t PixelGetIteratorRow(PixelIterator *iterator)
6333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
6343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (const PixelIterator *) NULL);
635e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
6363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
6373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
6383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator->y);
6393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
6403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
6413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
6423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l G e t N e x t I t e r a t o r R o w                             %
6473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
6503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelGetNextIteratorRow() returns the next row as an array of pixel wands
6533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  from the pixel iterator.
6543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelGetNextIteratorRow method is:
6563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      PixelWand **PixelGetNextIteratorRow(PixelIterator *iterator,
658bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy%        size_t *number_wands)
6593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
6613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
6633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o number_wands: the number of pixel wands.
6653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
6663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
6673ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport PixelWand **PixelGetNextIteratorRow(PixelIterator *iterator,
668bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t *number_wands)
6693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
6704c08aed51c5899665ade97263692328eea4af106cristy  register const Quantum
6713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *pixels;
6723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
673bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  register ssize_t
6743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    x;
6753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
6763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
677e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
6783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
6793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
6803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *number_wands=0;
6813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->active != MagickFalse)
6823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->y++;
6833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (PixelSetIteratorRow(iterator,iterator->y) == MagickFalse)
6843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return((PixelWand **) NULL);
6853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  pixels=GetCacheViewVirtualPixels(iterator->view,iterator->region.x,
6863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->region.y+iterator->y,iterator->region.width,1,
6873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->exception);
6884c08aed51c5899665ade97263692328eea4af106cristy  if (pixels == (const Quantum *) NULL)
689cad4e1b9691af480db55fb597175db5f3e7d6acccristy    return((PixelWand **) NULL);
690bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  for (x=0; x < (ssize_t) iterator->region.width; x++)
6914c08aed51c5899665ade97263692328eea4af106cristy  {
692e751662f8175c76e55da86bbf90d1a7d02425b9acristy    PixelSetQuantumPixel(GetCacheViewImage(iterator->view),pixels,
693e751662f8175c76e55da86bbf90d1a7d02425b9acristy      iterator->pixel_wands[x]);
694e751662f8175c76e55da86bbf90d1a7d02425b9acristy    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
6954c08aed51c5899665ade97263692328eea4af106cristy  }
6963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *number_wands=iterator->region.width;
6973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator->pixel_wands);
6983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
6993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
7003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
7013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l G e t P r e v i o u s I t e r a t o r R o w                     %
7063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelGetPreviousIteratorRow() returns the previous row as an array of pixel
7123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  wands from the pixel iterator.
7133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelGetPreviousIteratorRow method is:
7153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      PixelWand **PixelGetPreviousIteratorRow(PixelIterator *iterator,
717bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy%        size_t *number_wands)
7183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
7203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
7223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o number_wands: the number of pixel wands.
7243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
7263ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport PixelWand **PixelGetPreviousIteratorRow(PixelIterator *iterator,
727bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  size_t *number_wands)
7283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
7294c08aed51c5899665ade97263692328eea4af106cristy  register const Quantum
7303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *pixels;
7313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
732bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  register ssize_t
7333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    x;
7343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
7353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
736e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
7373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
7383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
7393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *number_wands=0;
7403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->active != MagickFalse)
7413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->y--;
7423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (PixelSetIteratorRow(iterator,iterator->y) == MagickFalse)
7433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return((PixelWand **) NULL);
7443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  pixels=GetCacheViewVirtualPixels(iterator->view,iterator->region.x,
7453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->region.y+iterator->y,iterator->region.width,1,
7463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    iterator->exception);
7474c08aed51c5899665ade97263692328eea4af106cristy  if (pixels == (const Quantum *) NULL)
748cad4e1b9691af480db55fb597175db5f3e7d6acccristy    return((PixelWand **) NULL);
749bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  for (x=0; x < (ssize_t) iterator->region.width; x++)
7504c08aed51c5899665ade97263692328eea4af106cristy  {
751e751662f8175c76e55da86bbf90d1a7d02425b9acristy    PixelSetQuantumPixel(GetCacheViewImage(iterator->view),pixels,
752e751662f8175c76e55da86bbf90d1a7d02425b9acristy      iterator->pixel_wands[x]);
753e751662f8175c76e55da86bbf90d1a7d02425b9acristy    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
7544c08aed51c5899665ade97263692328eea4af106cristy  }
7553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *number_wands=iterator->region.width;
7563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(iterator->pixel_wands);
7573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
7583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
7593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
7603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l R e s e t I t e r a t o r                                       %
7653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelResetIterator() resets the pixel iterator.  Use it in conjunction
7713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  with PixelGetNextIteratorRow() to iterate over all the pixels in a pixel
7723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  container.
7733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelResetIterator method is:
7753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      void PixelResetIterator(PixelIterator *iterator)
7773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
7793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
7813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
7823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
7833ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport void PixelResetIterator(PixelIterator *iterator)
7843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
7853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
786e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
7873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
7883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
7893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->active=MagickFalse;
7903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->y=0;
7913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
7923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
7933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
7943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
7983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l S e t F i r s t I t e r a t o r R o w                           %
7993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelSetFirstIteratorRow() sets the pixel iterator to the first pixel row.
8053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelSetFirstIteratorRow method is:
8073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      void PixelSetFirstIteratorRow(PixelIterator *iterator)
8093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
8113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the magick iterator.
8133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
8153ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport void PixelSetFirstIteratorRow(PixelIterator *iterator)
8163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
8173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
818e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
8193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
8203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
8213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->active=MagickFalse;
8223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->y=iterator->region.y;
8233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
8243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
8263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l S e t I t e r a t o r R o w                                     %
8313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelSetIteratorRow() set the pixel iterator row.
8373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelSetIteratorRow method is:
8393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      MagickBooleanType PixelSetIteratorRow(PixelIterator *iterator,
841bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy%        const ssize_t row)
8423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
8443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
8463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
8483ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport MagickBooleanType PixelSetIteratorRow(PixelIterator *iterator,
849bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  const ssize_t row)
8503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
8513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (const PixelIterator *) NULL);
852e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
8533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
8543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
855bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  if ((row < 0) || (row >= (ssize_t) iterator->region.height))
8563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return(MagickFalse);
8573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->active=MagickTrue;
8583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->y=row;
8593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(MagickTrue);
8603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
8613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
8633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l S e t L a s t I t e r a t o r R o w                             %
8683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelSetLastIteratorRow() sets the pixel iterator to the last pixel row.
8743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelSetLastIteratorRow method is:
8763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      void PixelSetLastIteratorRow(PixelIterator *iterator)
8783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
8803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the magick iterator.
8823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
8833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
8843ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport void PixelSetLastIteratorRow(PixelIterator *iterator)
8853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
8863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (PixelIterator *) NULL);
887e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
8883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
8893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
8903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  iterator->active=MagickFalse;
891bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  iterator->y=(ssize_t) iterator->region.height-1;
8923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
8933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/*
8953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
8993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%   P i x e l S y n c I t e r a t o r                                         %
9003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
9013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
9023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%                                                                             %
9033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
9053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  PixelSyncIterator() syncs the pixel iterator.
9063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
9073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  The format of the PixelSyncIterator method is:
9083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
9093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%      MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
9103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
9113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%  A description of each parameter follows:
9123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
9133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%    o iterator: the pixel iterator.
9143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy%
9153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
9163ed852eea50f9d4cd633efb8c2b054b8e33c253cristyWandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
9173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
918c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy  MagickBooleanType
919c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy    status;
920c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy
921bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  register ssize_t
9223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    x;
9233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
9244c08aed51c5899665ade97263692328eea4af106cristy  register Quantum
92505d2ff7ebf21f659f5b11e45afb294e152f4330cdirk    *_magickcore_restrict pixels;
9263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
9273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert(iterator != (const PixelIterator *) NULL);
928e1c94d9d25db6b0dd7a5028ffee31d1057855d73cristy  assert(iterator->signature == MagickWandSignature);
9293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (iterator->debug != MagickFalse)
9303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
931c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy  status=SetCacheViewStorageClass(iterator->view,DirectClass,
932c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy    iterator->exception);
933c82a27bb8e3138ff9bbf0f696663bdf3e704cedecristy  if (status == MagickFalse)
9343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return(MagickFalse);
9353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  pixels=GetCacheViewAuthenticPixels(iterator->view,iterator->region.x,
936cad4e1b9691af480db55fb597175db5f3e7d6acccristy    iterator->region.y+iterator->y,iterator->region.width,1,
937cad4e1b9691af480db55fb597175db5f3e7d6acccristy    iterator->exception);
9384c08aed51c5899665ade97263692328eea4af106cristy  if (pixels == (Quantum *) NULL)
939cad4e1b9691af480db55fb597175db5f3e7d6acccristy    return(MagickFalse);
940bb50337b2a8a16ca7e903cc04ab195ff0fd47ae6cristy  for (x=0; x < (ssize_t) iterator->region.width; x++)
9414c08aed51c5899665ade97263692328eea4af106cristy  {
942e751662f8175c76e55da86bbf90d1a7d02425b9acristy    PixelGetQuantumPixel(GetCacheViewImage(iterator->view),
943e751662f8175c76e55da86bbf90d1a7d02425b9acristy      iterator->pixel_wands[x],pixels);
944e751662f8175c76e55da86bbf90d1a7d02425b9acristy    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
9454c08aed51c5899665ade97263692328eea4af106cristy  }
946cad4e1b9691af480db55fb597175db5f3e7d6acccristy  if (SyncCacheViewAuthenticPixels(iterator->view,iterator->exception) == MagickFalse)
947cad4e1b9691af480db55fb597175db5f3e7d6acccristy    return(MagickFalse);
9483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return(MagickTrue);
9493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
950