]> granicus.if.org Git - imagemagick/blobdiff - MagickWand/pixel-iterator.c
(no commit message)
[imagemagick] / MagickWand / pixel-iterator.c
index d276961de0cedcbd4ef6d6f32ce5777205d9dc18..06a9899dbcdbb5f2dbd2b93ec749b8c20586c327 100644 (file)
@@ -23,7 +23,7 @@
 %                                March 2003                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -72,9 +72,6 @@ struct _PixelIterator
   ExceptionInfo
     *exception;
 
-  Image
-    *image;
-
   CacheView
     *view;
 
@@ -112,7 +109,7 @@ struct _PixelIterator
 %
 %  The format of the ClearPixelIterator method is:
 %
-%      PixelIterator *ClearPixelIterator(PixelIterator *iterator)
+%      void ClearPixelIterator(PixelIterator *iterator)
 %
 %  A description of each parameter follows:
 %
@@ -165,8 +162,7 @@ WandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
   assert(iterator->signature == WandSignature);
   if (iterator->debug != MagickFalse)
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
-  clone_iterator=(PixelIterator *) AcquireMagickMemory(
-    sizeof(*clone_iterator));
+  clone_iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*clone_iterator));
   if (clone_iterator == (PixelIterator *) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
       iterator->name);
@@ -176,8 +172,6 @@ WandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator)
     PixelIteratorId,(double) clone_iterator->id);
   clone_iterator->exception=AcquireExceptionInfo();
   InheritException(clone_iterator->exception,iterator->exception);
-  clone_iterator->image=CloneImage(iterator->image,0,0,MagickTrue,
-    iterator->exception);
   clone_iterator->view=CloneCacheView(iterator->view);
   clone_iterator->region=iterator->region;
   clone_iterator->active=iterator->active;
@@ -220,7 +214,6 @@ WandExport PixelIterator *DestroyPixelIterator(PixelIterator *iterator)
   assert(iterator->signature == WandSignature);
   if (iterator->debug != MagickFalse)
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
-  iterator->image=DestroyImage(iterator->image);
   iterator->view=DestroyCacheView(iterator->view);
   iterator->pixel_wands=DestroyPixelWands(iterator->pixel_wands,
     iterator->region.width);
@@ -332,7 +325,6 @@ WandExport PixelIterator *NewPixelIterator(MagickWand *wand)
   (void) FormatLocaleString(iterator->name,MaxTextExtent,"%s-%.20g",
     PixelIteratorId,(double) iterator->id);
   iterator->exception=exception;
-  iterator->image=CloneImage(image,0,0,MagickTrue,iterator->exception);
   iterator->view=view;
   SetGeometry(image,&iterator->region);
   iterator->region.width=image->columns;
@@ -364,11 +356,11 @@ WandExport PixelIterator *NewPixelIterator(MagickWand *wand)
 %
 %  The format of the PixelClearIteratorException method is:
 %
-%      MagickBooleanType PixelClearIteratorException(PixelIterator *wand)
+%      MagickBooleanType PixelClearIteratorException(PixelIterator *iterator)
 %
 %  A description of each parameter follows:
 %
