tools/pdbgen/stddefs.pdb added wrapper for gimp-round-rect-select. Added

2006-10-20  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/stddefs.pdb
	* tools/pdbgen/pdb/selection_tools.pdb: added wrapper for
	gimp-round-rect-select. Added feather_radius_x and _y to
	gimp-by-color-select-full and gimp-fuzzy-select-full.

	* app/pdb/internal_procs.c
	* app/pdb/selection_tools_cmds.c
	* libgimp/gimpselectiontools_pdb.[ch]: regenerated.

	* libgimp/gimp.def: changed accordingly.
This commit is contained in:
Michael Natterer 2006-10-20 21:20:29 +00:00 committed by Michael Natterer
parent 905a0e46ca
commit 046fa38b75
8 changed files with 372 additions and 50 deletions

View File

@ -1,3 +1,16 @@
2006-10-20 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/stddefs.pdb
* tools/pdbgen/pdb/selection_tools.pdb: added wrapper for
gimp-round-rect-select. Added feather_radius_x and _y to
gimp-by-color-select-full and gimp-fuzzy-select-full.
* app/pdb/internal_procs.c
* app/pdb/selection_tools_cmds.c
* libgimp/gimpselectiontools_pdb.[ch]: regenerated.
* libgimp/gimp.def: changed accordingly.
2006-10-20 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/gimpui.defs: clone methods can't be marked as

View File

