Commit c0b24ce9 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

app/channel.[ch] app/commands.c app/gimage_mask.[ch]

1999-05-07  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/channel.[ch]
	* app/commands.c
	* app/gimage_mask.[ch]
	* app/gimage_mask_cmds.c
	* tools/pdbgen/pdb/gimage_mask.pdb
	* app/interface.c: propagated the indepentent x/y values for
	shrink/grow/border to the interface but not yet to the PDB.

	* app/*_select.c
	* app/paint_funcs.[ch]: implemented indep. x/y feather. It seems
	that cut-and-paste was sufficient, but I didn't really understand
	the code. Jay, could you have a look at this please?

	If the feather/shrink/... amount is specified in pixels,
	everything behaves like before.
	I'm not sure how the built-in feather option of the selection
	tools should behave, so it still defaults to 'pixel' mode.
	Moved the static feather/shrink/... values from gimage_mask.c to
	commands.c because they belong to the interface.

	* app/text_tool_cmds.c
	* tools/pdbgen/pdb/text_tool.pdb: prepared for resolution
	support, but didn't enable it yet.

	* app/unit_cmds.c
	* tool/pdbgen/pdb/unit.pdb: fixed a help text.
parent 4154970d
1999-05-07 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel.[ch]
* app/commands.c
* app/gimage_mask.[ch]
* app/gimage_mask_cmds.c
* tools/pdbgen/pdb/gimage_mask.pdb
* app/interface.c: propagated the indepentent x/y values for
shrink/grow/border to the interface but not yet to the PDB.
* app/*_select.c
* app/paint_funcs.[ch]: implemented indep. x/y feather. It seems
that cut-and-paste was sufficient, but I didn't really understand
the code. Jay, could you have a look at this please?
If the feather/shrink/... amount is specified in pixels,
everything behaves like before.
I'm not sure how the built-in feather option of the selection
tools should behave, so it still defaults to 'pixel' mode.
Moved the static feather/shrink/... values from gimage_mask.c to
commands.c because they belong to the interface.
* app/text_tool_cmds.c
* tools/pdbgen/pdb/text_tool.pdb: prepared for resolution
support, but didn't enable it yet.
* app/unit_cmds.c
* tool/pdbgen/pdb/unit.pdb: fixed a help text.
Thu May 6 22:51:33 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
* app/plug_in.c (plug_in_init_shm): Added this new function.
......@@ -169,7 +198,6 @@ Mon May 3 15:34:37 PDT 1999 Manish Singh <yosh@gimp.org>
* tools/pdbgen/pdb/plug_in.pdb: progress_init takes an int32, not
a display...
>>>>>>> 1.1075
Mon May 3 14:03:35 PDT 1999 Manish Singh <yosh@gimp.org>
* app/gimage_cmds.c
......
......@@ -89,15 +89,11 @@ static void gimage_mask_border_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_shrink_callback (GtkWidget *, gpointer, gpointer);
/* variables declared in gimage_mask.c--we need them to set up
* initial values for the various dialog boxes which query for values
*/
extern double gimage_mask_feather_radius;
extern int gimage_mask_border_radius;
extern int gimage_mask_grow_pixels;
extern int gimage_mask_shrink_pixels;
/* local variables */
static double selection_feather_radius = 5.0;
static int selection_border_radius = 5;
static int selection_grow_pixels = 1;
static int selection_shrink_pixels = 1;
void
......@@ -367,11 +363,11 @@ select_border_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Border Selection"),
_("Border selection by:"),
gimage_mask_border_radius, 1, 32767, 0,
query_size_box (_("Border Selection"), _("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
}
......@@ -384,11 +380,11 @@ select_feather_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Feather Selection"),
_("Feather selection by:"),
gimage_mask_feather_radius, 0, 32767, 3,
query_size_box (_("Feather Selection"), _("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
}
......@@ -401,11 +397,11 @@ select_grow_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Grow Selection"),
_("Grow selection by:"),
gimage_mask_grow_pixels, 1, 32767, 0,
query_size_box (_("Grow Selection"), _("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
}
......@@ -418,11 +414,11 @@ select_shrink_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Shrink Selection"),
_("Shrink selection by:"),
gimage_mask_shrink_pixels, 1, 32767, 0,
query_size_box (_("Shrink Selection"), _("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
}
......@@ -1211,9 +1207,30 @@ gimage_mask_feather_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
GUnit unit;
double radius_x;
double radius_y;
gimage_mask_feather (gimage, *(float*)call_data);
selection_feather_radius = *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_feather_radius;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_feather (gimage, radius_x, radius_y);
gdisplays_flush ();
}
......@@ -1224,9 +1241,30 @@ gimage_mask_border_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
gimage_mask_border (gimage, (int)*(float*)call_data);
GUnit unit;
double radius_x;
double radius_y;
selection_border_radius = (int) *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_feather_radius;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_border (gimage, radius_x, radius_y);
gdisplays_flush ();
}
......@@ -1237,9 +1275,30 @@ gimage_mask_grow_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
GUnit unit;
double radius_x;
double radius_y;
gimage_mask_grow (gimage, (int)*(float*)call_data);
selection_grow_pixels = (int) *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_grow_pixels;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_grow (gimage, radius_x, radius_y);
gdisplays_flush ();
}
......@@ -1250,8 +1309,29 @@ gimage_mask_shrink_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
GUnit unit;
int radius_x;
int radius_y;
gimage_mask_shrink (gimage, (int)*(float*)call_data);
selection_shrink_pixels = (int) *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_shrink_pixels;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_shrink (gimage, radius_x, radius_y, FALSE);
gdisplays_flush ();
}
......@@ -1799,7 +1799,9 @@ bezier_to_sel_internal(BezierSelect *bezier_sel,
if (bezier_options->feather)
channel_feather (bezier_sel->mask,
gimage_get_mask (gdisp->gimage),
bezier_options->feather_radius, op, 0, 0);
bezier_options->feather_radius,
bezier_options->feather_radius,
op, 0, 0);
else
channel_combine_mask (gimage_get_mask (gdisp->gimage),
bezier_sel->mask, op, 0, 0);
......
......@@ -274,7 +274,9 @@ by_color_select (GImage *gimage,
if (feather)
channel_feather (new_mask, gimage_get_mask (gimage),
feather_radius, op, off_x, off_y);
feather_radius,
feather_radius,
op, off_x, off_y);
else
channel_combine_mask (gimage_get_mask (gimage),
new_mask, op, off_x, off_y);
......
......@@ -1131,8 +1131,13 @@ channel_combine_mask (Channel *mask, Channel *add_on, int op,
void
channel_feather (Channel *input, Channel *output, double radius,
int op, int off_x, int off_y)
channel_feather (Channel *input,
Channel *output,
double radius_x,
double radius_y,
int op,
int off_x,
int off_y)
{
int x1, y1, x2, y2;
PixelRegion srcPR;
......@@ -1143,7 +1148,7 @@ channel_feather (Channel *input, Channel *output, double radius,
y2 = BOUNDS (off_y + GIMP_DRAWABLE(input)->height, 0, GIMP_DRAWABLE(output)->height);
pixel_region_init (&srcPR, GIMP_DRAWABLE(input)->tiles, (x1 - off_x), (y1 - off_y), (x2 - x1), (y2 - y1), FALSE);
gaussian_blur_region (&srcPR, radius);
gaussian_blur_region (&srcPR, radius_x, radius_y);
if (input != output)
channel_combine_mask(output, input, op, 0, 0);
......@@ -1276,75 +1281,89 @@ channel_all (Channel *mask)
void
channel_border (Channel *mask, int radius)
channel_border (Channel *mask,
int radius_x,
int radius_y)
{
PixelRegion bPR;
int x1, y1, x2, y2;
if (radius < 0)
if (radius_x < 0 || radius_y < 0)
return;
if (! channel_bounds (mask, &x1, &y1, &x2, &y2))
return;
if (x1 - radius < 0)
if (channel_is_empty (mask))
return;
if (x1 - radius_x < 0)
x1 = 0;
else
x1 -= radius;
if (x2 + radius > GIMP_DRAWABLE(mask)->width)
x1 -= radius_x;
if (x2 + radius_x > GIMP_DRAWABLE(mask)->width)
x2 = GIMP_DRAWABLE(mask)->width;
else
x2 += radius;
x2 += radius_x;
if (y1 - radius < 0)
if (y1 - radius_y < 0)
y1 = 0;
else
y1 -= radius;
if (y2 + radius > GIMP_DRAWABLE(mask)->height)
y1 -= radius_y;
if (y2 + radius_y > GIMP_DRAWABLE(mask)->height)
y2 = GIMP_DRAWABLE(mask)->height;
else
y2 += radius;
y2 += radius_y;
/* push the current channel onto the undo stack */
channel_push_undo (mask);
pixel_region_init (&bPR, GIMP_DRAWABLE(mask)->tiles, x1, y1,
(x2-x1), (y2-y1), TRUE);
border_region(&bPR, radius, radius);
border_region(&bPR, radius_x, radius_y);
mask->bounds_known = FALSE;
}
void
channel_grow (Channel *mask, int radius)
channel_grow (Channel *mask,
int radius_x,
int radius_y)
{
PixelRegion bPR;
int x1, y1, x2, y2;
if (radius < 0)
{
channel_shrink(mask, -radius);
if (radius_x == 0 && radius_y == 0)
return;
}
if (radius_x <= 0 && radius_y <= 0)
{
channel_shrink(mask, -radius_x, -radius_y, FALSE);
return;
}
if (radius_x < 0 || radius_y < 0)
return;
if (! channel_bounds (mask, &x1, &y1, &x2, &y2))
return;
if (channel_is_empty (mask))
return;
if (x1 - radius > 0)
x1 = x1 - radius;
if (x1 - radius_x > 0)
x1 = x1 - radius_x;
else
x1 = 0;
if (y1 - radius > 0)
y1 = y1 - radius;
if (y1 - radius_y > 0)
y1 = y1 - radius_y;
else
y1 = 0;
if (x2 + radius< GIMP_DRAWABLE(mask)->width)
x2 = x2 + radius;
if (x2 + radius_x < GIMP_DRAWABLE(mask)->width)
x2 = x2 + radius_x;
else
x2 = GIMP_DRAWABLE(mask)->width;
if (y2 + radius< GIMP_DRAWABLE(mask)->height)
y2 = y2 + radius;
if (y2 + radius_y < GIMP_DRAWABLE(mask)->height)
y2 = y2 + radius_y;
else
y2 = GIMP_DRAWABLE(mask)->height;
......@@ -1355,31 +1374,38 @@ channel_grow (Channel *mask, int radius)
pixel_region_init (&bPR, GIMP_DRAWABLE(mask)->tiles, x1, y1, (x2 - x1),
(y2 - y1), TRUE);
fatten_region(&bPR, radius, radius);
fatten_region (&bPR, radius_x, radius_y);
mask->bounds_known = FALSE;
}
void
channel_shrink (Channel *mask, int radius)
channel_shrink (Channel *mask,
int radius_x,
int radius_y,
int edge_lock)
{
PixelRegion bPR;
int x1, y1, x2, y2;
if (radius < 0)
{
channel_shrink(mask, -radius);
if (radius_x == 0 && radius_y == 0)
return;
}
if (radius_x <= 0 && radius_y <= 0)
{
channel_grow (mask, -radius_x, -radius_y);
return;
}
if (radius_x < 0 || radius_y < 0)
return;
if (! channel_bounds (mask, &x1, &y1, &x2, &y2))
return;
if (channel_is_empty (mask))
return;
/* push the current channel onto the undo stack */
channel_push_undo (mask);
if (x1 > 0)
x1--;
if (y1 > 0)
......@@ -1388,11 +1414,14 @@ channel_shrink (Channel *mask, int radius)
x2++;
if (y2 < GIMP_DRAWABLE(mask)->height)
y2++;
/* push the current channel onto the undo stack */
channel_push_undo (mask);
pixel_region_init (&bPR, GIMP_DRAWABLE(mask)->tiles, x1, y1, (x2 - x1),
(y2 - y1), TRUE);
thin_region (&bPR, radius, radius, 0);
thin_region (&bPR, radius_x, radius_y, edge_lock);
mask->bounds_known = FALSE;
}
......
......@@ -115,15 +115,26 @@ void channel_inter_segment (Channel *, int, int, int, int);
void channel_combine_rect (Channel *, int, int, int, int, int);
void channel_combine_ellipse (Channel *, int, int, int, int, int, int);
void channel_combine_mask (Channel *, Channel *, int, int, int);
void channel_feather (Channel *, Channel *, double, int, int, int);
void channel_feather (Channel *, Channel *,
double, double,
int, int, int);
void channel_push_undo (Channel *);
void channel_clear (Channel *);
void channel_invert (Channel *);
void channel_sharpen (Channel *);
void channel_all (Channel *);
void channel_border (Channel *, int);
void channel_grow (Channel *, int);
void channel_shrink (Channel *, int);
void channel_border (Channel * channel,
int radius_x,
int radius_y);
void channel_grow (Channel * channel,
int radius_x,
int radius_y);
void channel_shrink (Channel * channel,
int radius_x,
int radius_y,
int edge_lock);
void channel_translate (Channel *, int, int);
void channel_load (Channel *, Channel *);
void channel_invalidate_bounds (Channel *);
......
......@@ -89,15 +89,11 @@ static void gimage_mask_border_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_grow_callback (GtkWidget *, gpointer, gpointer);
static void gimage_mask_shrink_callback (GtkWidget *, gpointer, gpointer);
/* variables declared in gimage_mask.c--we need them to set up
* initial values for the various dialog boxes which query for values
*/
extern double gimage_mask_feather_radius;
extern int gimage_mask_border_radius;
extern int gimage_mask_grow_pixels;
extern int gimage_mask_shrink_pixels;
/* local variables */
static double selection_feather_radius = 5.0;
static int selection_border_radius = 5;
static int selection_grow_pixels = 1;
static int selection_shrink_pixels = 1;
void
......@@ -367,11 +363,11 @@ select_border_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Border Selection"),
_("Border selection by:"),
gimage_mask_border_radius, 1, 32767, 0,
query_size_box (_("Border Selection"), _("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
}
......@@ -384,11 +380,11 @@ select_feather_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Feather Selection"),
_("Feather selection by:"),
gimage_mask_feather_radius, 0, 32767, 3,
query_size_box (_("Feather Selection"), _("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
}
......@@ -401,11 +397,11 @@ select_grow_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Grow Selection"),
_("Grow selection by:"),
gimage_mask_grow_pixels, 1, 32767, 0,
query_size_box (_("Grow Selection"), _("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
}
......@@ -418,11 +414,11 @@ select_shrink_cmd_callback (GtkWidget *widget,
gdisp = gdisplay_active ();
query_size_box (_("Shrink Selection"),
_("Shrink selection by:"),
gimage_mask_shrink_pixels, 1, 32767, 0,
query_size_box (_("Shrink Selection"), _("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
MIN(gdisp->gimage->xresolution, gdisp->gimage->yresolution),
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
}
......@@ -1211,9 +1207,30 @@ gimage_mask_feather_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
GUnit unit;
double radius_x;
double radius_y;
gimage_mask_feather (gimage, *(float*)call_data);
selection_feather_radius = *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_feather_radius;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_feather (gimage, radius_x, radius_y);
gdisplays_flush ();
}
......@@ -1224,9 +1241,30 @@ gimage_mask_border_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
gimage_mask_border (gimage, (int)*(float*)call_data);
GUnit unit;
double radius_x;
double radius_y;
selection_border_radius = (int) *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_feather_radius;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_border (gimage, radius_x, radius_y);
gdisplays_flush ();
}
......@@ -1237,9 +1275,30 @@ gimage_mask_grow_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
GUnit unit;
double radius_x;
double radius_y;
gimage_mask_grow (gimage, (int)*(float*)call_data);
selection_grow_pixels = (int) *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_grow_pixels;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor;
}
gimage_mask_grow (gimage, radius_x, radius_y);
gdisplays_flush ();
}
......@@ -1250,8 +1309,29 @@ gimage_mask_shrink_callback (GtkWidget *w,
gpointer call_data)
{
GImage *gimage = GIMP_IMAGE (client_data);
GUnit unit;
int radius_x;
int radius_y;
gimage_mask_shrink (gimage, (int)*(float*)call_data);
selection_shrink_pixels = (int) *(float*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
radius_x = radius_y = selection_shrink_pixels;
if (unit != UNIT_PIXEL)
{
double factor;
factor = (MAX (gimage->xresolution, gimage->yresolution) /
MIN (gimage->xresolution, gimage->yresolution));
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
radius_y *= factor;
else
radius_x *= factor