mirror of https://github.com/GNOME/gimp.git
pdb: add "sample-merged" as property to the PDB context
- add API to get/set the new state - remove sample-merged parameters from the new gimp_image_select_foo() API - update procedure documentation
This commit is contained in:
parent
ab5bd03a9c
commit
bb6083a1eb
|
@ -769,6 +769,51 @@ context_set_feather_radius_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_sample_merged_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
GValueArray *return_vals;
|
||||
gboolean sample_merged = FALSE;
|
||||
|
||||
g_object_get (context,
|
||||
"sample-merged", &sample_merged,
|
||||
NULL);
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
g_value_set_boolean (&return_vals->values[1], sample_merged);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_set_sample_merged_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
gboolean sample_merged;
|
||||
|
||||
sample_merged = g_value_get_boolean (&args->values[0]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-merged", sample_merged,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_interpolation_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -1678,6 +1723,52 @@ register_context_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-sample-merged
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_get_sample_merged_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-get-sample-merged");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-get-sample-merged",
|
||||
"Get the sample merged setting.",
|
||||
"This procedure returns the sample merged setting.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_boolean ("sample-merged",
|
||||
"sample merged",
|
||||
"The sample merged setting",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-set-sample-merged
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_set_sample_merged_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-set-sample-merged");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-set-sample-merged",
|
||||
"Set the sample merged setting.",
|
||||
"This procedure modifies the sample merged setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether the pixel data from the specified drawable is used ('sample-merged' is FALSE), or the pixel data from the composite image ('sample-merged' is TRUE. This is equivalent to sampling for colors after merging all visible layers). This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-fuzzy'.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("sample-merged",
|
||||
"sample merged",
|
||||
"The sample merged setting",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-interpolation
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,7 @@ enum
|
|||
PROP_FEATHER,
|
||||
PROP_FEATHER_RADIUS_X,
|
||||
PROP_FEATHER_RADIUS_Y,
|
||||
PROP_SAMPLE_MERGED,
|
||||
PROP_INTERPOLATION,
|
||||
PROP_TRANSFORM_DIRECTION,
|
||||
PROP_TRANSFORM_RESIZE,
|
||||
|
@ -94,6 +95,11 @@ gimp_pdb_context_class_init (GimpPDBContextClass *klass)
|
|||
0.0, 1000.0, 10.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
|
||||
"sample-merged", NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTERPOLATION,
|
||||
"interpolation", NULL,
|
||||
GIMP_TYPE_INTERPOLATION_TYPE,
|
||||
|
@ -169,6 +175,10 @@ gimp_pdb_context_set_property (GObject *object,
|
|||
options->feather_radius_y = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_MERGED:
|
||||
options->sample_merged = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_INTERPOLATION:
|
||||
options->interpolation = g_value_get_enum (value);
|
||||
break;
|
||||
|
@ -217,6 +227,10 @@ gimp_pdb_context_get_property (GObject *object,
|
|||
g_value_set_double (value, options->feather_radius_y);
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_MERGED:
|
||||
g_value_set_boolean (value, options->sample_merged);
|
||||
break;
|
||||
|
||||
case PROP_INTERPOLATION:
|
||||
g_value_set_enum (value, options->interpolation);
|
||||
break;
|
||||
|
|
|
@ -43,6 +43,7 @@ struct _GimpPDBContext
|
|||
gboolean feather;
|
||||
gdouble feather_radius_x;
|
||||
gdouble feather_radius_y;
|
||||
gboolean sample_merged;
|
||||
|
||||
GimpInterpolationType interpolation;
|
||||
GimpTransformDirection transform_direction;
|
||||
|
|
|
@ -55,7 +55,6 @@ image_select_color_invoker (GimpProcedure *procedure,
|
|||
GimpDrawable *drawable;
|
||||
GimpRGB color;
|
||||
gint32 threshold;
|
||||
gboolean sample_merged;
|
||||
gboolean select_transparent;
|
||||
gint32 select_criterion;
|
||||
|
||||
|
@ -64,19 +63,18 @@ image_select_color_invoker (GimpProcedure *procedure,
|
|||
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]);
|
||||
sample_merged = g_value_get_boolean (&args->values[5]);
|
||||
select_transparent = g_value_get_boolean (&args->values[6]);
|
||||
select_criterion = g_value_get_enum (&args->values[7]);
|
||||
select_transparent = g_value_get_boolean (&args->values[5]);
|
||||
select_criterion = g_value_get_enum (&args->values[6]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (sample_merged ||
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
if (pdb_context->sample_merged ||
|
||||
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, FALSE, error))
|
||||
{
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
|
||||
sample_merged,
|
||||
pdb_context->sample_merged,
|
||||
&color,
|
||||
threshold,
|
||||
select_transparent,
|
||||
|
@ -191,7 +189,6 @@ image_select_fuzzy_invoker (GimpProcedure *procedure,
|
|||
gdouble x;
|
||||
gdouble y;
|
||||
gint32 threshold;
|
||||
gboolean sample_merged;
|
||||
gboolean select_transparent;
|
||||
gint32 select_criterion;
|
||||
|
||||
|
@ -201,20 +198,20 @@ image_select_fuzzy_invoker (GimpProcedure *procedure,
|
|||
x = g_value_get_double (&args->values[3]);
|
||||
y = g_value_get_double (&args->values[4]);
|
||||
threshold = g_value_get_int (&args->values[5]);
|
||||
sample_merged = g_value_get_boolean (&args->values[6]);
|
||||
select_transparent = g_value_get_boolean (&args->values[7]);
|
||||
select_criterion = g_value_get_enum (&args->values[8]);
|
||||
select_transparent = g_value_get_boolean (&args->values[6]);
|
||||
select_criterion = g_value_get_enum (&args->values[7]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (sample_merged ||
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
if (pdb_context->sample_merged ||
|
||||
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, FALSE, error))
|
||||
{
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
gimp_channel_select_fuzzy (gimp_image_get_mask (image),
|
||||
drawable,
|
||||
sample_merged,
|
||||
pdb_context->sample_merged,
|
||||
x, y,
|
||||
threshold,
|
||||
select_transparent,
|
||||
|
@ -373,7 +370,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. If the 'sample-merged' parameter is TRUE, the data of the composite image will be used instead of that for the specified drawable. This is equivalent to sampling for colors after merging all visible layers. 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 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'. In the case of a merged sampling, the supplied drawable is ignored.",
|
||||
"David Gowers",
|
||||
"David Gowers",
|
||||
"2010",
|
||||
|
@ -410,12 +407,6 @@ register_image_select_procs (GimpPDB *pdb)
|
|||
"Threshold in intensity levels",
|
||||
0, 255, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("sample-merged",
|
||||
"sample merged",
|
||||
"Use the composite image, not the drawable",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("select-transparent",
|
||||
"select transparent",
|
||||
|
@ -536,8 +527,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. If the 'sample-merged' parameter is TRUE, the data of the composite image will be used instead of that for the specified drawable. This is equivalent to sampling for colors after merging all visible layers. 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 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'. 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",
|
||||
|
@ -579,12 +570,6 @@ register_image_select_procs (GimpPDB *pdb)
|
|||
"Threshold in intensity levels",
|
||||
0, 255, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("sample-merged",
|
||||
"sample merged",
|
||||
"Use the composite image, not the drawable",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("select-transparent",
|
||||
"select transparent",
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 640 procedures registered total */
|
||||
/* 642 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -1075,6 +1075,74 @@ gimp_context_set_feather_radius (gdouble feather_radius_x,
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_sample_merged:
|
||||
*
|
||||
* Get the sample merged setting.
|
||||
*
|
||||
* This procedure returns the sample merged setting.
|
||||
*
|
||||
* Returns: The sample merged setting.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_get_sample_merged (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean sample_merged = FALSE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-sample-merged",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
sample_merged = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return sample_merged;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_sample_merged:
|
||||
* @sample_merged: The sample merged setting.
|
||||
*
|
||||
* Set the sample merged setting.
|
||||
*
|
||||
* This procedure modifies the sample merged setting. If an operation
|
||||
* depends on the colors of the pixels present in a drawable, like when
|
||||
* doing a seed fill, this setting controls whether the pixel data from
|
||||
* the specified drawable is used ('sample-merged' is FALSE), or the
|
||||
* pixel data from the composite image ('sample-merged' is TRUE. This
|
||||
* is equivalent to sampling for colors after merging all visible
|
||||
* layers). This setting affects the following procedures:
|
||||
* gimp_image_select_color(), gimp_image_select_fuzzy().
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_sample_merged (gboolean sample_merged)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-sample-merged",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_INT32, sample_merged,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_interpolation:
|
||||
*
|
||||
|
|
|
@ -62,6 +62,8 @@ gboolean gimp_context_get_feather_radius (gdouble
|
|||
gdouble *feather_radius_y);
|
||||
gboolean gimp_context_set_feather_radius (gdouble feather_radius_x,
|
||||
gdouble feather_radius_y);
|
||||
gboolean gimp_context_get_sample_merged (void);
|
||||
gboolean gimp_context_set_sample_merged (gboolean sample_merged);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* @drawable_ID: The affected drawable.
|
||||
* @color: The color to select.
|
||||
* @threshold: Threshold in intensity levels.
|
||||
* @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.
|
||||
*
|
||||
|
@ -54,11 +53,11 @@
|
|||
* 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. If the 'sample-merged' parameter is TRUE,
|
||||
* the data of the composite image will be used instead of that for the
|
||||
* specified drawable. This is equivalent to sampling for colors after
|
||||
* merging all visible layers. In the case of a merged sampling, the
|
||||
* supplied drawable is ignored.
|
||||
* 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(). In the case of a merged sampling,
|
||||
* the supplied drawable is ignored.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
|
@ -70,7 +69,6 @@ gimp_image_select_color (gint32 image_ID,
|
|||
gint32 drawable_ID,
|
||||
const GimpRGB *color,
|
||||
gint threshold,
|
||||
gboolean sample_merged,
|
||||
gboolean select_transparent,
|
||||
GimpSelectCriterion select_criterion)
|
||||
{
|
||||
|
@ -85,7 +83,6 @@ gimp_image_select_color (gint32 image_ID,
|
|||
GIMP_PDB_DRAWABLE, drawable_ID,
|
||||
GIMP_PDB_COLOR, color,
|
||||
GIMP_PDB_INT32, threshold,
|
||||
GIMP_PDB_INT32, sample_merged,
|
||||
GIMP_PDB_INT32, select_transparent,
|
||||
GIMP_PDB_INT32, select_criterion,
|
||||
GIMP_PDB_END);
|
||||
|
@ -206,7 +203,6 @@ gimp_image_select_polygon (gint32 image_ID,
|
|||
* @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.
|
||||
* @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.
|
||||
*
|
||||
|
@ -222,13 +218,13 @@ gimp_image_select_polygon (gint32 image_ID,
|
|||
* 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. If the 'sample-merged'
|
||||
* parameter is TRUE, the data of the composite image will be used
|
||||
* instead of that for the specified drawable. This is equivalent to
|
||||
* sampling for colors after merging all visible layers. 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.
|
||||
* 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(). 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.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
|
@ -241,7 +237,6 @@ gimp_image_select_fuzzy (gint32 image_ID,
|
|||
gdouble x,
|
||||
gdouble y,
|
||||
gint threshold,
|
||||
gboolean sample_merged,
|
||||
gboolean select_transparent,
|
||||
GimpSelectCriterion select_criterion)
|
||||
{
|
||||
|
@ -257,7 +252,6 @@ gimp_image_select_fuzzy (gint32 image_ID,
|
|||
GIMP_PDB_FLOAT, x,
|
||||
GIMP_PDB_FLOAT, y,
|
||||
GIMP_PDB_INT32, threshold,
|
||||
GIMP_PDB_INT32, sample_merged,
|
||||
GIMP_PDB_INT32, select_transparent,
|
||||
GIMP_PDB_INT32, select_criterion,
|
||||
GIMP_PDB_END);
|
||||
|
|
|
@ -33,7 +33,6 @@ gboolean gimp_image_select_color (gint32 image_ID,
|
|||
gint32 drawable_ID,
|
||||
const GimpRGB *color,
|
||||
gint threshold,
|
||||
gboolean sample_merged,
|
||||
gboolean select_transparent,
|
||||
GimpSelectCriterion select_criterion);
|
||||
gboolean gimp_image_select_ellipse (gint32 image_ID,
|
||||
|
@ -52,7 +51,6 @@ gboolean gimp_image_select_fuzzy (gint32 image_ID,
|
|||
gdouble x,
|
||||
gdouble y,
|
||||
gint threshold,
|
||||
gboolean sample_merged,
|
||||
gboolean select_transparent,
|
||||
GimpSelectCriterion select_criterion);
|
||||
gboolean gimp_image_select_rectangle (gint32 image_ID,
|
||||
|
|
|
@ -872,6 +872,63 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub context_get_sample_merged {
|
||||
$blurb = 'Get the sample merged setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the sample merged setting.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => 'sample_merged', type => 'boolean',
|
||||
desc => 'The sample merged setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_get (context,
|
||||
"sample-merged", &sample_merged,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_sample_merged {
|
||||
$blurb = 'Set the sample merged setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure modifies the sample merged setting. If an operation
|
||||
depends on the colors of the pixels present in a drawable, like when
|
||||
doing a seed fill, this setting controls whether the pixel data from
|
||||
the specified drawable is used ('sample-merged' is FALSE), or the
|
||||
pixel data from the composite image ('sample-merged' is TRUE. This is
|
||||
equivalent to sampling for colors after merging all visible
|
||||
layers). This setting affects the following procedures:
|
||||
gimp_image_select_color(), gimp_image_select_fuzzy().
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'sample_merged', type => 'boolean',
|
||||
desc => 'The sample merged setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-merged", sample_merged,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_interpolation {
|
||||
$blurb = 'Get the interpolation type.';
|
||||
|
||||
|
@ -1114,6 +1171,7 @@ CODE
|
|||
context_get_antialias context_set_antialias
|
||||
context_get_feather context_set_feather
|
||||
context_get_feather_radius context_set_feather_radius
|
||||
context_get_sample_merged context_set_sample_merged
|
||||
context_get_interpolation context_set_interpolation
|
||||
context_get_transform_direction context_set_transform_direction
|
||||
context_get_transform_resize context_set_transform_resize
|
||||
|
|
|
@ -29,11 +29,13 @@ 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. If the 'sample-merged' parameter is TRUE, the data of the
|
||||
composite image will be used instead of that for the specified
|
||||
drawable. This is equivalent to sampling for colors after merging all
|
||||
visible layers. In the case of a merged sampling, the supplied
|
||||
drawable is ignored.
|
||||
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().
|
||||
|
||||
In the case of a merged sampling, the supplied drawable is ignored.
|
||||
HELP
|
||||
|
||||
&david_pdb_misc('2010', '2.8');
|
||||
|
@ -49,8 +51,6 @@ HELP
|
|||
desc => 'The color to select' },
|
||||
{ name => 'threshold', type => '0 <= int32 <= 255',
|
||||
desc => 'Threshold in intensity levels' },
|
||||
{ name => 'sample_merged', type => 'boolean',
|
||||
desc => 'Use the composite image, not the drawable' },
|
||||
{ name => 'select_transparent', type => 'boolean',
|
||||
desc => "Whether to consider transparent pixels for selection.
|
||||
If TRUE, transparency is considered as a unique selectable
|
||||
|
@ -64,13 +64,13 @@ HELP
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (sample_merged ||
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
if (pdb_context->sample_merged ||
|
||||
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, FALSE, error))
|
||||
{
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
|
||||
sample_merged,
|
||||
pdb_context->sample_merged,
|
||||
&color,
|
||||
threshold,
|
||||
select_transparent,
|
||||
|
@ -209,13 +209,15 @@ 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. If the 'sample-merged' parameter is TRUE, the data
|
||||
of the composite image will be used instead of that for the specified
|
||||
drawable. This is equivalent to sampling for colors after merging all
|
||||
visible layers. 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.
|
||||
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().
|
||||
|
||||
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.
|
||||
HELP
|
||||
|
||||
&david_pdb_misc('2010', '2.8');
|
||||
|
@ -235,8 +237,6 @@ HELP
|
|||
coordinates)' },
|
||||
{ name => 'threshold', type => '0 <= int32 <= 255',
|
||||
desc => 'Threshold in intensity levels' },
|
||||
{ name => 'sample_merged', type => 'boolean',
|
||||
desc => 'Use the composite image, not the drawable' },
|
||||
{ name => 'select_transparent', type => 'boolean',
|
||||
desc => "Whether to consider transparent pixels for selection.
|
||||
If TRUE, transparency is considered as a unique selectable
|
||||
|
@ -250,14 +250,15 @@ HELP
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (sample_merged ||
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
if (pdb_context->sample_merged ||
|
||||
gimp_pdb_item_is_attached (GIMP_ITEM (drawable), image, FALSE, error))
|
||||
{
|
||||
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
|
||||
|
||||
gimp_channel_select_fuzzy (gimp_image_get_mask (image),
|
||||
drawable,
|
||||
sample_merged,
|
||||
pdb_context->sample_merged,
|
||||
x, y,
|
||||
threshold,
|
||||
select_transparent,
|
||||
|
|
Loading…
Reference in New Issue