pdb: add "sample-transparent" as GimpPDBContext property
and add PDB API to get/set it.
This commit is contained in:
@ -953,6 +953,51 @@ context_set_sample_threshold_int_invoker (GimpProcedure *procedure,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_sample_transparent_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
GValueArray *return_vals;
|
||||
gboolean sample_transparent = FALSE;
|
||||
|
||||
g_object_get (context,
|
||||
"sample-transparent", &sample_transparent,
|
||||
NULL);
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
g_value_set_boolean (&return_vals->values[1], sample_transparent);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_set_sample_transparent_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
gboolean sample_transparent;
|
||||
|
||||
sample_transparent = g_value_get_boolean (&args->values[0]);
|
||||
|
||||
if (success)
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-transparent", sample_transparent,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
context_get_interpolation_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
@ -2048,6 +2093,52 @@ register_context_procs (GimpPDB *pdb)
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-sample-transparent
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_get_sample_transparent_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-get-sample-transparent");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-get-sample-transparent",
|
||||
"Get the sample transparent setting.",
|
||||
"This procedure returns the sample transparent setting.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2011",
|
||||
NULL);
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_boolean ("sample-transparent",
|
||||
"sample transparent",
|
||||
"The sample transparent setting",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-set-sample-transparent
|
||||
*/
|
||||
procedure = gimp_procedure_new (context_set_sample_transparent_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-context-set-sample-transparent");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-context-set-sample-transparent",
|
||||
"Set the sample transparent setting.",
|
||||
"This procedure modifies the sample transparent 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 transparency is considered to be a unique selectable color. When this setting is TRUE, transparent areas can be selected or filled. 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-transparent",
|
||||
"sample transparent",
|
||||
"The sample transparent setting",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-context-get-interpolation
|
||||
*/
|
||||
|
@ -44,6 +44,7 @@ enum
|
||||
PROP_SAMPLE_MERGED,
|
||||
PROP_SAMPLE_CRITERION,
|
||||
PROP_SAMPLE_THRESHOLD,
|
||||
PROP_SAMPLE_TRANSPARENT,
|
||||
PROP_INTERPOLATION,
|
||||
PROP_TRANSFORM_DIRECTION,
|
||||
PROP_TRANSFORM_RESIZE,
|
||||
@ -113,6 +114,11 @@ gimp_pdb_context_class_init (GimpPDBContextClass *klass)
|
||||
0.0, 1.0, 0.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAMPLE_TRANSPARENT,
|
||||
"sample-transparent", NULL,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTERPOLATION,
|
||||
"interpolation", NULL,
|
||||
GIMP_TYPE_INTERPOLATION_TYPE,
|
||||
@ -215,6 +221,10 @@ gimp_pdb_context_set_property (GObject *object,
|
||||
options->sample_threshold = g_value_get_double (value);
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_TRANSPARENT:
|
||||
options->sample_transparent = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_INTERPOLATION:
|
||||
options->interpolation = g_value_get_enum (value);
|
||||
break;
|
||||
@ -275,6 +285,10 @@ gimp_pdb_context_get_property (GObject *object,
|
||||
g_value_set_double (value, options->sample_threshold);
|
||||
break;
|
||||
|
||||
case PROP_SAMPLE_TRANSPARENT:
|
||||
g_value_set_boolean (value, options->sample_transparent);
|
||||
break;
|
||||
|
||||
case PROP_INTERPOLATION:
|
||||
g_value_set_enum (value, options->interpolation);
|
||||
break;
|
||||
|
@ -46,6 +46,7 @@ struct _GimpPDBContext
|
||||
gboolean sample_merged;
|
||||
GimpSelectCriterion sample_criterion;
|
||||
gdouble sample_threshold;
|
||||
gboolean sample_transparent;
|
||||
|
||||
GimpInterpolationType interpolation;
|
||||
GimpTransformDirection transform_direction;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 648 procedures registered total */
|
||||
/* 650 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
@ -86,6 +86,7 @@ EXPORTS
|
||||
gimp_context_get_sample_merged
|
||||
gimp_context_get_sample_threshold
|
||||
gimp_context_get_sample_threshold_int
|
||||
gimp_context_get_sample_transparent
|
||||
gimp_context_get_transform_direction
|
||||
gimp_context_get_transform_recursion
|
||||
gimp_context_get_transform_resize
|
||||
@ -111,6 +112,7 @@ EXPORTS
|
||||
gimp_context_set_sample_merged
|
||||
gimp_context_set_sample_threshold
|
||||
gimp_context_set_sample_threshold_int
|
||||
gimp_context_set_sample_transparent
|
||||
gimp_context_set_transform_direction
|
||||
gimp_context_set_transform_recursion
|
||||
gimp_context_set_transform_resize
|
||||
|
@ -1339,6 +1339,73 @@ gimp_context_set_sample_threshold_int (gint sample_threshold)
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_get_sample_transparent:
|
||||
*
|
||||
* Get the sample transparent setting.
|
||||
*
|
||||
* This procedure returns the sample transparent setting.
|
||||
*
|
||||
* Returns: The sample transparent setting.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
gboolean
|
||||
gimp_context_get_sample_transparent (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean sample_transparent = FALSE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-get-sample-transparent",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
sample_transparent = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return sample_transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_context_set_sample_transparent:
|
||||
* @sample_transparent: The sample transparent setting.
|
||||
*
|
||||
* Set the sample transparent setting.
|
||||
*
|
||||
* This procedure modifies the sample transparent 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
|
||||
* transparency is considered to be a unique selectable color. When
|
||||
* this setting is TRUE, transparent areas can be selected or filled.
|
||||
* 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_transparent (gboolean sample_transparent)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-context-set-sample-transparent",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_INT32, sample_transparent,
|
||||
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:
|
||||
*
|
||||
|
@ -70,6 +70,8 @@ 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);
|
||||
gboolean gimp_context_get_sample_transparent (void);
|
||||
gboolean gimp_context_set_sample_transparent (gboolean sample_transparent);
|
||||
GimpInterpolationType gimp_context_get_interpolation (void);
|
||||
gboolean gimp_context_set_interpolation (GimpInterpolationType interpolation);
|
||||
GimpTransformDirection gimp_context_get_transform_direction (void);
|
||||
|
@ -1098,6 +1098,62 @@ CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_sample_transparent {
|
||||
$blurb = 'Get the sample transparent setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the sample transparent setting.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@outargs = (
|
||||
{ name => 'sample_transparent', type => 'boolean',
|
||||
desc => 'The sample transparent setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_get (context,
|
||||
"sample-transparent", &sample_transparent,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_set_sample_transparent {
|
||||
$blurb = 'Set the sample transparent setting.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure modifies the sample transparent 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
|
||||
transparency is considered to be a unique selectable color. When this
|
||||
setting is TRUE, transparent areas can be selected or filled. This
|
||||
setting affects the following procedures: gimp_image_select_color(),
|
||||
gimp_image_select_fuzzy().
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2011', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'sample_transparent', type => 'boolean',
|
||||
desc => 'The sample transparent setting' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
g_object_set (context,
|
||||
"sample-transparent", sample_transparent,
|
||||
NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub context_get_interpolation {
|
||||
$blurb = 'Get the interpolation type.';
|
||||
|
||||
@ -1344,6 +1400,7 @@ CODE
|
||||
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_sample_transparent context_set_sample_transparent
|
||||
context_get_interpolation context_set_interpolation
|
||||
context_get_transform_direction context_set_transform_direction
|
||||
context_get_transform_resize context_set_transform_resize
|
||||
|
Reference in New Issue
Block a user