libgimp: remove "threshold" parameters from the new selection API

and use the sample-threshold setting from GimpPDBContext instead.
This commit is contained in:
Michael Natterer
2011-02-04 15:45:17 +01:00
parent 2e16d932ec
commit c15488d10a
4 changed files with 41 additions and 67 deletions

View File

@ -54,15 +54,13 @@ image_select_color_invoker (GimpProcedure *procedure,
gint32 operation;
GimpDrawable *drawable;
GimpRGB color;
gint32 threshold;
gboolean select_transparent;
image = gimp_value_get_image (&args->values[0], gimp);
operation = g_value_get_enum (&args->values[1]);
drawable = gimp_value_get_drawable (&args->values[2], gimp);
gimp_value_get_rgb (&args->values[3], &color);
threshold = g_value_get_int (&args->values[4]);
select_transparent = g_value_get_boolean (&args->values[5]);
select_transparent = g_value_get_boolean (&args->values[4]);
if (success)
{
@ -74,7 +72,7 @@ image_select_color_invoker (GimpProcedure *procedure,
gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
pdb_context->sample_merged,
&color,
threshold,
(gint) (pdb_context->sample_threshold * 255.99),
select_transparent,
pdb_context->sample_criterion,
operation,
@ -186,7 +184,6 @@ image_select_fuzzy_invoker (GimpProcedure *procedure,
GimpDrawable *drawable;
gdouble x;
gdouble y;
gint32 threshold;
gboolean select_transparent;
image = gimp_value_get_image (&args->values[0], gimp);
@ -194,8 +191,7 @@ image_select_fuzzy_invoker (GimpProcedure *procedure,
drawable = gimp_value_get_drawable (&args->values[2], gimp);
x = g_value_get_double (&args->values[3]);
y = g_value_get_double (&args->values[4]);
threshold = g_value_get_int (&args->values[5]);
select_transparent = g_value_get_boolean (&args->values[6]);
select_transparent = g_value_get_boolean (&args->values[5]);
if (success)
{
@ -209,7 +205,7 @@ image_select_fuzzy_invoker (GimpProcedure *procedure,
drawable,
pdb_context->sample_merged,
x, y,
threshold,
(gint) (pdb_context->sample_threshold * 255.99),
select_transparent,
pdb_context->sample_criterion,
operation,
@ -366,7 +362,7 @@ register_image_select_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-select-color",
"Create a selection by selecting all pixels (in the specified drawable) with the same (or similar) color to that specified.",
"This tool creates a selection over the specified image. A by-color selection is determined by the supplied color under the constraints of the specified threshold. Essentially, all pixels (in the drawable) that have color sufficiently close to the specified color (as determined by the threshold value) are included in the selection. To select transparent regions, the color specified must also have minimum alpha. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius', 'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion'. In the case of a merged sampling, the supplied drawable is ignored.",
"This tool creates a selection over the specified image. A by-color selection is determined by the supplied color under the constraints of the current context settings. Essentially, all pixels (in the drawable) that have color sufficiently close to the specified color (as determined by the threshold and criterion context values) are included in the selection. To select transparent regions, the color specified must also have minimum alpha. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius', 'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion', 'gimp-context-set-sample-threshold'. In the case of a merged sampling, the supplied drawable is ignored.",
"David Gowers",
"David Gowers",
"2010",
@ -397,12 +393,6 @@ register_image_select_procs (GimpPDB *pdb)
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("threshold",
"threshold",
"Threshold in intensity levels",
0, 255, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("select-transparent",
"select transparent",
@ -516,8 +506,8 @@ register_image_select_procs (GimpPDB *pdb)
gimp_procedure_set_static_strings (procedure,
"gimp-image-select-fuzzy",
"Create a fuzzy selection starting at the specified coordinates on the specified drawable.",
"This tool creates a fuzzy selection over the specified image. A fuzzy selection is determined by a seed fill under the constraints of the specified threshold. Essentially, the color at the specified coordinates (in the drawable) is measured and the selection expands outwards from that point to any adjacent pixels which are not significantly different (as determined by the threshold value). This process continues until no more expansion is possible. If antialiasing is turned on, the final selection mask will contain intermediate values based on close misses to the threshold bar at pixels along the seed fill boundary. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius', 'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion'. In the case of a merged sampling, the supplied drawable is ignored. If the sample is merged, the specified coordinates are relative to the image"
"origin; otherwise, they are relative to the drawable's origin.",
"This tool creates a fuzzy selection over the specified image. A fuzzy selection is determined by a seed fill under the constraints of the current context settings. Essentially, the color at the specified coordinates (in the drawable) is measured and the selection expands outwards from that point to any adjacent pixels which are not significantly different (as determined by the threshold and criterion context settings). This process continues until no more expansion is possible. If antialiasing is turned on, the final selection mask will contain intermediate values based on close misses to the threshold bar at pixels along the seed fill boundary. This prodecure is affected by the following context setters: 'gimp-context-set-antialias', 'gimp-context-set-feather', 'gimp-context-set-feather-radius', 'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion', 'gimp-context-set-sample-threshold'. In the case of a merged sampling, the supplied drawable is ignored. If the"
"sample is merged, the specified coordinates are relative to the image origin; otherwise, they are relative to the drawable's origin.",
"David Gowers",
"David Gowers",
"2010",
@ -553,12 +543,6 @@ register_image_select_procs (GimpPDB *pdb)
"y coordinate of initial seed fill point: (image coordinates)",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("threshold",
"threshold",
"Threshold in intensity levels",
0, 255, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_boolean ("select-transparent",
"select transparent",

View File

@ -40,7 +40,6 @@
* @operation: The selection operation.
* @drawable_ID: The affected drawable.
* @color: The color to select.
* @threshold: Threshold in intensity levels.
* @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
*
* Create a selection by selecting all pixels (in the specified
@ -48,15 +47,16 @@
*
* This tool creates a selection over the specified image. A by-color
* selection is determined by the supplied color under the constraints
* of the specified threshold. Essentially, all pixels (in the
* of the current context settings. Essentially, all pixels (in the
* drawable) that have color sufficiently close to the specified color
* (as determined by the threshold value) are included in the
* selection. To select transparent regions, the color specified must
* also have minimum alpha. This prodecure is affected by the following
* context setters: gimp_context_set_antialias(),
* (as determined by the threshold and criterion context values) are
* included in the selection. To select transparent regions, the color
* specified must also have minimum alpha. This prodecure is affected
* by the following context setters: gimp_context_set_antialias(),
* gimp_context_set_feather(), gimp_context_set_feather_radius(),
* gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(). In the case of a merged
* gimp_context_set_sample_criterion(),
* gimp_context_set_sample_threshold(). In the case of a merged
* sampling, the supplied drawable is ignored.
*
* Returns: TRUE on success.
@ -68,7 +68,6 @@ gimp_image_select_color (gint32 image_ID,
GimpChannelOps operation,
gint32 drawable_ID,
const GimpRGB *color,
gint threshold,
gboolean select_transparent)
{
GimpParam *return_vals;
@ -81,7 +80,6 @@ gimp_image_select_color (gint32 image_ID,
GIMP_PDB_INT32, operation,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_COLOR, color,
GIMP_PDB_INT32, threshold,
GIMP_PDB_INT32, select_transparent,
GIMP_PDB_END);
@ -200,7 +198,6 @@ gimp_image_select_polygon (gint32 image_ID,
* @drawable_ID: The affected drawable.
* @x: x coordinate of initial seed fill point: (image coordinates).
* @y: y coordinate of initial seed fill point: (image coordinates).
* @threshold: Threshold in intensity levels.
* @select_transparent: Whether to consider transparent pixels for selection. If TRUE, transparency is considered as a unique selectable color.
*
* Create a fuzzy selection starting at the specified coordinates on
@ -208,18 +205,19 @@ gimp_image_select_polygon (gint32 image_ID,
*
* This tool creates a fuzzy selection over the specified image. A
* fuzzy selection is determined by a seed fill under the constraints
* of the specified threshold. Essentially, the color at the specified
* coordinates (in the drawable) is measured and the selection expands
* outwards from that point to any adjacent pixels which are not
* significantly different (as determined by the threshold value). This
* process continues until no more expansion is possible. If
* antialiasing is turned on, the final selection mask will contain
* intermediate values based on close misses to the threshold bar at
* pixels along the seed fill boundary. This prodecure is affected by
* the following context setters: gimp_context_set_antialias(),
* gimp_context_set_feather(), gimp_context_set_feather_radius(),
* gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(). In the case of a merged
* of the current context settings. Essentially, the color at the
* specified coordinates (in the drawable) is measured and the
* selection expands outwards from that point to any adjacent pixels
* which are not significantly different (as determined by the
* threshold and criterion context settings). This process continues
* until no more expansion is possible. If antialiasing is turned on,
* the final selection mask will contain intermediate values based on
* close misses to the threshold bar at pixels along the seed fill
* boundary. This prodecure is affected by the following context
* setters: gimp_context_set_antialias(), gimp_context_set_feather(),
* gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
* gimp_context_set_sample_criterion(),
* gimp_context_set_sample_threshold(). In the case of a merged
* sampling, the supplied drawable is ignored. If the sample is merged,
* the specified coordinates are relative to the image origin;
* otherwise, they are relative to the drawable's origin.
@ -234,7 +232,6 @@ gimp_image_select_fuzzy (gint32 image_ID,
gint32 drawable_ID,
gdouble x,
gdouble y,
gint threshold,
gboolean select_transparent)
{
GimpParam *return_vals;
@ -248,7 +245,6 @@ gimp_image_select_fuzzy (gint32 image_ID,
GIMP_PDB_DRAWABLE, drawable_ID,
GIMP_PDB_FLOAT, x,
GIMP_PDB_FLOAT, y,
GIMP_PDB_INT32, threshold,
GIMP_PDB_INT32, select_transparent,
GIMP_PDB_END);

View File

@ -32,7 +32,6 @@ gboolean gimp_image_select_color (gint32 image_ID,
GimpChannelOps operation,
gint32 drawable_ID,
const GimpRGB *color,
gint threshold,
gboolean select_transparent);
gboolean gimp_image_select_ellipse (gint32 image_ID,
GimpChannelOps operation,
@ -49,7 +48,6 @@ gboolean gimp_image_select_fuzzy (gint32 image_ID,
gint32 drawable_ID,
gdouble x,
gdouble y,
gint threshold,
gboolean select_transparent);
gboolean gimp_image_select_rectangle (gint32 image_ID,
GimpChannelOps operation,

View File

@ -25,16 +25,16 @@ BLURB
$help = <<'HELP';
This tool creates a selection over the specified image. A by-color
selection is determined by the supplied color under the constraints of
the specified threshold. Essentially, all pixels (in the drawable)
the current context settings. Essentially, all pixels (in the drawable)
that have color sufficiently close to the specified color (as
determined by the threshold value) are included in the selection. To
select transparent regions, the color specified must also have minimum
alpha.
determined by the threshold and criterion context values) are included
in the selection. To select transparent regions, the color specified
must also have minimum alpha.
This prodecure is affected by the following context setters:
gimp_context_set_antialias(), gimp_context_set_feather(),
gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
gimp_context_set_sample_criterion().
gimp_context_set_sample_criterion(), gimp_context_set_sample_threshold().
In the case of a merged sampling, the supplied drawable is ignored.
HELP
@ -50,8 +50,6 @@ HELP
desc => 'The affected drawable' },
{ name => 'color', type => 'color',
desc => 'The color to select' },
{ name => 'threshold', type => '0 <= int32 <= 255',
desc => 'Threshold in intensity levels' },
{ name => 'select_transparent', type => 'boolean',
desc => "Whether to consider transparent pixels for selection.
If TRUE, transparency is considered as a unique selectable
@ -69,7 +67,7 @@ HELP
gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
pdb_context->sample_merged,
&color,
threshold,
(gint) (pdb_context->sample_threshold * 255.99),
select_transparent,
pdb_context->sample_criterion,
operation,
@ -199,19 +197,19 @@ BLURB
$help = <<'HELP';
This tool creates a fuzzy selection over the specified image. A fuzzy
selection is determined by a seed fill under the constraints of the
specified threshold. Essentially, the color at the specified
current context settings. Essentially, the color at the specified
coordinates (in the drawable) is measured and the selection expands
outwards from that point to any adjacent pixels which are not
significantly different (as determined by the threshold value). This
process continues until no more expansion is possible. If antialiasing
is turned on, the final selection mask will contain intermediate
values based on close misses to the threshold bar at pixels along the
seed fill boundary.
significantly different (as determined by the threshold and criterion
context settings). This process continues until no more expansion is
possible. If antialiasing is turned on, the final selection mask will
contain intermediate values based on close misses to the threshold bar
at pixels along the seed fill boundary.
This prodecure is affected by the following context setters:
gimp_context_set_antialias(), gimp_context_set_feather(),
gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
gimp_context_set_sample_criterion().
gimp_context_set_sample_criterion(), gimp_context_set_sample_threshold().
In the case of a merged sampling, the supplied drawable is ignored.
If the sample is merged, the specified coordinates are relative to the
@ -233,8 +231,6 @@ HELP
{ name => 'y', type => 'float',
desc => 'y coordinate of initial seed fill point: (image
coordinates)' },
{ name => 'threshold', type => '0 <= int32 <= 255',
desc => 'Threshold in intensity levels' },
{ name => 'select_transparent', type => 'boolean',
desc => "Whether to consider transparent pixels for selection.
If TRUE, transparency is considered as a unique selectable
@ -254,7 +250,7 @@ HELP
drawable,
pdb_context->sample_merged,
x, y,
threshold,
(gint) (pdb_context->sample_threshold * 255.99),
select_transparent,
pdb_context->sample_criterion,
operation,