[gimp/blend-tool-fun: 8/9] app: Use gimp:blend in gimp_drawable_blend



commit 6baa4a70976f8ab521f3770c588ecd8d6a2c3722
Author: Michael Henning <drawoc darkrefraction com>
Date:   Mon May 11 22:51:32 2015 -0400

    app: Use gimp:blend in gimp_drawable_blend

 app/core/gimpdrawable-blend.c            |   51 ++++++++++++++++++++++++-----
 app/operations/gimpoperationshapeburst.c |    4 +-
 2 files changed, 44 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index a59ea1f..320f79d 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -193,19 +193,52 @@ gimp_drawable_blend (GimpDrawable         *drawable,
   gimp_set_busy (image->gimp);
 
   /*  Always create an alpha temp buf (for generality) */
-  buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
+  buffer = gegl_buffer_new (GEGL_RECTANGLE (x, y, width, height),
                             gimp_drawable_get_format_with_alpha (drawable));
 
-  gradient_fill_region (image, drawable, context,
-                        buffer, GEGL_RECTANGLE (0, 0, width, height),
-                        gradient, gradient_type, offset, repeat, reverse,
-                        supersample, max_depth, threshold, dither,
-                        (startx - x), (starty - y),
-                        (endx - x), (endy - y),
-                        progress);
+  {
+    GeglBuffer  *shapeburst = NULL;
+    GeglNode    *render;
+
+    if (gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR &&
+        gradient_type <= GIMP_GRADIENT_SHAPEBURST_DIMPLED)
+      {
+        shapeburst = gimp_drawable_blend_shapeburst_distmap (drawable, TRUE,
+                                                             GEGL_RECTANGLE (x, y, width, height),
+                                                             progress);
+      }
+
+    render = gegl_node_new_child (NULL,
+                                  "operation",             "gimp:blend",
+                                  "context",               context,
+                                  "gradient",              gradient,
+                                  "start-x",               startx,
+                                  "start-y",               starty,
+                                  "end-x",                 endx,
+                                  "end-y",                 endy,
+                                  "gradient-type",         gradient_type,
+                                  "gradient-repeat",       repeat,
+                                  "offset",                offset,
+                                  "gradient-reverse",      reverse,
+                                  "supersample",           supersample,
+                                  "supersample-depth",     max_depth,
+                                  "supersample-threshold", threshold,
+                                  "dither",                dither,
+                                  NULL);
+
+    gimp_gegl_apply_operation (shapeburst, progress, NULL,
+                               render,
+                               buffer, GEGL_RECTANGLE (x, y, width, height));
+
+    g_object_unref (render);
+
+    if (shapeburst)
+      g_object_unref (shapeburst);
+  }
+
 
   gimp_drawable_apply_buffer (drawable, buffer,
-                              GEGL_RECTANGLE (0, 0, width, height),
+                              GEGL_RECTANGLE (x, y, width, height),
                               TRUE, C_("undo-type", "Blend"),
                               opacity, paint_mode,
                               NULL, x, y);
diff --git a/app/operations/gimpoperationshapeburst.c b/app/operations/gimpoperationshapeburst.c
index af4714c..d074771 100644
--- a/app/operations/gimpoperationshapeburst.c
+++ b/app/operations/gimpoperationshapeburst.c
@@ -263,8 +263,8 @@ gimp_operation_shapeburst_process (GeglOperation       *operation,
                   /* FIXME: this should be much faster, it converts to
                    * 32 bit rgba intermediately, bah...
                    */
-                  gegl_buffer_sample (input, x1, y1, NULL, &src,
-                                      input_format,
+                  gegl_buffer_sample (input, x1 + roi->x, y1 + roi->y,
+                                      NULL, &src, input_format,
                                       GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
 
                   if (src < EPSILON)


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