From: dirk Date: Sat, 12 Dec 2015 16:17:48 +0000 (+0100) Subject: Added setColorMetric to Magick++. X-Git-Tag: 7.0.1-0~450 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=181b2a74351daea0388a98b8e37e13efc53d42c9;p=imagemagick Added setColorMetric to Magick++. --- diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index c4b1b04da..b51e85030 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -2433,7 +2433,7 @@ void Magick::Image::colorMatrix(const size_t order_, ThrowImageException; } -bool Magick::Image::compare(const Image &reference_) +bool Magick::Image::compare(const Image &reference_) const { bool status; @@ -2442,8 +2442,7 @@ bool Magick::Image::compare(const Image &reference_) ref=reference_; GetPPException; - modifyImage(); - status=static_cast(IsImagesEqual(image(),ref.constImage(), + status=static_cast(IsImagesEqual(constImage(),ref.constImage(), exceptionInfo)); ThrowImageException; return(status); @@ -4304,6 +4303,22 @@ void Magick::Image::sepiaTone(const double threshold_) ThrowImageException; } +bool Magick::Image::setColorMetric(const Image &reference_) +{ + bool + status; + + Image + ref=reference_; + + GetPPException; + modifyImage(); + status=static_cast(SetImageColorMetric(image(),ref.constImage(), + exceptionInfo)); + ThrowImageException; + return(status); +} + Magick::Quantum *Magick::Image::setPixels(const ssize_t x_,const ssize_t y_, const size_t columns_,const size_t rows_) { diff --git a/Magick++/lib/Magick++/Image.h b/Magick++/lib/Magick++/Image.h index 2dfd21174..bab3a3ebd 100644 --- a/Magick++/lib/Magick++/Image.h +++ b/Magick++/lib/Magick++/Image.h @@ -749,9 +749,8 @@ namespace Magick void colorMatrix(const size_t order_,const double *color_matrix_); // Compare current image with another image - // Sets meanErrorPerPixel, normalizedMaxError, and normalizedMeanError - // in the current image. False is returned if the images are identical. - bool compare(const Image &reference_); + // False is returned if the images are not identical. + bool compare(const Image &reference_) const; // Compare current image with another image // Returns the distortion based on the specified metric. @@ -1296,6 +1295,10 @@ namespace Magick // A threshold of 80% is a good starting point for a reasonable tone. void sepiaTone(const double threshold_); + // Sets meanErrorPerPixel, normalizedMaxError, and normalizedMeanError + // in the current image. False is returned if the images are not identical. + bool setColorMetric(const Image &reference_); + // Allocates a pixel cache region to store image pixels as defined // by the region rectangle. This area is subsequently transferred // from the pixel cache to the image via syncPixels.