-%    o wand: the pixel wand.
+%    o iterator: the pixel iterator.
 %
 */
 WandExport MagickBooleanType PixelClearIteratorException(
@@ -397,7 +389,7 @@ WandExport MagickBooleanType PixelClearIteratorException(
 %
 %  The format of the NewPixelRegionIterator method is:
 %
-%      PixelIterator NewPixelRegionIterator(MagickWand *wand,const ssize_t x,
+%      PixelIterator *NewPixelRegionIterator(MagickWand *wand,const ssize_t x,
 %        const ssize_t y,const size_t width,const size_t height)
 %
 %  A description of each parameter follows:
@@ -515,8 +507,9 @@ WandExport PixelWand **PixelGetCurrentIteratorRow(PixelIterator *iterator,
     return((PixelWand **) NULL);
   for (x=0; x < (ssize_t) iterator->region.width; x++)
   {
-    PixelSetQuantumPixel(iterator->image,pixels,iterator->pixel_wands[x]);
-    pixels+=GetPixelChannels(iterator->image);
+    PixelSetQuantumPixel(GetCacheViewImage(iterator->view),pixels,
+      iterator->pixel_wands[x]);
+    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
   }
   *number_wands=iterator->region.width;
   return(iterator->pixel_wands);
@@ -538,7 +531,7 @@ WandExport PixelWand **PixelGetCurrentIteratorRow(PixelIterator *iterator,
 %
 %  The format of the PixelGetIteratorException method is:
 %
-%      char *PixelGetIteratorException(const Pixeliterator *iterator,
+%      char *PixelGetIteratorException(const PixelIterator *iterator,
 %        ExceptionType *severity)
 %
 %  A description of each parameter follows:
@@ -591,26 +584,27 @@ WandExport char *PixelGetIteratorException(const PixelIterator *iterator,
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  PixelGetIteratorExceptionType() the exception type associated with the wand.
-%  If no exception has occurred, UndefinedExceptionType is returned.
+%  PixelGetIteratorExceptionType() the exception type associated with the
+%  iterator.  If no exception has occurred, UndefinedExceptionType is returned.
 %
 %  The format of the PixelGetIteratorExceptionType method is:
 %
-%      ExceptionType PixelGetIteratorExceptionType(const PixelWand *wand)
+%      ExceptionType PixelGetIteratorExceptionType(
+%        const PixelIterator *iterator)
 %
 %  A description of each parameter follows:
 %
-%    o wand: the magick wand.
+%    o iterator: the pixel iterator.
 %
 */
 WandExport ExceptionType PixelGetIteratorExceptionType(
-  const PixelIterator *wand)
+  const PixelIterator *iterator)
 {
-  assert(wand != (const PixelIterator *) NULL);
-  assert(wand->signature == WandSignature);
-  if (wand->debug != MagickFalse)
-    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
-  return(wand->exception->severity);
+  assert(iterator != (const PixelIterator *) NULL);
+  assert(iterator->signature == WandSignature);
+  if (iterator->debug != MagickFalse)
+    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
+  return(iterator->exception->severity);
 }
 \f
 /*
@@ -695,8 +689,9 @@ WandExport PixelWand **PixelGetNextIteratorRow(PixelIterator *iterator,
     return((PixelWand **) NULL);
   for (x=0; x < (ssize_t) iterator->region.width; x++)
   {
-    PixelSetQuantumPixel(iterator->image,pixels,iterator->pixel_wands[x]);
-    pixels+=GetPixelChannels(iterator->image);
+    PixelSetQuantumPixel(GetCacheViewImage(iterator->view),pixels,
+      iterator->pixel_wands[x]);
+    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
   }
   *number_wands=iterator->region.width;
   return(iterator->pixel_wands);
@@ -753,8 +748,9 @@ WandExport PixelWand **PixelGetPreviousIteratorRow(PixelIterator *iterator,
     return((PixelWand **) NULL);
   for (x=0; x < (ssize_t) iterator->region.width; x++)
   {
-    PixelSetQuantumPixel(iterator->image,pixels,iterator->pixel_wands[x]);
-    pixels+=GetPixelChannels(iterator->image);
+    PixelSetQuantumPixel(GetCacheViewImage(iterator->view),pixels,
+      iterator->pixel_wands[x]);
+    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
   }
   *number_wands=iterator->region.width;
   return(iterator->pixel_wands);
@@ -943,8 +939,9 @@ WandExport MagickBooleanType PixelSyncIterator(PixelIterator *iterator)
     return(MagickFalse);
   for (x=0; x < (ssize_t) iterator->region.width; x++)
   {
-    PixelGetQuantumPixel(iterator->image,iterator->pixel_wands[x],pixels);
-    pixels+=GetPixelChannels(iterator->image);
+    PixelGetQuantumPixel(GetCacheViewImage(iterator->view),
+      iterator->pixel_wands[x],pixels);
+    pixels+=GetPixelChannels(GetCacheViewImage(iterator->view));
   }
   if (SyncCacheViewAuthenticPixels(iterator->view,iterator->exception) == MagickFalse)
     return(MagickFalse);