diff Core/Images/ImageProcessing.cpp @ 4079:73c22208272f

ImageProcessing::ShiftScale2()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jun 2020 18:59:45 +0200
parents 2a170a8f1faf
children f18eaade6153
line wrap: on
line diff
--- a/Core/Images/ImageProcessing.cpp	Mon Jun 22 15:09:40 2020 +0200
+++ b/Core/Images/ImageProcessing.cpp	Mon Jun 22 18:59:45 2020 +0200
@@ -1470,6 +1470,40 @@
   }
 
 
+  void ImageProcessing::ShiftScale2(ImageAccessor& image,
+                                    float offset,
+                                    float scaling,
+                                    bool useRound)
+  {
+    if (std::abs(scaling) < 0.001f)
+    {
+      Set(image, offset);
+    }
+    else
+    {
+      ShiftScale(image, offset / scaling, scaling, useRound);
+    }
+  }
+
+
+  void ImageProcessing::ShiftScale2(ImageAccessor& target,
+                                    const ImageAccessor& source,
+                                    float offset,
+                                    float scaling,
+                                    bool useRound)
+  {
+    if (std::abs(scaling) < 0.0001f)
+    {
+      Set(target, offset);
+    }
+    else
+    {
+      ShiftScale(target, source, offset / scaling, scaling, useRound);
+    }
+  }
+
+
+
   void ImageProcessing::Invert(ImageAccessor& image, int64_t maxValue)
   {
     const unsigned int width = image.GetWidth();