@ -75,7 +75,7 @@ void register_undo_procs (GimpPDB *pdb);
void register_unit_procs (GimpPDB *pdb);
void register_vectors_procs (GimpPDB *pdb);
/* 532 procedures registered total */
/* 533 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)

View File

@ -96,7 +96,8 @@ by_color_select_full_invoker (GimpProcedure *procedure,
gint32 operation;
gboolean antialias;
gboolean feather;
gdouble feather_radius;
gdouble feather_radius_x;
gdouble feather_radius_y;
gboolean sample_merged;
gboolean select_transparent;
gint32 select_criterion;
@ -107,10 +108,11 @@ by_color_select_full_invoker (GimpProcedure *procedure,
operation = g_value_get_enum (&args->values[3]);
antialias = g_value_get_boolean (&args->values[4]);
feather = g_value_get_boolean (&args->values[5]);
feather_radius = g_value_get_double (&args->values[6]);
sample_merged = g_value_get_boolean (&args->values[7]);
select_transparent = g_value_get_boolean (&args->values[8]);
select_criterion = g_value_get_enum (&args->values[9]);
feather_radius_x = g_value_get_double (&args->values[6]);
feather_radius_y = g_value_get_double (&args->values[7]);
sample_merged = g_value_get_boolean (&args->values[8]);
select_transparent = g_value_get_boolean (&args->values[9]);
select_criterion = g_value_get_enum (&args->values[10]);
if (success)
{
@ -125,8 +127,8 @@ by_color_select_full_invoker (GimpProcedure *procedure,
operation,
antialias,
feather,
feather_radius,
feather_radius);
feather_radius_x,
feather_radius_y);
}
return gimp_procedure_get_return_values (procedure, success);
@ -281,7 +283,8 @@ fuzzy_select_full_invoker (GimpProcedure *procedure,
gint32 operation;
gboolean antialias;
gboolean feather;
gdouble feather_radius;
gdouble feather_radius_x;
gdouble feather_radius_y;
gboolean sample_merged;
gboolean select_transparent;
gint32 select_criterion;
@ -293,10 +296,11 @@ fuzzy_select_full_invoker (GimpProcedure *procedure,
operation = g_value_get_enum (&args->values[4]);
antialias = g_value_get_boolean (&args->values[5]);
feather = g_value_get_boolean (&args->values[6]);
feather_radius = g_value_get_double (&args->values[7]);
sample_merged = g_value_get_boolean (&args->values[8]);
select_transparent = g_value_get_boolean (&args->values[9]);
select_criterion = g_value_get_enum (&args->values[10]);
feather_radius_x = g_value_get_double (&args->values[7]);
feather_radius_y = g_value_get_double (&args->values[8]);
sample_merged = g_value_get_boolean (&args->values[9]);
select_transparent = g_value_get_boolean (&args->values[10]);
select_criterion = g_value_get_enum (&args->values[11]);
if (success)
{
@ -312,8 +316,8 @@ fuzzy_select_full_invoker (GimpProcedure *procedure,
operation,
antialias,
feather,
feather_radius,
feather_radius);
feather_radius_x,
feather_radius_y);
}
return gimp_procedure_get_return_values (procedure, success);
@ -360,6 +364,58 @@ rect_select_invoker (GimpProcedure *procedure,
return gimp_procedure_get_return_values (procedure, success);
}
static GValueArray *
round_rect_select_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args)
{
gboolean success = TRUE;
GimpImage *image;
gdouble x;
gdouble y;
gdouble width;
gdouble height;
gdouble corner_radius_x;
gdouble corner_radius_y;
gint32 operation;
gboolean antialias;
gboolean feather;
gdouble feather_radius_x;
gdouble feather_radius_y;
image = gimp_value_get_image (&args->values[0], gimp);
x = g_value_get_double (&args->values[1]);
y = g_value_get_double (&args->values[2]);
width = g_value_get_double (&args->values[3]);
height = g_value_get_double (&args->values[4]);
corner_radius_x = g_value_get_double (&args->values[5]);
corner_radius_y = g_value_get_double (&args->values[6]);
operation = g_value_get_enum (&args->values[7]);
antialias = g_value_get_boolean (&args->values[8]);
feather = g_value_get_boolean (&args->values[9]);
feather_radius_x = g_value_get_double (&args->values[10]);
feather_radius_y = g_value_get_double (&args->values[11]);
if (success)
{
gimp_channel_select_round_rect (gimp_image_get_mask (image),
(gint) x, (gint) y,
(gint) width, (gint) height,
corner_radius_x,
corner_radius_y,
operation,
antialias,
feather,
feather_radius_x,
feather_radius_y,
TRUE);
}
return gimp_procedure_get_return_values (procedure, success);
}
void
register_selection_tools_procs (GimpPDB *pdb)
{
@ -483,9 +539,15 @@ register_selection_tools_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius",
"feather radius",
"Radius for feather operation",
g_param_spec_double ("feather-radius-x",
"feather radius x",
"Radius for feather operation in X direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius-y",
"feather radius y",
"Radius for feather operation in Y direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
@ -769,9 +831,15 @@ register_selection_tools_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius",
"feather radius",
"Radius for feather operation",
g_param_spec_double ("feather-radius-x",
"feather radius x",
"Radius for feather operation in X direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius-y",
"feather radius y",
"Radius for feather operation in Y direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
@ -860,4 +928,93 @@ register_selection_tools_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-round-rect-select
*/
procedure = gimp_procedure_new (round_rect_select_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-round-rect-select");
gimp_procedure_set_static_strings (procedure,
"gimp-round-rect-select",
"Create a rectangular selection with round corners over the specified image;",
"This tool creates a rectangular selection with round corners over the specified image. The rectangular region can be either added to, subtracted from, or replace the contents of the previous selection mask. If the feather option is enabled, the resulting selection is blurred before combining. The blur is a gaussian blur with the specified feather radius.",
"Martin Nordholts",
"Martin Nordholts",
"2006",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("x",
"x",
"x coordinate of upper-left corner of rectangle",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("y",
"y",
"y coordinate of upper-left corner of rectangle",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("width",
"width",
"The width of the rectangle",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("height",
"height",
"The height of the rectangle",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("corner-radius-x",
"corner radius x",
"The corner radius in X direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("corner-radius-y",
"corner radius y",
"The corner radius in Y direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("operation",
"operation",
"The selection operation",
GIMP_TYPE_CHANNEL_OPS,
GIMP_CHANNEL_OP_ADD,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("antialias",
"antialias",
"Antialiasing",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("feather",
"feather",
"Feather option for selections",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius-x",
"feather radius x",
"Radius for feather operation in X direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("feather-radius-y",
"feather radius y",
"Radius for feather operation in Y direction",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}

View File

@ -557,6 +557,7 @@ EXPORTS
gimp_rgn_iterator_src_dest
gimp_rotate
gimp_rotation_type_get_type
gimp_round_rect_select
gimp_run_procedure
gimp_run_procedure2
gimp_scale

View File

@ -96,7 +96,8 @@ gimp_by_color_select (gint32 drawable_ID,
* @operation: The selection operation.
* @antialias: Antialiasing.
* @feather: Feather option for selections.
* @feather_radius: Radius for feather operation.
* @feather_radius_x: Radius for feather operation in X direction.
* @feather_radius_y: Radius for feather operation in Y direction.
* @sample_merged: Use the composite image, not the drawable.
* @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
* @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
@ -130,7 +131,8 @@ gimp_by_color_select_full (gint32 drawable_ID,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean sample_merged,
gboolean select_transparent,
GimpSelectCriterion select_criterion)
@ -147,7 +149,8 @@ gimp_by_color_select_full (gint32 drawable_ID,
GIMP_PDB_INT32, operation,
GIMP_PDB_INT32, antialias,
GIMP_PDB_INT32, feather,
GIMP_PDB_FLOAT, feather_radius,
GIMP_PDB_FLOAT, feather_radius_x,
GIMP_PDB_FLOAT, feather_radius_y,
GIMP_PDB_INT32, sample_merged,
GIMP_PDB_INT32, select_transparent,
GIMP_PDB_INT32, select_criterion,
@ -358,7 +361,8 @@ gimp_fuzzy_select (gint32 drawable_ID,
* @operation: The selection operation.
* @antialias: Antialiasing.
* @feather: Feather option for selections.
* @feather_radius: Radius for feather operation.
* @feather_radius_x: Radius for feather operation in X direction.
* @feather_radius_y: Radius for feather operation in Y direction.
* @sample_merged: Use the composite image, not the drawable.
* @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
* @select_criterion: The criterion used to determine color similarity. SELECT_CRITERION_COMPOSITE is the standard choice.
@ -397,7 +401,8 @@ gimp_fuzzy_select_full (gint32 drawable_ID,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean sample_merged,
gboolean select_transparent,
GimpSelectCriterion select_criterion)
@ -415,7 +420,8 @@ gimp_fuzzy_select_full (gint32 drawable_ID,
GIMP_PDB_INT32, operation,
GIMP_PDB_INT32, antialias,
GIMP_PDB_INT32, feather,
GIMP_PDB_FLOAT, feather_radius,
GIMP_PDB_FLOAT, feather_radius_x,
GIMP_PDB_FLOAT, feather_radius_y,
GIMP_PDB_INT32, sample_merged,
GIMP_PDB_INT32, select_transparent,
GIMP_PDB_INT32, select_criterion,
@ -482,3 +488,73 @@ gimp_rect_select (gint32 image_ID,
return success;
}
/**
* gimp_round_rect_select:
* @image_ID: The image.
* @x: x coordinate of upper-left corner of rectangle.
* @y: y coordinate of upper-left corner of rectangle.
* @width: The width of the rectangle.
* @height: The height of the rectangle.
* @corner_radius_x: The corner radius in X direction.
* @corner_radius_y: The corner radius in Y direction.
* @operation: The selection operation.
* @antialias: Antialiasing.
* @feather: Feather option for selections.
* @feather_radius_x: Radius for feather operation in X direction.
* @feather_radius_y: Radius for feather operation in Y direction.
*
* Create a rectangular selection with round corners over the specified
* image;
*
* This tool creates a rectangular selection with round corners over
* the specified image. The rectangular region can be either added to,
* subtracted from, or replace the contents of the previous selection
* mask. If the feather option is enabled, the resulting selection is
* blurred before combining. The blur is a gaussian blur with the
* specified feather radius.
*
* Returns: TRUE on success.
*
* Since: GIMP 2.4
*/
gboolean
gimp_round_rect_select (gint32 image_ID,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
gdouble corner_radius_x,
gdouble corner_radius_y,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-round-rect-select",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_FLOAT, x,
GIMP_PDB_FLOAT, y,
GIMP_PDB_FLOAT, width,
GIMP_PDB_FLOAT, height,
GIMP_PDB_FLOAT, corner_radius_x,
GIMP_PDB_FLOAT, corner_radius_y,
GIMP_PDB_INT32, operation,
GIMP_PDB_INT32, antialias,
GIMP_PDB_INT32, feather,
GIMP_PDB_FLOAT, feather_radius_x,
GIMP_PDB_FLOAT, feather_radius_y,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}

View File

@ -43,7 +43,8 @@ gboolean gimp_by_color_select_full (gint32 drawable_ID,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean sample_merged,
gboolean select_transparent,
GimpSelectCriterion select_criterion);
@ -79,7 +80,8 @@ gboolean gimp_fuzzy_select_full (gint32 drawable_ID,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius,
gdouble feather_radius_x,
gdouble feather_radius_y,
gboolean sample_merged,
gboolean select_transparent,
GimpSelectCriterion select_criterion);
@ -91,6 +93,18 @@ gboolean gimp_rect_select (gint32 image_ID,
GimpChannelOps operation,
gboolean feather,
gdouble feather_radius);
gboolean gimp_round_rect_select (gint32 image_ID,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
gdouble corner_radius_x,
gdouble corner_radius_y,
GimpChannelOps operation,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
G_END_DECLS

View File

@ -116,8 +116,10 @@ HELP
desc => 'Antialiasing' },
{ name => 'feather', type => 'boolean',
desc => 'Feather option for selections' },
{ name => 'feather_radius', type => '0 <= float',
desc => 'Radius for feather operation' },
{ name => 'feather_radius_x', type => '0 <= float',
desc => 'Radius for feather operation in X direction' },
{ name => 'feather_radius_y', type => '0 <= float',
desc => 'Radius for feather operation in Y direction' },
{ name => 'sample_merged', type => 'boolean',
desc => 'Use the composite image, not the drawable' },
{ name => 'select_transparent', type => 'boolean',
@ -144,8 +146,8 @@ HELP
operation,
antialias,
feather,
feather_radius,
feather_radius);
feather_radius_x,
feather_radius_y);
}
CODE
);
@ -206,6 +208,7 @@ CODE
);
}
sub free_select {
$blurb = 'Create a polygonal selection over the specified image.';
@ -260,6 +263,7 @@ CODE
);
}
sub fuzzy_select {
$blurb = <<'BLURB';
Create a fuzzy selection starting at the specified coordinates on the specified
@ -332,10 +336,6 @@ CODE
}
sub fuzzy_select_full {
$blurb = <<'BLURB';
Create a fuzzy selection starting at the specified coordinates on the specified
@ -379,8 +379,10 @@ HELP
desc => 'Antialiasing' },
{ name => 'feather', type => 'boolean',
desc => 'Feather option for selections' },
{ name => 'feather_radius', type => '0 <= float',
desc => 'Radius for feather operation' },
{ name => 'feather_radius_x', type => '0 <= float',
desc => 'Radius for feather operation in X direction' },
{ name => 'feather_radius_y', type => '0 <= float',
desc => 'Radius for feather operation in Y direction' },
{ name => 'sample_merged', type => 'boolean',
desc => 'Use the composite image, not the drawable' },
{ name => 'select_transparent', type => 'boolean',
@ -408,21 +410,14 @@ HELP
operation,
antialias,
feather,
feather_radius,
feather_radius);
feather_radius_x,
feather_radius_y);
}
CODE
);
}
sub rect_select {
$blurb = 'Create a rectangular selection over the specified image;';
@ -472,12 +467,74 @@ CODE
}
sub round_rect_select {
$blurb = 'Create a rectangular selection with round corners over the specified image;';
$help = <<'HELP';
This tool creates a rectangular selection with round corners over the
specified image. The rectangular region can be either added to,
subtracted from, or replace the contents of the previous selection
mask. If the feather option is enabled, the resulting selection is
blurred before combining. The blur is a gaussian blur with the
specified feather radius.
HELP
&martin_pdb_misc("2006","2.4");
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
{ name => 'x', type => 'float',
desc => 'x coordinate of upper-left corner of rectangle' },
{ name => 'y', type => 'float',
desc => 'y coordinate of upper-left corner of rectangle' },
{ name => 'width', type => '0 < float',
desc => 'The width of the rectangle' },
{ name => 'height', type => '0 < float',
desc => 'The height of the rectangle' },
{ name => 'corner_radius_x', type => '0 < float < GIMP_MAX_IMAGE_SIZE',
desc => 'The corner radius in X direction' },
{ name => 'corner_radius_y', type => '0 < float < GIMP_MAX_IMAGE_SIZE',
desc => 'The corner radius in Y direction' },
{ name => 'operation', type => 'enum GimpChannelOps',
desc => 'The selection operation' },
{ name => 'antialias', type => 'boolean',
desc => 'Antialiasing' },
{ name => 'feather', type => 'boolean',
desc => 'Feather option for selections' },
{ name => 'feather_radius_x', type => '0 <= float',
desc => 'Radius for feather operation in X direction' },
{ name => 'feather_radius_y', type => '0 <= float',
desc => 'Radius for feather operation in Y direction' }
);
%invoke = (
code => <<'CODE'
{
gimp_channel_select_round_rect (gimp_image_get_mask (image),
(gint) x, (gint) y,
(gint) width, (gint) height,
corner_radius_x,
corner_radius_y,
operation,
antialias,
feather,
feather_radius_x,
feather_radius_y,
TRUE);
}
CODE
);
}
@headers = qw("core/gimpchannel-select.h" "gimp-intl.h");
@procs = qw(by_color_select by_color_select_full
ellipse_select free_select
ellipse_select
free_select
fuzzy_select fuzzy_select_full
rect_select);
rect_select round_rect_select);
%exports = (app => [@procs], lib => [@procs]);

View File

@ -94,6 +94,10 @@ sub marc_pdb_misc {
contrib_pdb_misc('Marc Lehmann', '', @_);
}
sub martin_pdb_misc {
contrib_pdb_misc('Martin Nordholts', '', @_);
}
sub mitch_pdb_misc {
contrib_pdb_misc('Michael Natterer', 'mitch@gimp.org', @_);
}