mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
pdb: add "sample-threshold" as GimpPDBContext property
and add PDB API to get/set it.
This commit is contained in:
parent
f76bcab221
commit
2e16d932ec
8 changed files with 520 additions and 50 deletions
|
@ -859,6 +859,100 @@ context_set_sample_criterion_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_sample_threshold_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
GValueArray *return_vals;
|
||||
gdouble sample_threshold = 0.0;
|
||||
|
||||
g_object_get (context,
|
||||
"sample-threshold", &sample_threshold,
|
||||
NULL);
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
g_value_set_double (&return_vals->values[1], sample_threshold);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_set_sample_threshold_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
gdouble sample_threshold;
|
||||
|
||||
sample_threshold = g_value_get_double (&args->values[0]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-threshold", sample_threshold,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_sample_threshold_int_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
GValueArray *return_vals;
|
||||
gint32 sample_threshold = 0;
|
||||
|
||||
gdouble threshold;
|
||||
|
||||
g_object_get (context,
|
||||
"sample-threshold", &threshold,
|
||||
NULL);
|
||||
|
||||
sample_threshold = (gint) (threshold * 255.99);
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
g_value_set_int (&return_vals->values[1], sample_threshold);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_set_sample_threshold_int_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
gint32 sample_threshold;
|
||||
|
||||
sample_threshold = g_value_get_int (&args->values[0]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-threshold", (gdouble) sample_threshold / 255.0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_interpolation_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -1846,7 +1940,7 @@ register_context_procs (GimpPDB *pdb)
|
|||
"gimp-context-set-sample-criterion");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-set-sample-criterion",
|
||||
"Set the sample merged setting.",
|
||||
"Set the sample criterion setting.",
|
||||
"This procedure modifies the sample criterion setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls how color similarity is determined. SELECT_CRITERION_COMPOSITE is the default value. This setting affects the following procedures: 'gimp-image-select-color', 'gimp-image-select-fuzzy'.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
|
@ -1862,6 +1956,98 @@ register_context_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-sample-threshold
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_get_sample_threshold_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-get-sample-threshold");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-get-sample-threshold",
|
||||
"Get the sample threshold setting.",
|
||||
"This procedure returns the sample threshold setting.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_double ("sample-threshold",
|
||||
"sample threshold",
|
||||
"The sample threshold setting",
|
||||
0.0, 1.0, 0.0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-set-sample-threshold
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_set_sample_threshold_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-set-sample-threshold");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-set-sample-threshold",
|
||||
"Set the sample threshold setting.",
|
||||
"This procedure modifies the sample threshold setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls what is \"sufficiently close\" to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in gimprc will be used. 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_double ("sample-threshold",
|
||||
"sample threshold",
|
||||
"The sample threshold setting",
|
||||
0.0, 1.0, 0.0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-sample-threshold-int
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_get_sample_threshold_int_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-get-sample-threshold-int");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-get-sample-threshold-int",
|
||||
"Get the sample threshold setting as an integer value.",
|
||||
"This procedure returns the sample threshold setting as an integer value. See 'gimp-context-get-sample-threshold'.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_int32 ("sample-threshold",
|
||||
"sample threshold",
|
||||
"The sample threshold setting",
|
||||
0, 255, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-set-sample-threshold-int
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_set_sample_threshold_int_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-set-sample-threshold-int");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-set-sample-threshold-int",
|
||||
"Set the sample threshold setting as an integer value.",
|
||||
"This procedure modifies the sample threshold setting as an integer value. See 'gimp-context-set-sample-threshold'.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_int32 ("sample-threshold",
|
||||
"sample threshold",
|
||||
"The sample threshold setting",
|
||||
0, 255, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-interpolation
|
||||
*/
|
||||
|
|
|
@ -43,6 +43,7 @@ enum
|
|||
PROP_FEATHER_RADIUS_Y,
|
||||
PROP_SAMPLE_MERGED,
|
||||
PROP_SAMPLE_CRITERION,
|
||||
PROP_SAMPLE_THRESHOLD,
|
||||
PROP_INTERPOLATION,
|
||||
PROP_TRANSFORM_DIRECTION,
|
||||
PROP_TRANSFORM_RESIZE,
|
||||
|
@ -107,6 +108,11 @@ gimp_pdb_context_class_init (GimpPDBContextClass *klass)
|
|||
GIMP_SELECT_CRITERION_COMPOSITE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SAMPLE_THRESHOLD,
|
||||
"sample-threshold", NULL,
|
||||
0.0, 1.0, 0.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTERPOLATION,
|
||||
"interpolation", NULL,
|
||||
GIMP_TYPE_INTERPOLATION_TYPE,
|
||||
|
@ -140,8 +146,11 @@ static void
|
|||
gimp_pdb_context_constructed (GObject *object)
|
||||
{
|
||||
GimpInterpolationType interpolation;
|
||||
gint threshold;
|
||||
GParamSpec *pspec;
|
||||
|
||||
/* get default interpolation from gimprc */
|
||||
|
||||
interpolation = GIMP_CONTEXT (object)->gimp->config->interpolation_type;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
|
||||
|
@ -152,6 +161,18 @@ gimp_pdb_context_constructed (GObject *object)
|
|||
|
||||
g_object_set (object, "interpolation", interpolation, NULL);
|
||||
|
||||
/* get default threshold from gimprc */
|
||||
|
||||
threshold = GIMP_CONTEXT (object)->gimp->config->default_threshold;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object),
|
||||
"sample-threshold");
|
||||
|
||||
if (pspec)
|
||||
G_PARAM_SPEC_DOUBLE (pspec)->default_value = threshold / 255.0;
|
||||
|
||||
g_object_set (object, "sample-threshold", threshold / 255.0, NULL);
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->constructed)
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
}
|
||||
|
@ -190,6 +211,10 @@ gimp_pdb_context_set_property (GObject *object,
|
|||
options->sample_criterion = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_THRESHOLD:
|
||||
options->sample_threshold = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_INTERPOLATION:
|
||||
options->interpolation = g_value_get_enum (value);
|
||||
break;
|
||||
|
@ -246,6 +271,10 @@ gimp_pdb_context_get_property (GObject *object,
|
|||
g_value_set_enum (value, options->sample_criterion);
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_THRESHOLD:
|
||||
g_value_set_double (value, options->sample_threshold);
|
||||
break;
|
||||
|
||||
case PROP_INTERPOLATION:
|
||||
g_value_set_enum (value, options->interpolation);
|
||||
break;
|
||||
|
|
|
@ -45,6 +45,7 @@ struct _GimpPDBContext
|
|||
gdouble feather_radius_y;
|
||||
gboolean sample_merged;
|
||||
GimpSelectCriterion sample_criterion;
|
||||
gdouble sample_threshold;
|
||||
|
||||
GimpInterpolationType interpolation;
|
||||
GimpTransformDirection transform_direction;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 644 procedures registered total */
|
||||
/* 648 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -84,6 +84,8 @@ EXPORTS
|
|||
gimp_context_get_pattern
|
||||
gimp_context_get_sample_criterion
|
||||
gimp_context_get_sample_merged
|
||||
gimp_context_get_sample_threshold
|
||||
gimp_context_get_sample_threshold_int
|
||||
gimp_context_get_transform_direction
|
||||
gimp_context_get_transform_recursion
|
||||
gimp_context_get_transform_resize
|
||||
|
@ -107,6 +109,8 @@ EXPORTS
|
|||
gimp_context_set_pattern
|
||||
gimp_context_set_sample_criterion
|
||||
gimp_context_set_sample_merged
|
||||
gimp_context_set_sample_threshold
|
||||
gimp_context_set_sample_threshold_int
|
||||
gimp_context_set_transform_direction
|
||||
gimp_context_set_transform_recursion
|
||||
gimp_context_set_transform_resize
|
||||
|
|
|
@ -1177,7 +1177,7 @@ gimp_context_get_sample_criterion (void)
|
|||
* gimp_context_set_sample_criterion:
|
||||
* @sample_criterion: The sample criterion setting.
|
||||
*
|
||||
* Set the sample merged setting.
|
||||
* Set the sample criterion setting.
|
||||
*
|
||||
* This procedure modifies the sample criterion setting. If an
|
||||
* operation depends on the colors of the pixels present in a drawable,
|
||||
|
@ -1209,6 +1209,136 @@ gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion)
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_sample_threshold:
|
||||
*
|
||||
* Get the sample threshold setting.
|
||||
*
|
||||
* This procedure returns the sample threshold setting.
|
||||
*
|
||||
* Returns: The sample threshold setting.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gdouble
|
||||
gimp_context_get_sample_threshold (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gdouble sample_threshold = 0.0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
sample_threshold = return_vals[1].data.d_float;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return sample_threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_sample_threshold:
|
||||
* @sample_threshold: The sample threshold setting.
|
||||
*
|
||||
* Set the sample threshold setting.
|
||||
*
|
||||
* This procedure modifies the sample threshold setting. If an
|
||||
* operation depends on the colors of the pixels present in a drawable,
|
||||
* like when doing a seed fill, this setting controls what is
|
||||
* \"sufficiently close\" to be considered a similar color. If the
|
||||
* sample threshold has not been set explicitly, the default threshold
|
||||
* set in gimprc will be used. 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_threshold (gdouble sample_threshold)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_FLOAT, sample_threshold,
|
||||
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_sample_threshold_int:
|
||||
*
|
||||
* Get the sample threshold setting as an integer value.
|
||||
*
|
||||
* This procedure returns the sample threshold setting as an integer
|
||||
* value. See gimp_context_get_sample_threshold().
|
||||
*
|
||||
* Returns: The sample threshold setting.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gint
|
||||
gimp_context_get_sample_threshold_int (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint sample_threshold = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-sample-threshold-int",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
sample_threshold = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return sample_threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_sample_threshold_int:
|
||||
* @sample_threshold: The sample threshold setting.
|
||||
*
|
||||
* Set the sample threshold setting as an integer value.
|
||||
*
|
||||
* This procedure modifies the sample threshold setting as an integer
|
||||
* value. See gimp_context_set_sample_threshold().
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_set_sample_threshold_int (gint sample_threshold)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-sample-threshold-int",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_INT32, sample_threshold,
|
||||
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:
|
||||
*
|
||||
|
|
|
@ -66,6 +66,10 @@ gboolean gimp_context_get_sample_merged (void);
|
|||
gboolean gimp_context_set_sample_merged (gboolean sample_merged);
|
||||
GimpSelectCriterion gimp_context_get_sample_criterion (void);
|
||||
gboolean gimp_context_set_sample_criterion (GimpSelectCriterion sample_criterion);
|
||||
gdouble gimp_context_get_sample_threshold (void);
|
||||
gboolean gimp_context_set_sample_threshold (gdouble sample_threshold);
|
||||
gint gimp_context_get_sample_threshold_int (void);
|
||||
gboolean gimp_context_set_sample_threshold_int (gint sample_threshold);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
|
|
|
@ -955,7 +955,7 @@ CODE
|
|||
}
|
||||
|
||||
sub context_set_sample_criterion {
|
||||
$blurb = 'Set the sample merged setting.';
|
||||
$blurb = 'Set the sample criterion setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure modifies the sample criterion setting. If an operation
|
||||
|
@ -984,6 +984,120 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub context_get_sample_threshold {
|
||||
$blurb = 'Get the sample threshold setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the sample threshold setting.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => 'sample_threshold', type => '0.0 <= float <= 1.0',
|
||||
desc => 'The sample threshold setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_get (context,
|
||||
"sample-threshold", &sample_threshold,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_sample_threshold {
|
||||
$blurb = 'Set the sample threshold setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
|
||||
This procedure modifies the sample threshold setting. If an operation
|
||||
depends on the colors of the pixels present in a drawable, like when
|
||||
doing a seed fill, this setting controls what is "sufficiently close"
|
||||
to be considered a similar color. If the sample threshold has not been
|
||||
set explicitly, the default threshold set in gimprc will be used.
|
||||
This setting affects the following procedures: gimp_image_select_color(),
|
||||
gimp_image_select_fuzzy().
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'sample_threshold', type => '0.0 <= float <= 1.0',
|
||||
desc => 'The sample threshold setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-threshold", sample_threshold,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_sample_threshold_int {
|
||||
$blurb = 'Get the sample threshold setting as an integer value.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the sample threshold setting as an integer value.
|
||||
See gimp_context_get_sample_threshold().
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => 'sample_threshold', type => '0 <= int32 <= 255',
|
||||
desc => 'The sample threshold setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gdouble threshold;
|
||||
|
||||
g_object_get (context,
|
||||
"sample-threshold", &threshold,
|
||||
NULL);
|
||||
|
||||
sample_threshold = (gint) (threshold * 255.99);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_sample_threshold_int {
|
||||
$blurb = 'Set the sample threshold setting as an integer value.';
|
||||
|
||||
$help = <<'HELP';
|
||||
|
||||
This procedure modifies the sample threshold setting as an integer value.
|
||||
See gimp_context_set_sample_threshold().
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'sample_threshold', type => '0 <= int32 <= 255',
|
||||
desc => 'The sample threshold setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-threshold", (gdouble) sample_threshold / 255.0,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_interpolation {
|
||||
$blurb = 'Get the interpolation type.';
|
||||
|
||||
|
@ -1228,6 +1342,8 @@ CODE
|
|||
context_get_feather_radius context_set_feather_radius
|
||||
context_get_sample_merged context_set_sample_merged
|
||||
context_get_sample_criterion context_set_sample_criterion
|
||||
context_get_sample_threshold context_set_sample_threshold
|
||||
context_get_sample_threshold_int context_set_sample_threshold_int
|
||||
context_get_interpolation context_set_interpolation
|
||||
context_get_transform_direction context_set_transform_direction
|
||||
context_get_transform_resize context_set_transform_resize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue