]> granicus.if.org Git - imagemagick/commitdiff
apply fix for difference compose methods used by difference morphology.
authoranthony <anthony@git.imagemagick.org>
Thu, 6 May 2010 07:05:29 +0000 (07:05 +0000)
committeranthony <anthony@git.imagemagick.org>
Thu, 6 May 2010 07:05:29 +0000 (07:05 +0000)
ChangeLog
magick/morphology.c

index 2ef6e93ac974f041e48e93012b218cecd9e0f4e2..4ea63f0906f4c9e0024897e6c960a61741a3f605 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-06  6.6.1-6 Anthony Thyssen <A.Thyssen@griffith...>
+  * Made use of new no-'sync' channel enabled mathematical compose methods
+    for the difference morphology methods.  These should now work correctly
+    for specific channels, and more importantally for alpha shaped morphology.
+
 2010-05-05  6.6.1-6 Cristy and Glenn Randers-Pehrson <glennrp@image...>
   * Fixed bugs with losing the opacity channel while writing some PNG images.
     (bug reported by Anthony T.)
index 36f2a7d6c44f5884ac3df14e6647c8613531c382..b5d18725c721a857c6df497f101e5088d42dd5bf 100644 (file)
@@ -1752,19 +1752,29 @@ MagickExport Image *MorphologyImageChannel(const Image *image,
   if ( curr_kernel != kernel )
     curr_kernel=DestroyKernelInfo(curr_kernel);
 
-  /* Third-level Subtractive methods post-processing */
+  /* Third-level Subtractive methods post-processing
+  **
+  ** The removal of any 'Sync' channel flag in the Image Compositon below
+  ** ensures the compose method is applied in a purely mathematical way, only
+  ** the selected channels, without any normal 'alpha blending' normally
+  ** associated with the compose method.
+  **
+  ** Note "method" here is the 'original' morphological method, and not the
+  ** 'current' morphological method used above to generate "new_image".
+  */
   switch( method ) {
     case EdgeOutMorphology:
     case EdgeInMorphology:
     case TopHatMorphology:
     case BottomHatMorphology:
       /* Get Difference relative to the original image */
-      (void) CompositeImageChannel(new_image, channel, DifferenceCompositeOp,
-          image, 0, 0);
+      (void) CompositeImageChannel(new_image, (channel & ~SyncChannels),
+           DifferenceCompositeOp, image, 0, 0);
       break;
-    case EdgeMorphology:  /* subtract the Erode from a Dilate */
-      (void) CompositeImageChannel(new_image, channel, DifferenceCompositeOp,
-          grad_image, 0, 0);
+    case EdgeMorphology:
+      /* Difference the Eroded image from the saved Dilated image */
+      (void) CompositeImageChannel(new_image, (channel & ~SyncChannels),
+           DifferenceCompositeOp, grad_image, 0, 0);
       grad_image=DestroyImage(grad_image);
       break;
     default: