[gegl] bloom: add "limit-exposure" property



commit 88bfd72b483765fa8c7e4e0819ff276d3126be8b
Author: Ell <ell_se yahoo com>
Date:   Thu May 14 22:18:17 2020 +0300

    bloom: add "limit-exposure" property
    
    In gegl:bloom, add a new "limit-exposure" boolean property, which
    avoids over-exposing highlights when set.  We do this by using
    gegl:screen, instead of gegl:add, to combine the highlights with
    the input.

 operations/common/bloom.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/operations/common/bloom.c b/operations/common/bloom.c
index 90aba4903..cadab251c 100644
--- a/operations/common/bloom.c
+++ b/operations/common/bloom.c
@@ -44,6 +44,9 @@ property_double (strength, _("Strength"), 50.0)
     value_range (0.0, 1000.0)
     ui_range    (0.0, 100.0)
 
+property_boolean (limit_exposure, _("Limit exposure"), FALSE)
+    description (_("Don't over-expose highlights"))
+
 #else
 
 #define GEGL_OP_META
@@ -60,7 +63,7 @@ typedef struct
   GeglNode *rgb_clip;
   GeglNode *multiply;
   GeglNode *gaussian_blur;
-  GeglNode *add;
+  GeglNode *combine;
 } Nodes;
 
 static void
@@ -82,6 +85,11 @@ update (GeglOperation *operation)
       gegl_node_set (nodes->rgb_clip,
                      "high-limit", o->strength / 100.0,
                      NULL);
+
+      gegl_node_set (nodes->combine,
+                     "operation", o->limit_exposure ? "gegl:screen" :
+                                                      "gegl:add",
+                     NULL);
     }
 }
 
@@ -134,7 +142,7 @@ attach (GeglOperation *operation)
     "operation",     "gegl:gaussian-blur",
     NULL);
 
-  nodes->add            = gegl_node_new_child (
+  nodes->combine        = gegl_node_new_child (
     operation->node,
     "operation",     "gegl:add",
     NULL);
@@ -154,11 +162,11 @@ attach (GeglOperation *operation)
   gegl_node_link (nodes->multiply, nodes->gaussian_blur);
 
   gegl_node_connect_to (input,                "output",
-                        nodes->add,           "input");
+                        nodes->combine,       "input");
   gegl_node_connect_to (nodes->gaussian_blur, "output",
-                        nodes->add,           "aux");
+                        nodes->combine,       "aux");
 
-  gegl_node_link (nodes->add, output);
+  gegl_node_link (nodes->combine, output);
 
   gegl_operation_meta_redirect (operation,            "radius",
                                 nodes->gaussian_blur, "std-dev-x");
@@ -172,7 +180,7 @@ attach (GeglOperation *operation)
                                    nodes->rgb_clip,
                                    nodes->multiply,
                                    nodes->gaussian_blur,
-                                   nodes->add,
+                                   nodes->combine,
                                    NULL);
 
   update (operation);


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