From: dirk Date: Sat, 10 Aug 2013 09:19:30 +0000 (+0000) Subject: Added posterizeChannel to Magick++. X-Git-Tag: 7.0.1-0~3404 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=136e4f4cade2bbc8ac5f5a359e6f94e057c5b3b2;p=imagemagick Added posterizeChannel to Magick++. --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 14b9704cc..d9ec6ed93 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -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 diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index 27306da3f..d755f53ea 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -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