[gegl] recursive-transform: add "fade-opacity" property



commit d51937ba8f346771a5220016f1a8e19f6e2e0f07
Author: Ell <ell_se yahoo com>
Date:   Thu Mar 8 14:55:26 2018 -0500

    recursive-transform: add "fade-opacity" property
    
    ... which scales the opacity of each successive iteration.

 operations/workshop/recursive-transform.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/operations/workshop/recursive-transform.c b/operations/workshop/recursive-transform.c
index ac91c17..b03da86 100644
--- a/operations/workshop/recursive-transform.c
+++ b/operations/workshop/recursive-transform.c
@@ -39,6 +39,11 @@ property_color (fade_color, _("Fade color"), "transparent")
     description  (_("Color to fade transformed images towards, "
                     "with a rate depending on its alpha"))
 
+property_double  (fade_opacity, _("Fade opacity"), 1.0)
+    description  (_("Amount by which to scale the opacity of "
+                    "each transformed image"))
+    value_range  (0.0, 1.0)
+
 property_boolean (paste_below, _("Paste below"), FALSE)
     description  (_("Paste transformed images below each other"))
 
@@ -59,6 +64,7 @@ typedef struct
 {
   GeglNode *transform_node;
   GeglNode *color_overlay_node;
+  GeglNode *opacity_node;
   GeglNode *over_node;
 } Iteration;
 
@@ -148,6 +154,16 @@ update_graph (GeglOperation *operation)
           source_node = iters[i].color_overlay_node;
         }
 
+      if (n > 0 && fabs (o->fade_opacity - 1.0) > EPSILON)
+        {
+          gegl_node_set (iters[i].opacity_node,
+                         "value", pow (o->fade_opacity, n),
+                         NULL);
+
+          gegl_node_link (source_node, iters[i].opacity_node);
+          source_node = iters[i].opacity_node;
+        }
+
       gegl_node_connect_to (source_node,        "output",
                             iters[i].over_node, ! o->paste_below ? "input" :
                                                                    "aux");
@@ -188,6 +204,11 @@ attach (GeglOperation *operation)
                              "operation", "gegl:color-overlay",
                              NULL);
 
+      iters[i].opacity_node =
+        gegl_node_new_child (node,
+                             "operation", "gegl:opacity",
+                             NULL);
+
       iters[i].over_node =
         gegl_node_new_child (node,
                              "operation", "gegl:over",


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