mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
Applied slightly modified patch from saulgoode which allows to border a
2006-06-05 Michael Natterer <mitch@gimp.org> Applied slightly modified patch from saulgoode which allows to border a selection without feathering. Fixes bug #88633. * app/paint-funcs/paint-funcs.[ch] (border_region): added boolean "feather_border" parameter. * app/core/gimpchannel.[ch]: GimpChannel::border(): ditto. * app/core/gimpselection.c: changed accordingly. * app/actions/select-commands.c: added a toggle to the border dialog and pass it to gimp_channel_border(). * tools/pdbgen/pdb/selection.pdb: pass TRUE here. * app/pdb/selection_cmds.c: regenerated.
This commit is contained in:
parent
d2911f6aee
commit
b37478550d
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2006-06-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Applied slightly modified patch from saulgoode which allows to
|
||||
border a selection without feathering. Fixes bug #88633.
|
||||
|
||||
* app/paint-funcs/paint-funcs.[ch] (border_region): added boolean
|
||||
"feather_border" parameter.
|
||||
|
||||
* app/core/gimpchannel.[ch]: GimpChannel::border(): ditto.
|
||||
|
||||
* app/core/gimpselection.c: changed accordingly.
|
||||
|
||||
* app/actions/select-commands.c: added a toggle to the border
|
||||
dialog and pass it to gimp_channel_border().
|
||||
|
||||
* tools/pdbgen/pdb/selection.pdb: pass TRUE here.
|
||||
|
||||
* app/pdb/selection_cmds.c: regenerated.
|
||||
|
||||
2006-06-05 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/tools-enums.[ch]: removed enum GimpRectangleMode.
|
||||
|
|
|
@ -74,6 +74,7 @@ static gint select_border_radius = 5;
|
|||
static gint select_grow_pixels = 1;
|
||||
static gint select_shrink_pixels = 1;
|
||||
static gboolean select_shrink_edge_lock = FALSE;
|
||||
static gboolean select_border_feather = FALSE;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -181,7 +182,7 @@ select_shrink_cmd_callback (GtkAction *action,
|
|||
G_OBJECT (display->image), "disconnect",
|
||||
select_shrink_callback, display->image);
|
||||
|
||||
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
|
||||
edge_lock = gtk_check_button_new_with_mnemonic (_("_Shrink from image border"));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), edge_lock,
|
||||
FALSE, FALSE, 0);
|
||||
|
@ -223,6 +224,7 @@ select_border_cmd_callback (GtkAction *action,
|
|||
{
|
||||
GimpDisplay *display;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *feather_border;
|
||||
return_if_no_display (display, data);
|
||||
|
||||
dialog = gimp_query_size_box (_("Border Selection"),
|
||||
|
@ -237,6 +239,17 @@ select_border_cmd_callback (GtkAction *action,
|
|||
FALSE,
|
||||
G_OBJECT (display->image), "disconnect",
|
||||
select_border_callback, display->image);
|
||||
|
||||
feather_border = gtk_check_button_new_with_mnemonic (_("_Feather border"));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), feather_border,
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "border_feather_toggle", feather_border);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (feather_border),
|
||||
select_border_feather);
|
||||
gtk_widget_show (feather_border);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
|
@ -367,6 +380,10 @@ select_border_callback (GtkWidget *widget,
|
|||
|
||||
radius_x = radius_y = select_border_radius;
|
||||
|
||||
select_border_feather =
|
||||
GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (widget),
|
||||
"border_feather_toggle"))->active;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
@ -380,7 +397,8 @@ select_border_callback (GtkWidget *widget,
|
|||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimp_channel_border (gimp_image_get_mask (image), radius_x, radius_y, TRUE);
|
||||
gimp_channel_border (gimp_image_get_mask (image), radius_x, radius_y,
|
||||
select_border_feather, TRUE);
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
|
|
@ -193,6 +193,7 @@ static void gimp_channel_real_invert (GimpChannel *channel,
|
|||
static void gimp_channel_real_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo);
|
||||
static void gimp_channel_real_grow (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
|
@ -1284,6 +1285,7 @@ static void
|
|||
gimp_channel_real_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo)
|
||||
{
|
||||
PixelRegion bPR;
|
||||
|
@ -1327,7 +1329,7 @@ gimp_channel_real_border (GimpChannel *channel,
|
|||
pixel_region_init (&bPR, GIMP_DRAWABLE (channel)->tiles,
|
||||
x1, y1, x2 - x1, y2 - y1, TRUE);
|
||||
|
||||
border_region (&bPR, radius_x, radius_y);
|
||||
border_region (&bPR, radius_x, radius_y, feather_border);
|
||||
|
||||
channel->bounds_known = FALSE;
|
||||
|
||||
|
@ -1822,6 +1824,7 @@ void
|
|||
gimp_channel_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CHANNEL (channel));
|
||||
|
@ -1830,7 +1833,7 @@ gimp_channel_border (GimpChannel *channel,
|
|||
push_undo = FALSE;
|
||||
|
||||
GIMP_CHANNEL_GET_CLASS (channel)->border (channel, radius_x, radius_y,
|
||||
push_undo);
|
||||
feather_border, push_undo);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -92,6 +92,7 @@ struct _GimpChannelClass
|
|||
void (* border) (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo);
|
||||
void (* grow) (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
|
@ -192,6 +193,7 @@ void gimp_channel_invert (GimpChannel *mask,
|
|||
void gimp_channel_border (GimpChannel *mask,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo);
|
||||
void gimp_channel_grow (GimpChannel *mask,
|
||||
gint radius_x,
|
||||
|
|
|
@ -108,6 +108,7 @@ static void gimp_selection_invert (GimpChannel *channel,
|
|||
static void gimp_selection_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo);
|
||||
static void gimp_selection_grow (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
|
@ -459,10 +460,11 @@ static void
|
|||
gimp_selection_border (GimpChannel *channel,
|
||||
gint radius_x,
|
||||
gint radius_y,
|
||||
gboolean feather_border,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GIMP_CHANNEL_CLASS (parent_class)->border (channel, radius_x, radius_y,
|
||||
push_undo);
|
||||
feather_border, push_undo);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -3669,7 +3669,8 @@ compute_transition (guchar *transition,
|
|||
void
|
||||
border_region (PixelRegion *src,
|
||||
gint16 xradius,
|
||||
gint16 yradius)
|
||||
gint16 yradius,
|
||||
gboolean feather_border)
|
||||
{
|
||||
/*
|
||||
This function has no bugs, but if you imagine some you can
|
||||
|
@ -3797,9 +3798,16 @@ border_region (PixelRegion *src,
|
|||
(tmpx * tmpx) / (xradius * xradius));
|
||||
|
||||
if (dist < 1.0)
|
||||
a = 255 * (1.0 - sqrt (dist));
|
||||
{
|
||||
if (feather_border)
|
||||
a = 255 * (1.0 - sqrt (dist));
|
||||
else
|
||||
a = 255;
|
||||
}
|
||||
else
|
||||
a = 0;
|
||||
{
|
||||
a = 0;
|
||||
}
|
||||
|
||||
density[ x][ y] = a;
|
||||
density[ x][-y] = a;
|
||||
|
|
|
@ -381,7 +381,8 @@ void gaussian_blur_region (PixelRegion *srcR,
|
|||
|
||||
void border_region (PixelRegion *src,
|
||||
gint16 xradius,
|
||||
gint16 yradius);
|
||||
gint16 yradius,
|
||||
gboolean feather_border);
|
||||
|
||||
void subsample_region (PixelRegion *srcPR,
|
||||
PixelRegion *destPR,
|
||||
|
|
|
@ -319,8 +319,9 @@ selection_border_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
/* FIXME: "feather" hardcoded to TRUE */
|
||||
gimp_channel_border (gimp_image_get_mask (image),
|
||||
radius, radius, TRUE);
|
||||
radius, radius, TRUE, TRUE);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success);
|
||||
|
|
|
@ -346,8 +346,9 @@ HELP
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
/* FIXME: "feather" hardcoded to TRUE */
|
||||
gimp_channel_border (gimp_image_get_mask (image),
|
||||
radius, radius, TRUE);
|
||||
radius, radius, TRUE, TRUE);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue