]> granicus.if.org Git - imagemagick/commitdiff
Added negateChannel to Magick++.
authordirk <dirk@git.imagemagick.org>
Sun, 18 Aug 2013 18:19:09 +0000 (18:19 +0000)
committerdirk <dirk@git.imagemagick.org>
Sun, 18 Aug 2013 18:19:09 +0000 (18:19 +0000)
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Image.h

index d9ec6ed9327c52c7c3a65fe06b1fb81d0c587735..d32706532656bf0e5e5de68da7de60d574193dcb 100644 (file)
@@ -1781,7 +1781,7 @@ void Magick::Image::magnify ( void )
 }
 
 // Remap image colors with closest color from reference image
-void Magick::Image::map ( const Image &mapImage_ , const bool dither_ )
+void Magick::Image::map ( const Image &mapImage_, const bool dither_ )
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
@@ -1794,7 +1794,7 @@ void Magick::Image::map ( const Image &mapImage_ , const bool dither_ )
 }
 
 // Floodfill designated area with replacement alpha value
-void Magick::Image::matteFloodfill ( const Color &target_ ,
+void Magick::Image::matteFloodfill ( const Color &target_,
                                      const unsigned int alpha_,
                                      const ssize_t x_, const ssize_t y_,
                                      const Magick::PaintMethod method_ )
@@ -1877,7 +1877,7 @@ void Magick::Image::motionBlur ( const double radius_,
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
-    
+
 // Negate image.  Set grayscale_ to true to effect grayscale values
 // only
 void Magick::Image::negate ( const bool grayscale_ )
@@ -1885,8 +1885,20 @@ void Magick::Image::negate ( const bool grayscale_ )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  NegateImage ( image(), grayscale_ == true ? MagickTrue : MagickFalse,
-                &exceptionInfo );
+  NegateImage( image(), (MagickBooleanType) grayscale_, &exceptionInfo );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
+void Magick::Image::negateChannel ( const ChannelType channel_,
+                                    const bool grayscale_ )
+{
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  modifyImage();
+  ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
+  NegateImage( image(), (MagickBooleanType) grayscale_, &exceptionInfo );
+  SetPixelChannelMask( image(), channel_mask );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
index 24b9097741b44f5ad48fec0d1d67e66849359eea..5291c1f937c2b7b70776b801eef3471dd958b3f8 100644 (file)
@@ -560,11 +560,11 @@ namespace Magick
     void            magnify ( void );
 
     // Remap image colors with closest color from reference image
-    void            map ( const Image &mapImage_ ,
+    void            map ( const Image &mapImage_,
                           const bool dither_ = false );
 
     // Floodfill designated area with replacement alpha value
-    void            matteFloodfill ( const Color &target_ ,
+    void            matteFloodfill ( const Color &target_,
                                      const unsigned int alpha_,
                                      const ::ssize_t x_, const ::ssize_t y_,
                                      const PaintMethod method_ );
@@ -594,6 +594,8 @@ namespace Magick
     // Negate colors in image.  Set grayscale to only negate grayscale
     // values in image.
     void            negate ( const bool grayscale_ = false );
+    void            negateChannel ( const ChannelType channel_,
+                                    const bool grayscale_ = false );
 
     // Normalize image (increase contrast by normalizing the pixel
     // values to span the full range of color values)