]> granicus.if.org Git - imagemagick/commitdiff
Added setColorMetric to Magick++.
authordirk <dirk@git.imagemagick.org>
Sat, 12 Dec 2015 16:17:48 +0000 (17:17 +0100)
committerdirk <dirk@git.imagemagick.org>
Sat, 12 Dec 2015 16:17:48 +0000 (17:17 +0100)
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Image.h

index c4b1b04da0b1078e2b340316b2f8be05afc7fd27..b51e850302189187bb0adb31bd7cec2f2d954b85 100644 (file)
@@ -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<bool>(IsImagesEqual(image(),ref.constImage(),
+  status=static_cast<bool>(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<bool>(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_)
 {
index 2dfd21174914efbe49d63a0f6f5fc4debc70e8c2..bab3a3ebd63bb9bd5e6721580700374c83f8acdb 100644 (file)
@@ -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.