[gegl] piecewise-blend: add gamma property



commit d51b4766407d06124a6324a5d6538e5d906cfd19
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri May 15 18:34:16 2020 +0200

    piecewise-blend: add gamma property
    
    Add a gamma factor to make the spacing between steps non-linear, this is
    useful since for instance when implementing variable blur having more
    small step variations has larger impact on result than many levels with
    large blur radii.

 operations/common-cxx/piecewise-blend.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/operations/common-cxx/piecewise-blend.cc b/operations/common-cxx/piecewise-blend.cc
index cadebbfd0..8f97d34bd 100644
--- a/operations/common-cxx/piecewise-blend.cc
+++ b/operations/common-cxx/piecewise-blend.cc
@@ -35,6 +35,9 @@ property_boolean (normalized_mask, _("Normalized mask"), TRUE)
 property_boolean (linear_mask, _("Linear mask"), TRUE)
     description (_("Use linear mask values"))
 
+property_double (gamma, _("Gamma"), 1.0)
+    description (_("Raise gamma for non-linear spacing of steps."))
+    value_range (0.0, 10.0)
 #else
 
 #define GEGL_OP_BASE
@@ -252,7 +255,10 @@ process (GeglOperation        *operation,
               gint          j;
               gint          c;
 
-              v = *in * scale;
+              v = powf (*in, 1.0/o->gamma);
+
+              v = v * scale;
+
 
               v = v > 0.0f ? v < scale ? v : scale : 0.0f;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]