pdb: Add gimp-selection-flood
This commit is contained in:
@ -28,7 +28,7 @@
|
||||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 799 procedures registered total */
|
||||
/* 800 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
@ -421,6 +421,28 @@ selection_shrink_invoker (GimpProcedure *procedure,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
selection_flood_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GimpValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpImage *image;
|
||||
|
||||
image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_channel_flood (gimp_image_get_mask (image), TRUE);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
selection_layer_alpha_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
@ -948,6 +970,29 @@ register_selection_procs (GimpPDB *pdb)
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-selection-flood
|
||||
*/
|
||||
procedure = gimp_procedure_new (selection_flood_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-selection-flood");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-selection-flood",
|
||||
"Flood the image's selection",
|
||||
"This procedure floods the selection. Flooding assigns to each pixel of the selection mask the minimum of the maxima of all paths from that pixel to the outside, as if the selection mask were a height map of a terrain flooded with water.",
|
||||
"Ell",
|
||||
"Ell",
|
||||
"2016",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_image_id ("image",
|
||||
"image",
|
||||
"The image",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-selection-layer-alpha
|
||||
*/
|
||||
|
@ -773,6 +773,7 @@ EXPORTS
|
||||
gimp_selection_combine
|
||||
gimp_selection_feather
|
||||
gimp_selection_float
|
||||
gimp_selection_flood
|
||||
gimp_selection_grow
|
||||
gimp_selection_invert
|
||||
gimp_selection_is_empty
|
||||
|
@ -499,6 +499,40 @@ gimp_selection_shrink (gint32 image_ID,
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_selection_flood:
|
||||
* @image_ID: The image.
|
||||
*
|
||||
* Flood the image's selection
|
||||
*
|
||||
* This procedure floods the selection. Flooding assigns to each pixel
|
||||
* of the selection mask the minimum of the maxima of all paths from
|
||||
* that pixel to the outside, as if the selection mask were a height
|
||||
* map of a terrain flooded with water.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: 2.10
|
||||
**/
|
||||
gboolean
|
||||
gimp_selection_flood (gint32 image_ID)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-selection-flood",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_IMAGE, image_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_selection_layer_alpha:
|
||||
* @layer_ID: Layer with alpha.
|
||||
|
@ -60,6 +60,7 @@ gboolean gimp_selection_grow (gint32 image_ID,
|
||||
gint steps);
|
||||
gboolean gimp_selection_shrink (gint32 image_ID,
|
||||
gint steps);
|
||||
gboolean gimp_selection_flood (gint32 image_ID);
|
||||
GIMP_DEPRECATED_FOR(gimp_image_select_item)
|
||||
gboolean gimp_selection_layer_alpha (gint32 layer_ID);
|
||||
GIMP_DEPRECATED_FOR(gimp_image_select_item)
|
||||
|
@ -423,6 +423,35 @@ CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub selection_flood {
|
||||
$blurb = "Flood the image's selection";
|
||||
|
||||
$help .= <<'HELP';
|
||||
This procedure floods the selection. Flooding assigns to each pixel
|
||||
of the selection mask the minimum of the maxima of all paths from
|
||||
that pixel to the outside, as if the selection mask were a height
|
||||
map of a terrain flooded with water.
|
||||
HELP
|
||||
|
||||
$author = 'Ell';
|
||||
$copyright = 'Ell';
|
||||
$date = '2016';
|
||||
$since = '2.10';
|
||||
|
||||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimp_channel_flood (gimp_image_get_mask (image), TRUE);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub selection_layer_alpha {
|
||||
&std_pdb_deprecated ('gimp-image-select-item');
|
||||
|
||||
@ -534,7 +563,7 @@ CODE
|
||||
selection_translate selection_float
|
||||
selection_invert selection_sharpen selection_all selection_none
|
||||
selection_feather selection_border selection_grow selection_shrink
|
||||
selection_layer_alpha selection_load selection_save
|
||||
selection_flood selection_layer_alpha selection_load selection_save
|
||||
selection_combine);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
Reference in New Issue
Block a user