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.
This commit is contained in:
Michael Natterer
2012-03-15 21:03:58 +01:00
parent 43b39c432c
commit 4455e29303

View File

@ -1254,21 +1254,29 @@ gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_y, gdouble radius_y,
gboolean push_undo) gboolean push_undo)
{ {
PixelRegion srcPR; GimpDrawable *drawable = GIMP_DRAWABLE (channel);
GeglNode *node;
if (push_undo) if (push_undo)
gimp_channel_push_undo (channel, gimp_channel_push_undo (channel,
GIMP_CHANNEL_GET_CLASS (channel)->feather_desc); GIMP_CHANNEL_GET_CLASS (channel)->feather_desc);
else else
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel)); gimp_drawable_invalidate_boundary (drawable);
pixel_region_init (&srcPR, /* 3.5 is completely magic and picked to visually match the old
gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)), * gaussian_blur_region() on a crappy laptop display
0, 0, */
gimp_item_get_width (GIMP_ITEM (channel)), node = gegl_node_new_child (NULL,
gimp_item_get_height (GIMP_ITEM (channel)), "operation", "gegl:gaussian-blur",
TRUE); "std-dev-x", radius_x / 3.5,
gaussian_blur_region (&srcPR, radius_x, radius_y); "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; channel->bounds_known = FALSE;