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

index 14b9704cc7ad95114954832d22a6d6a1ef752578..d9ec6ed9327c52c7c3a65fe06b1fb81d0c587735 100644 (file)
@@ -2020,6 +2020,20 @@ void Magick::Image::posterize ( const size_t levels_,
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
 
+void Magick::Image::posterizeChannel ( const ChannelType channel_,
+                                       const size_t levels_,
+                                       const DitherMethod method_ )
+{
+  modifyImage();
+  ExceptionInfo exceptionInfo;
+  GetExceptionInfo( &exceptionInfo );
+  ChannelType channel_mask = SetImageChannelMask( image(), channel_ );
+  PosterizeImage( image(), levels_, method_, &exceptionInfo );
+  SetPixelChannelMask( image(), channel_mask );
+  throwException( exceptionInfo );
+  (void) DestroyExceptionInfo( &exceptionInfo );
+}
+
 // Execute a named process module using an argc/argv syntax similar to
 // that accepted by a C 'main' routine. An exception is thrown if the
 // requested process module doesn't exist, fails to load, or fails during
index 27306da3f4814b91bbfdd696cea3226e40481d1e..d755f53ea8b0718ebb4fcf243f4d1e669ec9c15c 100644 (file)
@@ -634,6 +634,9 @@ namespace Magick
     // Reduces the image to a limited number of colors for a "poster" effect.
     void            posterize ( const size_t levels_,
                                 const DitherMethod method_ );
+    void            posterizeChannel ( const ChannelType channel_,
+                                       const size_t levels_,
+                                       const DitherMethod method_ );
 
     // Execute a named process module using an argc/argv syntax similar to
     // that accepted by a C 'main' routine. An exception is thrown if the