[gimp/goat-invasion: 55/608] app: implement gimp_channel_real_feather() with gegl:gaussian-blur



commit fafb5716aa67e7c2b3664679bd12ad0522f8c3f2
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 15 21:03:58 2012 +0100

    app: implement gimp_channel_real_feather() with gegl:gaussian-blur
    
    It's not 100% the same but very close, everybody is invited to improve
    the magic number in gimp_channel_real_feather() to truly match the old
    behavior.

 app/core/gimpchannel.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index c738249..530f50f 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1254,21 +1254,29 @@ gimp_channel_real_feather (GimpChannel *channel,
                            gdouble      radius_y,
                            gboolean     push_undo)
 {
-  PixelRegion srcPR;
+  GimpDrawable *drawable = GIMP_DRAWABLE (channel);
+  GeglNode     *node;
 
   if (push_undo)
     gimp_channel_push_undo (channel,
                             GIMP_CHANNEL_GET_CLASS (channel)->feather_desc);
   else
-    gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
+    gimp_drawable_invalidate_boundary (drawable);
 
-  pixel_region_init (&srcPR,
-                     gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
-                     0, 0,
-                     gimp_item_get_width  (GIMP_ITEM (channel)),
-                     gimp_item_get_height (GIMP_ITEM (channel)),
-                     TRUE);
-  gaussian_blur_region (&srcPR, radius_x, radius_y);
+  /* 3.5 is completely magic and picked to visually match the old
+   * gaussian_blur_region() on a crappy laptop display
+   */
+  node = gegl_node_new_child (NULL,
+                              "operation", "gegl:gaussian-blur",
+                              "std-dev-x", radius_x / 3.5,
+                              "std-dev-y", radius_y / 3.5,
+                              NULL);
+
+  gimp_drawable_apply_operation_to_buffer (drawable, NULL, NULL,
+                                           node, TRUE,
+                                           gimp_drawable_get_write_buffer (drawable));
+
+  g_object_unref (node);
 
   channel->bounds_known = FALSE;
 



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