]> granicus.if.org Git - imagemagick/commitdiff
Added levelize to Magick++.
authordirk <dirk@git.imagemagick.org>
Mon, 28 Sep 2015 18:33:59 +0000 (20:33 +0200)
committerdirk <dirk@git.imagemagick.org>
Mon, 28 Sep 2015 18:33:59 +0000 (20:33 +0200)
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Image.h
Magick++/lib/Magick++/Include.h

index 98030a9a10844a4b948ccef3e3e90d1b4547cf67..28c508b52515943df82b004c19b21b4932b1b42b 100644 (file)
@@ -3452,6 +3452,26 @@ void Magick::Image::levelColorsChannel(const ChannelType channel_,
   ThrowImageException;
 }
 
+void Magick::Image::levelize(const double blackPoint_,const double whitePoint_,
+  const double gamma_)
+{
+  modifyImage();
+  GetPPException;
+  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
+  ThrowImageException;
+}
+
+void Magick::Image::levelizeChannel(const ChannelType channel_,
+  const double blackPoint_,const double whitePoint_,const double gamma_)
+{
+  modifyImage();
+  GetPPException;
+  GetAndSetPPChannelMask(channel_);
+  (void) LevelizeImage(image(),blackPoint_,whitePoint_,gamma_,exceptionInfo);
+  RestorePPChannelMask;
+  ThrowImageException;
+}
+
 void Magick::Image::linearStretch(const double blackPoint_,
   const double whitePoint_)
 {
index 6314d02e82456a8b0f2fa4595fde56b68cdd217c..e32c501334dbf16389c572a14c088ad86e60bc7f 100644 (file)
@@ -1049,6 +1049,15 @@ namespace Magick
       const Color &blackColor_,const Color &whiteColor_,
       const bool invert_=true);
 
+    // Levelize applies the reversed level operation to just the specific
+    // channels specified.It compresses the full range of color values, so
+    // that they lie between the given black and white points. Gamma is
+    // applied before the values are mapped.
+    void levelize(const double blackPoint_,const double whitePoint_,
+      const double gamma_=1.0);
+    void levelizeChannel(const ChannelType channel_,const double blackPoint_,
+      const double whitePoint_,const double gamma_=1.0);
+
     // Discards any pixels below the black point and above the white point and
     // levels the remaining pixels.
     void linearStretch(const double blackPoint_,const double whitePoint_);
index a15eb56c82371c2299a8a9be493315a875df549e..4ce30511489f312a7cca612e737446d145d71720 100644 (file)
@@ -1346,6 +1346,7 @@ namespace Magick
   using MagickCore::KuwaharaImage;
   using MagickCore::LevelImage;
   using MagickCore::LevelImageColors;
+  using MagickCore::LevelizeImage;
   using MagickCore::LinearStretchImage;
   using MagickCore::LiquidRescaleImage;
   using MagickCore::LocaleCompare;