PIKApp/app/pdb/selection-cmds.c

993 lines
43 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl. */
#include "config.h"
#include "stamp-pdbgen.h"
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libpikamath/pikamath.h"
#include "libpikabase/pikabase.h"
#include "pdb-types.h"
#include "core/pikachannel.h"
#include "core/pikaimage.h"
#include "core/pikalayer.h"
#include "core/pikaparamspecs.h"
#include "core/pikapickable.h"
#include "core/pikaselection.h"
#include "pikapdb.h"
#include "pikapdb-utils.h"
#include "pikaprocedure.h"
#include "internal-procs.h"
#include "pika-intl.h"
static PikaValueArray *
selection_bounds_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaImage *image;
gboolean non_empty = FALSE;
gint x1 = 0;
gint y1 = 0;
gint x2 = 0;
gint y2 = 0;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
gint x, y, w, h;
non_empty = pika_item_bounds (PIKA_ITEM (pika_image_get_mask (image)),
&x, &y, &w, &h);
x1 = x;
y1 = y;
x2 = x + w;
y2 = y + h;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_boolean (pika_value_array_index (return_vals, 1), non_empty);
g_value_set_int (pika_value_array_index (return_vals, 2), x1);
g_value_set_int (pika_value_array_index (return_vals, 3), y1);
g_value_set_int (pika_value_array_index (return_vals, 4), x2);
g_value_set_int (pika_value_array_index (return_vals, 5), y2);
}
return return_vals;
}
static PikaValueArray *
selection_value_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaImage *image;
gint x;
gint y;
gint value = 0;
image = g_value_get_object (pika_value_array_index (args, 0));
x = g_value_get_int (pika_value_array_index (args, 1));
y = g_value_get_int (pika_value_array_index (args, 2));
if (success)
{
gdouble val;
val= pika_pickable_get_opacity_at (PIKA_PICKABLE (pika_image_get_mask (image)),
x, y);
value = ROUND (CLAMP (val, 0.0, 1.0) * 255.0);
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_int (pika_value_array_index (return_vals, 1), value);
return return_vals;
}
static PikaValueArray *
selection_is_empty_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaImage *image;
gboolean is_empty = FALSE;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
is_empty = pika_channel_is_empty (pika_image_get_mask (image));
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_boolean (pika_value_array_index (return_vals, 1), is_empty);
return return_vals;
}
static PikaValueArray *
selection_translate_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
gint offx;
gint offy;
image = g_value_get_object (pika_value_array_index (args, 0));
offx = g_value_get_int (pika_value_array_index (args, 1));
offy = g_value_get_int (pika_value_array_index (args, 2));
if (success)
{
pika_item_translate (PIKA_ITEM (pika_image_get_mask (image)),
offx, offy, TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_float_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
gint num_drawables;
const PikaItem **drawables;
gint offx;
gint offy;
PikaLayer *layer = NULL;
num_drawables = g_value_get_int (pika_value_array_index (args, 0));
drawables = (const PikaItem **) pika_value_get_object_array (pika_value_array_index (args, 1));
offx = g_value_get_int (pika_value_array_index (args, 2));
offy = g_value_get_int (pika_value_array_index (args, 3));
if (success)
{
PikaImage *image = NULL;
gint i;
if (num_drawables < 1)
{
success = FALSE;
}
else
{
for (i = 0; i < num_drawables; i++)
{
if (! pika_pdb_item_is_attached (PIKA_ITEM (drawables[i]), NULL,
PIKA_PDB_ITEM_CONTENT, error) ||
pika_pdb_item_is_group (PIKA_ITEM (drawables[i]), error) ||
(image && image != pika_item_get_image (PIKA_ITEM (drawables[i]))))
{
success = FALSE;
break;
}
else
{
image = pika_item_get_image (PIKA_ITEM (drawables[i]));
}
}
}
if (success)
{
GList *drawable_list = NULL;
for (i = 0; i < num_drawables; i++)
drawable_list = g_list_prepend (drawable_list, (gpointer) drawables[i]);
layer = pika_selection_float (PIKA_SELECTION (pika_image_get_mask (image)),
drawable_list, context, TRUE, offx, offy,
error);
g_list_free (drawable_list);
if (! layer)
success = FALSE;
}
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (pika_value_array_index (return_vals, 1), layer);
return return_vals;
}
static PikaValueArray *
selection_invert_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
pika_channel_invert (pika_image_get_mask (image), TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_sharpen_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
pika_channel_sharpen (pika_image_get_mask (image), TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_all_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
pika_channel_all (pika_image_get_mask (image), TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_none_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
pika_channel_clear (pika_image_get_mask (image), NULL, TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_feather_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
gdouble radius;
image = g_value_get_object (pika_value_array_index (args, 0));
radius = g_value_get_double (pika_value_array_index (args, 1));
if (success)
{
/* FIXME: "edge-lock" hardcoded to TRUE */
pika_channel_feather (pika_image_get_mask (image),
radius, radius, TRUE, TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_border_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
gint radius;
image = g_value_get_object (pika_value_array_index (args, 0));
radius = g_value_get_int (pika_value_array_index (args, 1));
if (success)
{
/* FIXME: "style" and "edge-lock" hardcoded to SMOOTH and TRUE, respectively. */
pika_channel_border (pika_image_get_mask (image),
radius, radius,
PIKA_CHANNEL_BORDER_STYLE_SMOOTH,
TRUE, TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_grow_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
gint steps;
image = g_value_get_object (pika_value_array_index (args, 0));
steps = g_value_get_int (pika_value_array_index (args, 1));
if (success)
{
pika_channel_grow (pika_image_get_mask (image),
steps, steps, TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_shrink_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
gint steps;
image = g_value_get_object (pika_value_array_index (args, 0));
steps = g_value_get_int (pika_value_array_index (args, 1));
if (success)
{
pika_channel_shrink (pika_image_get_mask (image),
steps, steps, FALSE, TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_flood_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaImage *image;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
pika_channel_flood (pika_image_get_mask (image), TRUE);
}
return pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static PikaValueArray *
selection_save_invoker (PikaProcedure *procedure,
Pika *pika,
PikaContext *context,
PikaProgress *progress,
const PikaValueArray *args,
GError **error)
{
gboolean success = TRUE;
PikaValueArray *return_vals;
PikaImage *image;
PikaChannel *channel = NULL;
image = g_value_get_object (pika_value_array_index (args, 0));
if (success)
{
channel = PIKA_CHANNEL (pika_item_duplicate (PIKA_ITEM (pika_image_get_mask (image)),
PIKA_TYPE_CHANNEL));
if (channel)
{
/* saved selections are not visible by default */
pika_item_set_visible (PIKA_ITEM (channel), FALSE, FALSE);
pika_image_add_channel (image, channel,
PIKA_IMAGE_ACTIVE_PARENT, -1, TRUE);
}
else
success = FALSE;
}
return_vals = pika_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_set_object (pika_value_array_index (return_vals, 1), channel);
return return_vals;
}
void
register_selection_procs (PikaPDB *pdb)
{
PikaProcedure *procedure;
/*
* pika-selection-bounds
*/
procedure = pika_procedure_new (selection_bounds_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-bounds");
pika_procedure_set_static_help (procedure,
"Find the bounding box of the current selection.",
"This procedure returns whether there is a selection for the specified image. If there is one, the upper left and lower right corners of the bounding box are returned. These coordinates are relative to the image. Please note that the pixel specified by the lower right coordinate of the bounding box is not part of the selection. The selection ends at the upper left corner of this pixel. This means the width of the selection can be calculated as (x2 - x1), its height as (y2 - y1).",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("non-empty",
"non empty",
"TRUE if there is a selection",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("x1",
"x1",
"x coordinate of upper left corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("y1",
"y1",
"y coordinate of upper left corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("x2",
"x2",
"x coordinate of lower right corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("y2",
"y2",
"y coordinate of lower right corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-value
*/
procedure = pika_procedure_new (selection_value_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-value");
pika_procedure_set_static_help (procedure,
"Find the value of the selection at the specified coordinates.",
"This procedure returns the value of the selection at the specified coordinates. If the coordinates lie out of bounds, 0 is returned.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("x",
"x",
"x coordinate of value",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("y",
"y",
"y coordinate of value",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_int ("value",
"value",
"Value of the selection",
0, 255, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-is-empty
*/
procedure = pika_procedure_new (selection_is_empty_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-is-empty");
pika_procedure_set_static_help (procedure,
"Determine whether the selection is empty.",
"This procedure returns TRUE if the selection for the specified image is empty.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
g_param_spec_boolean ("is-empty",
"is empty",
"Is the selection empty?",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-translate
*/
procedure = pika_procedure_new (selection_translate_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-translate");
pika_procedure_set_static_help (procedure,
"Translate the selection by the specified offsets.",
"This procedure actually translates the selection for the specified image by the specified offsets. Regions that are translated from beyond the bounds of the image are set to empty. Valid regions of the selection which are translated beyond the bounds of the image because of this call are lost.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("offx",
"offx",
"x offset for translation",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("offy",
"offy",
"y offset for translation",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-float
*/
procedure = pika_procedure_new (selection_float_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-float");
pika_procedure_set_static_help (procedure,
"Float the selection from the specified drawable with initial offsets as specified.",
"This procedure determines the region of the specified drawable that lies beneath the current selection. The region is then cut from the drawable and the resulting data is made into a new layer which is instantiated as a floating selection. The offsets allow initial positioning of the new floating selection.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
g_param_spec_int ("num-drawables",
"num drawables",
"The number of drawables",
1, G_MAXINT32, 1,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
pika_param_spec_object_array ("drawables",
"drawables",
"The drawables from which to float selection",
PIKA_TYPE_ITEM,
PIKA_PARAM_READWRITE | PIKA_PARAM_NO_VALIDATE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("offx",
"offx",
"x offset for translation",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("offy",
"offy",
"y offset for translation",
G_MININT32, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_layer ("layer",
"layer",
"The floated layer",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-invert
*/
procedure = pika_procedure_new (selection_invert_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-invert");
pika_procedure_set_static_help (procedure,
"Invert the selection mask.",
"This procedure inverts the selection mask. For every pixel in the selection channel, its new value is calculated as (255 - old-value).",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-sharpen
*/
procedure = pika_procedure_new (selection_sharpen_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-sharpen");
pika_procedure_set_static_help (procedure,
"Sharpen the selection mask.",
"This procedure sharpens the selection mask. For every pixel in the selection channel, if the value is > 127, the new pixel is assigned a value of 255. This removes any \"anti-aliasing\" that might exist in the selection mask's boundary.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-all
*/
procedure = pika_procedure_new (selection_all_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-all");
pika_procedure_set_static_help (procedure,
"Select all of the image.",
"This procedure sets the selection mask to completely encompass the image. Every pixel in the selection channel is set to 255.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-none
*/
procedure = pika_procedure_new (selection_none_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-none");
pika_procedure_set_static_help (procedure,
"Deselect the entire image.",
"This procedure deselects the entire image. Every pixel in the selection channel is set to 0.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-feather
*/
procedure = pika_procedure_new (selection_feather_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-feather");
pika_procedure_set_static_help (procedure,
"Feather the image's selection",
"This procedure feathers the selection. Feathering is implemented using a gaussian blur.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_double ("radius",
"radius",
"Radius of feather (in pixels)",
0, G_MAXDOUBLE, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-border
*/
procedure = pika_procedure_new (selection_border_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-border");
pika_procedure_set_static_help (procedure,
"Border the image's selection",
"This procedure borders the selection. Bordering creates a new selection which is defined along the boundary of the previous selection at every point within the specified radius.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("radius",
"radius",
"Radius of border (in pixels)",
0, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-grow
*/
procedure = pika_procedure_new (selection_grow_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-grow");
pika_procedure_set_static_help (procedure,
"Grow the image's selection",
"This procedure grows the selection. Growing involves expanding the boundary in all directions by the specified pixel amount.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("steps",
"steps",
"Steps of grow (in pixels)",
0, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-shrink
*/
procedure = pika_procedure_new (selection_shrink_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-shrink");
pika_procedure_set_static_help (procedure,
"Shrink the image's selection",
"This procedure shrinks the selection. Shrinking involves trimming the existing selection boundary on all sides by the specified number of pixels.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_argument (procedure,
g_param_spec_int ("steps",
"steps",
"Steps of shrink (in pixels)",
0, G_MAXINT32, 0,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-flood
*/
procedure = pika_procedure_new (selection_flood_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-flood");
pika_procedure_set_static_help (procedure,
"Remove holes from the image's selection",
"This procedure removes holes from the selection, that can come from selecting a patchy area with the Fuzzy Select Tool. In technical terms this procedure floods the selection. See the Algorithms page in the developer wiki for details.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Ell",
"Ell",
"2016");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* pika-selection-save
*/
procedure = pika_procedure_new (selection_save_invoker);
pika_object_set_static_name (PIKA_OBJECT (procedure),
"pika-selection-save");
pika_procedure_set_static_help (procedure,
"Copy the selection mask to a new channel.",
"This procedure copies the selection mask and stores the content in a new channel. The new channel is automatically inserted into the image's list of channels.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996");
pika_procedure_add_argument (procedure,
pika_param_spec_image ("image",
"image",
"The image",
FALSE,
PIKA_PARAM_READWRITE));
pika_procedure_add_return_value (procedure,
pika_param_spec_channel ("channel",
"channel",
"The new channel",
FALSE,
PIKA_PARAM_READWRITE));
pika_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}