[gimp] app: add gimp_gegl_apply_feather()



commit 586bb7329314802256f77fc77609ac9930a1bbc2
Author: Michael Natterer <mitch gimp org>
Date:   Mon Apr 8 14:16:33 2013 +0200

    app: add gimp_gegl_apply_feather()
    
    and use it in gimp_channel_real_feather() so the magic factor of 3.5
    to turn feather radius into gegl:gaussian-blur's std_dev is hidden
    behind an API.

 app/core/gimpchannel.c               |   13 +++++--------
 app/gegl/gimp-gegl-apply-operation.c |   22 ++++++++++++++++++++++
 app/gegl/gimp-gegl-apply-operation.h |    7 +++++++
 3 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 7a24411..be06804 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1270,14 +1270,11 @@ gimp_channel_real_feather (GimpChannel *channel,
   else
     gimp_drawable_invalidate_boundary (drawable);
 
-  /* 3.5 is completely magic and picked to visually match the old
-   * gaussian_blur_region() on a crappy laptop display
-   */
-  gimp_gegl_apply_gaussian_blur (gimp_drawable_get_buffer (drawable),
-                                 NULL, NULL,
-                                 gimp_drawable_get_buffer (drawable),
-                                 radius_x / 3.5,
-                                 radius_y / 3.5);
+  gimp_gegl_apply_feather (gimp_drawable_get_buffer (drawable),
+                           NULL, NULL,
+                           gimp_drawable_get_buffer (drawable),
+                           radius_x,
+                           radius_y);
 
   channel->bounds_known = FALSE;
 
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index cd443a9..3f18b89 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -164,6 +164,28 @@ gimp_gegl_apply_flatten (GeglBuffer    *src_buffer,
 }
 
 void
+gimp_gegl_apply_feather (GeglBuffer   *src_buffer,
+                         GimpProgress *progress,
+                         const gchar  *undo_desc,
+                         GeglBuffer   *dest_buffer,
+                         gdouble       radius_x,
+                         gdouble       radius_y)
+{
+  g_return_if_fail (GEGL_IS_BUFFER (src_buffer));
+  g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
+  g_return_if_fail (GEGL_IS_BUFFER (dest_buffer));
+
+  /* 3.5 is completely magic and picked to visually match the old
+   * gaussian_blur_region() on a crappy laptop display
+   */
+  gimp_gegl_apply_gaussian_blur (src_buffer,
+                                 progress, undo_desc,
+                                 dest_buffer,
+                                 radius_x / 3.5,
+                                 radius_y / 3.5);
+}
+
+void
 gimp_gegl_apply_gaussian_blur (GeglBuffer   *src_buffer,
                                GimpProgress *progress,
                                const gchar  *undo_desc,
diff --git a/app/gegl/gimp-gegl-apply-operation.h b/app/gegl/gimp-gegl-apply-operation.h
index ac89974..11365d7 100644
--- a/app/gegl/gimp-gegl-apply-operation.h
+++ b/app/gegl/gimp-gegl-apply-operation.h
@@ -49,6 +49,13 @@ void   gimp_gegl_apply_flatten         (GeglBuffer            *src_buffer,
                                         GeglBuffer            *dest_buffer,
                                         const GimpRGB         *background);
 
+void   gimp_gegl_apply_feather         (GeglBuffer            *src_buffer,
+                                        GimpProgress          *progress,
+                                        const gchar           *undo_desc,
+                                        GeglBuffer            *dest_buffer,
+                                        gdouble                radius_x,
+                                        gdouble                radius_y);
+
 void   gimp_gegl_apply_gaussian_blur   (GeglBuffer            *src_buffer,
                                         GimpProgress          *progress,
                                         const gchar           *undo_desc,


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