From d246d8eb9563661d9cfe52a2dd87414bd2e10a5f Mon Sep 17 00:00:00 2001 From: dirk Date: Fri, 9 Aug 2013 21:14:11 +0000 Subject: [PATCH] Added alphaChannel to Magick++. --- Magick++/lib/Image.cpp | 10 ++++++++++ Magick++/lib/Magick++/Image.h | 4 ++++ Magick++/lib/Magick++/Include.h | 14 ++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 647fbe933..a9bc76653 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -434,6 +434,16 @@ void Magick::Image::alpha ( const unsigned int alpha_ ) (void) DestroyExceptionInfo( &exceptionInfo ); } +void Magick::Image::alphaChannel ( AlphaChannelOption alphaOption_ ) +{ + modifyImage(); + ExceptionInfo exceptionInfo; + GetExceptionInfo( &exceptionInfo ); + SetImageAlphaChannel( image(), alphaOption_, &exceptionInfo ); + throwException( exceptionInfo ); + (void) DestroyExceptionInfo( &exceptionInfo ); +} + // Annotate using specified text, and placement location void Magick::Image::annotate ( const std::string &text_, const Geometry &location_ ) diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index 2515a601e..206c46c7a 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -154,6 +154,10 @@ namespace Magick // transparent, respectively. void alpha ( const unsigned int alpha_ ); + // AlphaChannel() activates, deactivates, resets, or sets the alpha + // channel. + void alphaChannel ( AlphaChannelOption alphaOption_ ); + // // Annotate image (draw text on image) // diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index 69c1d24b0..1a8e08af4 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -231,6 +231,20 @@ namespace Magick using MagickCore::MagickFalse; using MagickCore::MagickTrue; + // Alpha channel options + using MagickCore::AlphaChannelOption; + using MagickCore::UndefinedAlphaChannel; + using MagickCore::ActivateAlphaChannel; + using MagickCore::BackgroundAlphaChannel; + using MagickCore::CopyAlphaChannel; + using MagickCore::DeactivateAlphaChannel; + using MagickCore::ExtractAlphaChannel; + using MagickCore::OpaqueAlphaChannel; + using MagickCore::RemoveAlphaChannel; + using MagickCore::SetAlphaChannel; + using MagickCore::ShapeAlphaChannel; + using MagickCore::TransparentAlphaChannel; + // Image class types using MagickCore::ClassType; using MagickCore::UndefinedClass; -- 2.49.0