From: dirk Date: Thu, 29 Jan 2015 18:47:05 +0000 (+0000) Subject: Added new method to check if an image contains a specific channel. X-Git-Tag: 7.0.1-0~1346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d873c4a941602fe7aad3a06900166a4da3eb56b8;p=imagemagick Added new method to check if an image contains a specific channel. --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 66fefe5a3..559fc0013 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -960,6 +960,11 @@ MagickCore::DisposeType Magick::Image::gifDisposeMethod(void) const return(constImage()->dispose); } +bool Magick::Image::hasChannel(const PixelChannel channel) const +{ + return (GetPixelChannelTraits(constImage(),channel) != UndefinedPixelTrait); +} + void Magick::Image::highlightColor(const Color color_) { std::string diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index bd9005be9..17ff6bf94 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -276,6 +276,8 @@ namespace Magick void gifDisposeMethod(const DisposeType disposeMethod_); DisposeType gifDisposeMethod(void) const; + bool hasChannel(const PixelChannel channel) const; + // When comparing images, emphasize pixel differences with this color. void highlightColor(const Color color_); diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h index 48d9b0969..39a269f4a 100644 --- a/Magick++/lib/Magick++/Include.h +++ b/Magick++/lib/Magick++/Include.h @@ -1270,6 +1270,7 @@ namespace Magick using MagickCore::GetNextValueInLinkedList; using MagickCore::GetNumberOfElementsInLinkedList; using MagickCore::GetPixelBlue; + using MagickCore::GetPixelChannelTraits; using MagickCore::GetPixelGreen; using MagickCore::GetPixelInfo; using MagickCore::GetPixelRed;