]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 31 Aug 2011 01:02:48 +0000 (01:02 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 31 Aug 2011 01:02:48 +0000 (01:02 +0000)
MagickCore/animate.c
MagickCore/display.c
MagickCore/effect.c
MagickCore/enhance.c
MagickCore/fx.c
MagickCore/resize.c
MagickCore/shear.c
MagickCore/stream.c
MagickCore/threshold.c
MagickCore/transform.c
MagickCore/version.h

index a76471308aaaf0d85221cea6ceb4e7769bfe74dc..aba1d86e5440f0692c731c7d4fd5334d4487982d 100644 (file)
@@ -314,10 +314,6 @@ MagickExport MagickBooleanType AnimateImages(const ImageInfo *image_info,
   resource_info.immutable=MagickTrue;
   argv[0]=AcquireString(GetClientName());
   (void) XAnimateImages(display,&resource_info,argv,1,images,exception);
-  SetErrorHandler((ErrorHandler) NULL);
-  SetWarningHandler((WarningHandler) NULL);
-  SetErrorHandler((ErrorHandler) NULL);
-  SetWarningHandler((WarningHandler) NULL);
   argv[0]=DestroyString(argv[0]);
   (void) XCloseDisplay(display);
   XDestroyResourceInfo(&resource_info);
index 85c4583db061caf1639b228fe114c4961649ea1e..1c93b078d35dc4976c60b0439fef52d8716eee0f 100644 (file)
@@ -1695,8 +1695,6 @@ MagickExport MagickBooleanType DisplayImages(const ImageInfo *image_info,
     image=GetImageFromList(images,i % GetImageListLength(images));
     (void) XDisplayImage(display,&resource_info,argv,1,&image,&state,exception);
   }
-  SetErrorHandler((ErrorHandler) NULL);
-  SetWarningHandler((WarningHandler) NULL);
   argv[0]=DestroyString(argv[0]);
   (void) XCloseDisplay(display);
   XDestroyResourceInfo(&resource_info);
index a61be98e35c1f6055ac76f7566eef761836b69c7..9c57202a10e942dfbc5f288d89fa646f3e0af139 100644 (file)
@@ -1341,11 +1341,10 @@ MagickExport Image *ConvolveImage(const Image *image,
           v;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         convolve_traits=GetPixelChannelMapTraits(convolve_image,channel);
-        if (convolve_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (convolve_traits == UndefinedPixelTrait))
           continue;
         if ((convolve_traits & CopyPixelTrait) != 0)
           {
index d9f5fd22ee0625bdf9d0f31009ab8bfce1ae2530..d6c70a265610bdab527f292c73abf1b1e5b63793 100644 (file)
@@ -383,13 +383,14 @@ MagickExport MagickBooleanType ClutImage(Image *image,const Image *clut_image,
           traits;
 
         clut_traits=GetPixelChannelMapTraits(clut_image,(PixelChannel) i);
-        if (clut_traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(clut_image,(PixelChannel) i);
         traits=GetPixelChannelMapTraits(clut_image,channel);
-        if ((traits & UpdatePixelTrait) != 0)
-          q[channel]=ClampToQuantum(clut_map[ScaleQuantumToMap(q[channel])*
-            GetPixelChannels(clut_image)+channel]);
+        if ((traits == UndefinedPixelTrait) ||
+            (clut_traits == UndefinedPixelTrait) ||
+            ((traits & UpdatePixelTrait) == 0))
+          continue;
+        q[channel]=ClampToQuantum(clut_map[ScaleQuantumToMap(q[channel])*
+          GetPixelChannels(clut_image)+channel]);
       }
       q+=GetPixelChannels(image);
     }
@@ -1389,11 +1390,10 @@ MagickExport Image *EnhanceImage(const Image *image,ExceptionInfo *exception)
           *restrict r;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         enhance_traits=GetPixelChannelMapTraits(enhance_image,channel);
-        if (enhance_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (enhance_traits == UndefinedPixelTrait))
           continue;
         q[channel]=p[center+i];
         if ((enhance_traits & CopyPixelTrait) != 0)
@@ -2195,9 +2195,8 @@ MagickExport MagickBooleanType LevelImage(Image *image,const double black_point,
           traits;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
-        if ((traits & UpdatePixelTrait) == 0)
+        if ((traits == UndefinedPixelTrait) ||
+            ((traits & UpdatePixelTrait) == 0))
           continue;
         q[i]=LevelQuantum(q[i]);
       }
index f9ab8a393161040bc9d233c1f427b8eb26ee5568..1d64588ef5f58a14e6e9c483ec14233932f6d83a 100644 (file)
@@ -3034,11 +3034,10 @@ MagickExport Image *FxImage(const Image *image,const char *expression,
           traits;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         fx_traits=GetPixelChannelMapTraits(fx_image,channel);
-        if (fx_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (fx_traits == UndefinedPixelTrait))
           continue;
         if ((fx_traits & CopyPixelTrait) != 0)
           {
index ac79ff48de9c545b0fbc36849b3a5fcab5222995..e88ff06b33b196702bdec742703e97f680be81fb 100644 (file)
@@ -1244,11 +1244,10 @@ MagickExport Image *AdaptiveResizeImage(const Image *image,
           traits;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         resize_traits=GetPixelChannelMapTraits(resize_image,channel);
-        if (resize_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (resize_traits == UndefinedPixelTrait))
           continue;
         if ((resize_traits & CopyPixelTrait) != 0)
           {
@@ -1801,11 +1800,10 @@ MagickExport Image *LiquidRescaleImage(const Image *image,const size_t columns,
         traits;
 
       traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-      if (traits == UndefinedPixelTrait)
-        continue;
       channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
       rescale_traits=GetPixelChannelMapTraits(rescale_image,channel);
-      if (rescale_traits == UndefinedPixelTrait)
+      if ((traits == UndefinedPixelTrait) ||
+          (rescale_traits == UndefinedPixelTrait))
         continue;
       q[channel]=ClampToQuantum(QuantumRange*packet[i]);
     }
@@ -2233,11 +2231,10 @@ static MagickBooleanType HorizontalFilter(const ResizeFilter *resize_filter,
           k;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         resize_traits=GetPixelChannelMapTraits(resize_image,channel);
-        if (resize_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (resize_traits == UndefinedPixelTrait))
           continue;
         if ((resize_traits & CopyPixelTrait) != 0)
           {
@@ -2446,11 +2443,10 @@ static MagickBooleanType VerticalFilter(const ResizeFilter *resize_filter,
           k;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         resize_traits=GetPixelChannelMapTraits(resize_image,channel);
-        if (resize_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (resize_traits == UndefinedPixelTrait))
           continue;
         if ((resize_traits & CopyPixelTrait) != 0)
           {
@@ -2753,11 +2749,10 @@ MagickExport Image *SampleImage(const Image *image,const size_t columns,
           traits;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         sample_traits=GetPixelChannelMapTraits(sample_image,channel);
-        if (sample_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (sample_traits == UndefinedPixelTrait))
           continue;
         q[channel]=p[x_offset[x]*GetPixelChannels(image)+i];
       }
@@ -3052,11 +3047,10 @@ MagickExport Image *ScaleImage(const Image *image,const size_t columns,
           for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
           {
             traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-            if (traits == UndefinedPixelTrait)
-              continue;
             channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
             scale_traits=GetPixelChannelMapTraits(scale_image,channel);
-            if (scale_traits == UndefinedPixelTrait)
+            if ((traits == UndefinedPixelTrait) ||
+                (scale_traits == UndefinedPixelTrait))
               continue;
             if ((scale_traits & BlendPixelTrait) == 0)
               {
@@ -3141,11 +3135,10 @@ MagickExport Image *ScaleImage(const Image *image,const size_t columns,
         for (i=0; i < (ssize_t) GetPixelChannels(scale_image); i++)
         {
           traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-          if (traits == UndefinedPixelTrait)
-            continue;
           channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
           scale_traits=GetPixelChannelMapTraits(scale_image,channel);
-          if (scale_traits == UndefinedPixelTrait)
+          if ((traits == UndefinedPixelTrait) ||
+              (scale_traits == UndefinedPixelTrait))
             continue;
           if ((scale_traits & BlendPixelTrait) == 0)
             {
index 6cf7d1eda9ceb8c11f5136dc4fcda79e66576be2..a36e0805df65b69b0bf5f084fc518e35e33414d5 100644 (file)
@@ -1154,11 +1154,10 @@ static Image *IntegralRotateImage(const Image *image,size_t rotations,
                   traits;
 
                 traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-                if (traits == UndefinedPixelTrait)
-                  continue;
                 channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
                 rotate_traits=GetPixelChannelMapTraits(rotate_image,channel);
-                if (rotate_traits == UndefinedPixelTrait)
+                if ((traits == UndefinedPixelTrait) ||
+                    (rotate_traits == UndefinedPixelTrait))
                   continue;
                 if ((rotate_traits & CopyPixelTrait) != 0)
                   {
@@ -1243,11 +1242,10 @@ static Image *IntegralRotateImage(const Image *image,size_t rotations,
               traits;
 
             traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-            if (traits == UndefinedPixelTrait)
-              continue;
             channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
             rotate_traits=GetPixelChannelMapTraits(rotate_image,channel);
-            if (rotate_traits == UndefinedPixelTrait)
+            if ((traits == UndefinedPixelTrait) ||
+                (rotate_traits == UndefinedPixelTrait))
               continue;
             if ((rotate_traits & CopyPixelTrait) != 0)
               {
@@ -1363,11 +1361,10 @@ static Image *IntegralRotateImage(const Image *image,size_t rotations,
                   traits;
 
                 traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-                if (traits == UndefinedPixelTrait)
-                  continue;
                 channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
                 rotate_traits=GetPixelChannelMapTraits(rotate_image,channel);
-                if (rotate_traits == UndefinedPixelTrait)
+                if ((traits == UndefinedPixelTrait) ||
+                    (rotate_traits == UndefinedPixelTrait))
                   continue;
                 if ((rotate_traits & CopyPixelTrait) != 0)
                   {
index 99a13e21efc3acf810331d574eb59d8a2c3f17b0..d29bc4209b9d8b6eaa660eff79995afc120fd570 100644 (file)
@@ -489,17 +489,15 @@ static MagickBooleanType GetOneVirtualPixelFromStream(const Image *image,
   PixelPacket *pixel,ExceptionInfo *exception)
 {
   const Quantum
-    *p;
+    *q;
 
   assert(image != (Image *) NULL);
   assert(image->signature == MagickSignature);
   *pixel=image->background_color;
-  p=GetVirtualPixelStream(image,virtual_pixel_method,x,y,1,1,exception);
-  if (p == (const Quantum *) NULL)
+  q=GetVirtualPixelStream(image,virtual_pixel_method,x,y,1,1,exception);
+  if (q != (const Quantum *) NULL)
     return(MagickFalse);
-  GetPixelPacket(image,p,pixel);
-  if (image->colorspace == CMYKColorspace)
-    pixel->black=GetPixelBlack(image,p);
+  GetPixelPacket(image,q,pixel);
   return(MagickTrue);
 }
 \f
index b55ff7da77ef56b58d6592be762c9147a6fcbf18..d407783358203b719e129b41c2fd940de6ec5eae 100644 (file)
@@ -252,11 +252,10 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image,
           v;
 
         traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
-        if (traits == UndefinedPixelTrait)
-          continue;
         channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
         threshold_traits=GetPixelChannelMapTraits(threshold_image,channel);
-        if (threshold_traits == UndefinedPixelTrait)
+        if ((traits == UndefinedPixelTrait) ||
+            (threshold_traits == UndefinedPixelTrait))
           continue;
         if ((threshold_traits & CopyPixelTrait) != 0)
           {
index 0848029c30b6a741b520bca93bde7c90b9758c3f..e87b40bf7d58528efdd1df62ca8ed210d7abdbd7 100644 (file)
@@ -514,6 +514,9 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry,
   MagickOffsetType
     progress;
 
+  OffsetInfo
+    offset;
+
   RectangleInfo
     bounding_box,
     page;
@@ -612,8 +615,10 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry,
     return((Image *) NULL);
   crop_image->page.width=image->page.width;
   crop_image->page.height=image->page.height;
-  if (((ssize_t) (bounding_box.x+bounding_box.width) > (ssize_t) image->page.width) ||
-      ((ssize_t) (bounding_box.y+bounding_box.height) > (ssize_t) image->page.height))
+  offset.x=(ssize_t) (bounding_box.x+bounding_box.width);
+  offset.y=(ssize_t) (bounding_box.y+bounding_box.height);
+  if ((offset.x > (ssize_t) image->page.width) ||
+      (offset.y > (ssize_t) image->page.height))
     {
       crop_image->page.width=bounding_box.width;
       crop_image->page.height=bounding_box.height;
@@ -654,14 +659,26 @@ MagickExport Image *CropImage(const Image *image,const RectangleInfo *geometry,
       }
     for (x=0; x < (ssize_t) crop_image->columns; x++)
     {
-      SetPixelRed(crop_image,GetPixelRed(image,p),q);
-      SetPixelGreen(crop_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(crop_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(crop_image,GetPixelBlack(image,p),q);
-      SetPixelAlpha(crop_image,GetPixelAlpha(image,p),q);
-      if (image->storage_class == PseudoClass)
-        SetPixelIndex(crop_image,GetPixelIndex(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          crop_traits,
+          traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        crop_traits=GetPixelChannelMapTraits(crop_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (crop_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(crop_image);
     }
@@ -994,14 +1011,26 @@ MagickExport Image *ExcerptImage(const Image *image,
       }
     for (x=0; x < (ssize_t) excerpt_image->columns; x++)
     {
-      SetPixelRed(excerpt_image,GetPixelRed(image,p),q);
-      SetPixelGreen(excerpt_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(excerpt_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(excerpt_image,GetPixelBlack(image,p),q);
-      if (image->storage_class == PseudoClass)
-        SetPixelIndex(excerpt_image,GetPixelIndex(image,p),q);
-      SetPixelAlpha(excerpt_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          excerpt_traits,
+          traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        excerpt_traits=GetPixelChannelMapTraits(excerpt_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (excerpt_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(excerpt_image);
     }
@@ -1182,14 +1211,26 @@ MagickExport Image *FlipImage(const Image *image,ExceptionInfo *exception)
       }
     for (x=0; x < (ssize_t) flip_image->columns; x++)
     {
-      SetPixelRed(flip_image,GetPixelRed(image,p),q);
-      SetPixelGreen(flip_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(flip_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(flip_image,GetPixelBlack(image,p),q);
-      if (image->storage_class == PseudoClass)
-        SetPixelIndex(flip_image,GetPixelIndex(image,p),q);
-      SetPixelAlpha(flip_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          flip_traits,
+          traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        flip_traits=GetPixelChannelMapTraits(flip_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (flip_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(flip_image);
     }
@@ -1311,15 +1352,27 @@ MagickExport Image *FlopImage(const Image *image,ExceptionInfo *exception)
     q+=GetPixelChannels(flop_image)*flop_image->columns;
     for (x=0; x < (ssize_t) flop_image->columns; x++)
     {
+      register ssize_t
+        i;
+
       q-=GetPixelChannels(flop_image);
-      SetPixelRed(flop_image,GetPixelRed(image,p),q);
-      SetPixelGreen(flop_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(flop_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(flop_image,GetPixelBlack(image,p),q);
-      SetPixelAlpha(flop_image,GetPixelAlpha(image,p),q);
-      if (image->storage_class == PseudoClass)
-        SetPixelIndex(flop_image,GetPixelIndex(image,p),q);
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          flop_traits,
+          traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        flop_traits=GetPixelChannelMapTraits(flop_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (flop_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
     }
     if (SyncCacheViewAuthenticPixels(flop_view,exception) == MagickFalse)
@@ -1427,12 +1480,26 @@ static inline MagickBooleanType CopyImageRegion(Image *destination,
       }
     for (x=0; x < (ssize_t) columns; x++)
     {
-      SetPixelRed(destination,GetPixelRed(source,p),q);
-      SetPixelGreen(destination,GetPixelGreen(source,p),q);
-      SetPixelBlue(destination,GetPixelBlue(source,p),q);
-      if (destination->colorspace == CMYKColorspace)
-        SetPixelBlack(destination,GetPixelBlack(source,p),q);
-      SetPixelAlpha(destination,GetPixelAlpha(source,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          destination_traits,
+          source_traits;
+
+        source_traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+        destination_traits=GetPixelChannelMapTraits(destination,channel);
+        if ((source_traits == UndefinedPixelTrait) ||
+            (destination_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(source);
       q+=GetPixelChannels(destination);
     }
@@ -1731,14 +1798,26 @@ MagickExport Image *SpliceImage(const Image *image,
       }
     for (x=0; x < splice_geometry.x; x++)
     {
-      SetPixelRed(splice_image,GetPixelRed(image,p),q);
-      SetPixelGreen(splice_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(splice_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(splice_image,GetPixelBlack(image,p),q);
-      SetPixelAlpha(splice_image,OpaqueAlpha,q);
-      if (image->matte != MagickFalse)
-        SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          splice_traits,
+          traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        splice_traits=GetPixelChannelMapTraits(splice_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (splice_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(splice_image);
     }
@@ -1746,14 +1825,26 @@ MagickExport Image *SpliceImage(const Image *image,
       q+=GetPixelChannels(splice_image);
     for ( ; x < (ssize_t) splice_image->columns; x++)
     {
-      SetPixelRed(splice_image,GetPixelRed(image,p),q);
-      SetPixelGreen(splice_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(splice_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(splice_image,GetPixelBlack(image,p),q);
-      SetPixelAlpha(splice_image,OpaqueAlpha,q);
-      if (image->matte != MagickFalse)
-        SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          traits,
+          splice_traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        splice_traits=GetPixelChannelMapTraits(splice_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (splice_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(splice_image);
     }
@@ -1803,14 +1894,26 @@ MagickExport Image *SpliceImage(const Image *image,
       }
     for (x=0; x < splice_geometry.x; x++)
     {
-      SetPixelRed(splice_image,GetPixelRed(image,p),q);
-      SetPixelGreen(splice_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(splice_image,GetPixelBlue(image,p),q);
-      SetPixelAlpha(splice_image,OpaqueAlpha,q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(splice_image,GetPixelBlack(image,p),q);
-      if (image->matte != MagickFalse)
-        SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          traits,
+          splice_traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        splice_traits=GetPixelChannelMapTraits(splice_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (splice_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(splice_image);
     }
@@ -1818,14 +1921,26 @@ MagickExport Image *SpliceImage(const Image *image,
       q+=GetPixelChannels(splice_image);
     for ( ; x < (ssize_t) splice_image->columns; x++)
     {
-      SetPixelRed(splice_image,GetPixelRed(image,p),q);
-      SetPixelGreen(splice_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(splice_image,GetPixelBlue(image,p),q);
-      SetPixelAlpha(splice_image,OpaqueAlpha,q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(splice_image,GetPixelBlack(image,p),q);
-      if (image->matte != MagickFalse)
-        SetPixelAlpha(splice_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          traits,
+          splice_traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        splice_traits=GetPixelChannelMapTraits(splice_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (splice_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(splice_image);
     }
@@ -1870,6 +1985,17 @@ MagickExport Image *SpliceImage(const Image *image,
 %
 %  This should only be used for single images.
 %
+%  This function destroys what it assumes to be a single image list.
+%  If the input image is part of a larger list, all other images in that list
+%  will be simply 'lost', not destroyed.
+%
+%  Also if the crop generates a list of images only the first image is resized.
+%  And finally if the crop succeeds and the resize failed, you will get a
+%  cropped image, as well as a 'false' or 'failed' report.
+%
+%  This function and should probably be depreciated in favor of direct calls
+%  to CropImageToTiles() or ResizeImage(), as appropriate.
+%
 %  The format of the TransformImage method is:
 %
 %      MagickBooleanType TransformImage(Image **image,const char *crop_geometry,
@@ -1885,19 +2011,6 @@ MagickExport Image *SpliceImage(const Image *image,
 %    o image_geometry: An image geometry string.  This geometry defines the
 %      final size of the image.
 %
-*/
-/*
-  DANGER: This function destroys what it assumes to be a single image list.
-  If the input image is part of a larger list, all other images in that list
-  will be simply 'lost', not destroyed.
-
-  Also if the crop generates a list of images only the first image is resized.
-  And finally if the crop succeeds and the resize failed, you will get a
-  cropped image, as well as a 'false' or 'failed' report.
-
-  This function and should probably be depreciated in favor of direct calls
-  to CropImageToTiles() or ResizeImage(), as appropriate.
-
 */
 MagickExport MagickBooleanType TransformImage(Image **image,
   const char *crop_geometry,const char *image_geometry)
@@ -2113,12 +2226,26 @@ MagickExport Image *TransposeImage(const Image *image,ExceptionInfo *exception)
       }
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      SetPixelRed(transpose_image,GetPixelRed(image,p),q);
-      SetPixelGreen(transpose_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(transpose_image,GetPixelBlue(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(transpose_image,GetPixelBlack(image,p),q);
-      SetPixelAlpha(transpose_image,GetPixelAlpha(image,p),q);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          traits,
+          transpose_traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        transpose_traits=GetPixelChannelMapTraits(transpose_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (transpose_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(transpose_image);
     }
@@ -2226,17 +2353,17 @@ MagickExport Image *TransverseImage(const Image *image,ExceptionInfo *exception)
     register const Quantum
       *restrict p;
 
-    register ssize_t
-      x;
-
     register Quantum
       *restrict q;
 
+    register ssize_t
+      x;
+
     if (status == MagickFalse)
       continue;
     p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
-    q=QueueCacheViewAuthenticPixels(transverse_view,(ssize_t) (image->rows-y-
-      1),0,1,transverse_image->rows,exception);
+    q=QueueCacheViewAuthenticPixels(transverse_view,(ssize_t) (image->rows-y-1),
+      0,1,transverse_image->rows,exception);
     if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
       {
         status=MagickFalse;
@@ -2245,13 +2372,27 @@ MagickExport Image *TransverseImage(const Image *image,ExceptionInfo *exception)
     q+=GetPixelChannels(transverse_image)*image->columns;
     for (x=0; x < (ssize_t) image->columns; x++)
     {
+      register ssize_t
+        i;
+
       q-=GetPixelChannels(transverse_image);
-      SetPixelRed(transverse_image,GetPixelRed(image,p),q);
-      SetPixelGreen(transverse_image,GetPixelGreen(image,p),q);
-      SetPixelBlue(transverse_image,GetPixelBlue(image,p),q);
-      SetPixelAlpha(transverse_image,GetPixelAlpha(image,p),q);
-      if (image->colorspace == CMYKColorspace)
-        SetPixelBlack(transverse_image,GetPixelBlack(image,p),q);
+      for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+      {
+        PixelChannel
+          channel;
+
+        PixelTrait
+          traits,
+          transverse_traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
+        transverse_traits=GetPixelChannelMapTraits(transverse_image,channel);
+        if ((traits == UndefinedPixelTrait) ||
+            (transverse_traits == UndefinedPixelTrait))
+          continue;
+        q[channel]=p[i];
+      }
       p+=GetPixelChannels(image);
     }
     sync=SyncCacheViewAuthenticPixels(transverse_view,exception);
index e6d836361dd22b4c8bf0d49825624cfa22b8d472..ec6c1456034b850d107662dead9a8b82c29420c0 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
 #define MagickLibAddendum  "-0"
 #define MagickLibInterface  5
 #define MagickLibMinInterface  5
-#define MagickReleaseDate  "2011-08-28"
+#define MagickReleaseDate  "2011-08-30"
 #define MagickChangeDate   "20110801"
 #define MagickAuthoritativeURL  "http://www.imagemagick.org"
 #if defined(MAGICKCORE_OPENMP_SUPPORT)