From: dirk Date: Sat, 24 Jan 2015 17:17:06 +0000 (+0000) Subject: Added const to various methods. X-Git-Tag: 7.0.1-0~1383 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=100c62ceee252ed475fca6a57b3dbaa3d27d2ed9;p=imagemagick Added const to various methods. --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index d32d9d32c..66fefe5a3 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -349,12 +349,12 @@ Magick::Color Magick::Image::alphaColor(void) const void Magick::Image::antiAlias(const bool flag_) { modifyImage(); - options()->antiAlias(static_cast(flag_)); + options()->antiAlias(flag_); } -bool Magick::Image::antiAlias(void) +bool Magick::Image::antiAlias(void) const { - return(static_cast(options()->antiAlias())); + return(constOptions()->antiAlias()); } void Magick::Image::animationDelay(const size_t delay_) @@ -1924,7 +1924,7 @@ void Magick::Image::artifact(const std::string &name_,const std::string &value_) (void) SetImageArtifact(image(),name_.c_str(),value_.c_str()); } -std::string Magick::Image::artifact(const std::string &name_) +std::string Magick::Image::artifact(const std::string &name_) const { const char *value; @@ -1943,7 +1943,7 @@ void Magick::Image::attribute(const std::string name_,const std::string value_) ThrowImageException; } -std::string Magick::Image::attribute(const std::string name_) +std::string Magick::Image::attribute(const std::string name_) const { const char *value; @@ -2380,8 +2380,8 @@ bool Magick::Image::compare(const Image &reference_) GetPPException; modifyImage(); - ref.modifyImage(); - status=static_cast(IsImagesEqual(image(),ref.image(),exceptionInfo)); + status=static_cast(IsImagesEqual(image(),ref.constImage(), + exceptionInfo)); ThrowImageException; return(status); } @@ -3415,7 +3415,7 @@ void Magick::Image::modulate(const double brightness_,const double saturation_, ThrowImageException; } -Magick::ImageMoments Magick::Image::moments(void) +Magick::ImageMoments Magick::Image::moments(void) const { return(ImageMoments(*this)); } @@ -3636,7 +3636,7 @@ void Magick::Image::perceptibleChannel(const ChannelType channel_, ThrowImageException; } - Magick::ImagePerceptualHash Magick::Image::perceptualHash() + Magick::ImagePerceptualHash Magick::Image::perceptualHash() const { return(ImagePerceptualHash(*this)); } @@ -4146,7 +4146,7 @@ void Magick::Image::selectiveBlurChannel(const ChannelType channel_, ThrowImageException; } -Magick::Image Magick::Image::separate(const ChannelType channel_) +Magick::Image Magick::Image::separate(const ChannelType channel_) const { MagickCore::Image *image; @@ -4337,7 +4337,7 @@ void Magick::Image::spread(const size_t amount_) ThrowImageException; } -Magick::ImageStatistics Magick::Image::statistics() +Magick::ImageStatistics Magick::Image::statistics() const { return(ImageStatistics(*this)); } @@ -4587,7 +4587,7 @@ void Magick::Image::trim(void) ThrowImageException; } -Magick::Image Magick::Image::uniqueColors(void) +Magick::Image Magick::Image::uniqueColors(void) const { MagickCore::Image *image; diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index 3e5b81b0c..bd9005be9 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -108,7 +108,7 @@ namespace Magick // Anti-alias Postscript and TrueType fonts (default true) void antiAlias(const bool flag_); - bool antiAlias(void); + bool antiAlias(void) const; // Time in 1/100ths of a second which must expire before // displaying the next image in an animated sequence. @@ -605,11 +605,11 @@ namespace Magick void artifact(const std::string &name_,const std::string &value_); // Returns the value of the artifact with the specified name. - std::string artifact(const std::string &name_); + std::string artifact(const std::string &name_) const; // Access/Update a named image attribute void attribute(const std::string name_,const std::string value_); - std::string attribute(const std::string name_); + std::string attribute(const std::string name_) const; // Extracts the 'mean' from the image and adjust the image to try // make set its gamma appropriatally. @@ -1031,7 +1031,7 @@ namespace Magick const double hue_); // Returns the normalized moments of one or more image channels. - ImageMoments moments(void); + ImageMoments moments(void) const; // Applies a kernel to the image according to the given mophology method. void morphology(const MorphologyMethod method_,const std::string kernel_, @@ -1084,7 +1084,7 @@ namespace Magick void perceptibleChannel(const ChannelType channel_,const double epsilon_); // Returns the perceptual hash for this image. - Magick::ImagePerceptualHash perceptualHash(); + Magick::ImagePerceptualHash perceptualHash() const; // Ping is similar to read except only enough of the image is read // to determine the image columns, rows, and filesize. Access the @@ -1237,7 +1237,7 @@ namespace Magick const double sigma_,const double threshold_); // Separates a channel from the image and returns it as a grayscale image. - Image separate(const ChannelType channel_); + Image separate(const ChannelType channel_) const; // Applies a special effect to the image, similar to the effect achieved in // a photo darkroom by sepia toning. Threshold ranges from 0 to @@ -1307,7 +1307,7 @@ namespace Magick void spread(const size_t amount_=3); // Returns the statistics for this image. - Magick::ImageStatistics statistics(); + Magick::ImageStatistics statistics() const; // Add a digital watermark to the image (based on second image) void stegano(const Image &watermark_); @@ -1382,7 +1382,7 @@ namespace Magick void trim(void); // Returns the unique colors of an image. - Image uniqueColors(void); + Image uniqueColors(void) const; // Replace image with a sharpened version of the original image // using the unsharp mask algorithm.