mirror of https://github.com/GNOME/gimp.git
app, pdb, plug-ins: replace (plug-in-edge).
For plug-in writers reference: - (plug-in-edge RUN-NONINTERACTIVE image layer 2 1 0) + (gimp-drawable-merge-new-filter layer "gegl:edge" 0 LAYER-MODE-REPLACE opacity "amount" 2.0 "border-behavior" "loop" "algorithm" "sobel") The warpmode (before-last) arg has to be replaced like this (types from GeglAbyssPolicy enum type): * NONE (0) -> "none" * WRAP (1) -> "loop" * SMEAR (2) -> "clamp" * BLACK (3) -> "black" For edgemode (last arg), just use the name value in lowercase as string: { SOBEL (0), PREWITT (1), GRADIENT (2), ROBERTS (3), DIFFERENTIAL (4), LAPLACE (5) } E.g. "differencial" instead of formerly 4.
This commit is contained in:
parent
4cc50c6701
commit
7e81bdfa14
|
@ -30,7 +30,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 732 procedures registered total */
|
||||
/* 731 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -658,73 +658,6 @@ plug_in_displace_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
plug_in_edge_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GimpValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpDrawable *drawable;
|
||||
gdouble amount;
|
||||
gint warpmode;
|
||||
gint edgemode;
|
||||
|
||||
drawable = g_value_get_object (gimp_value_array_index (args, 2));
|
||||
amount = g_value_get_double (gimp_value_array_index (args, 3));
|
||||
warpmode = g_value_get_int (gimp_value_array_index (args, 4));
|
||||
edgemode = g_value_get_int (gimp_value_array_index (args, 5));
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
||||
GIMP_PDB_ITEM_CONTENT, error) &&
|
||||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GeglNode *node;
|
||||
GeglAbyssPolicy border_behavior = GEGL_ABYSS_NONE;
|
||||
|
||||
switch (warpmode)
|
||||
{
|
||||
case 0:
|
||||
border_behavior = GEGL_ABYSS_NONE;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
border_behavior = GEGL_ABYSS_LOOP;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
border_behavior = GEGL_ABYSS_CLAMP;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
border_behavior = GEGL_ABYSS_BLACK;
|
||||
break;
|
||||
}
|
||||
|
||||
node = gegl_node_new_child (NULL,
|
||||
"operation", "gegl:edge",
|
||||
"algorithm", edgemode,
|
||||
"amount", amount,
|
||||
"border-behavior", border_behavior,
|
||||
NULL);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "Edge"),
|
||||
node);
|
||||
g_object_unref (node);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
plug_in_emboss_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -1553,60 +1486,6 @@ register_plug_in_compat_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-plug-in-edge
|
||||
*/
|
||||
procedure = gimp_procedure_new (plug_in_edge_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"plug-in-edge");
|
||||
gimp_procedure_set_static_help (procedure,
|
||||
"Several simple methods for detecting edges",
|
||||
"Perform edge detection on the contents of the specified drawable. AMOUNT is an arbitrary constant, WRAPMODE is like displace plug-in (useful for tileable image). EDGEMODE sets the kind of matrix transform applied to the pixels, SOBEL was the method used in older versions.",
|
||||
NULL);
|
||||
gimp_procedure_set_static_attribution (procedure,
|
||||
"Compatibility procedure. Please see 'gegl:edge' for credits.",
|
||||
"Compatibility procedure. Please see 'gegl:edge' for credits.",
|
||||
"2015");
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_enum ("run-mode",
|
||||
"run mode",
|
||||
"The run mode",
|
||||
GIMP_TYPE_RUN_MODE,
|
||||
GIMP_RUN_INTERACTIVE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_image ("image",
|
||||
"image",
|
||||
"Input image (unused)",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_drawable ("drawable",
|
||||
"drawable",
|
||||
"Input drawable",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("amount",
|
||||
"amount",
|
||||
"Edge detection amount",
|
||||
1.0, 10.0, 1.0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_int ("warpmode",
|
||||
"warpmode",
|
||||
"Edge detection behavior { NONE (0), WRAP (1), SMEAR (2), BLACK (3) }",
|
||||
0, 3, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_int ("edgemode",
|
||||
"edgemode",
|
||||
"Edge detection algorithm { SOBEL (0), PREWITT (1), GRADIENT (2), ROBERTS (3), DIFFERENTIAL (4), LAPLACE (5) }",
|
||||
0, 5, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-plug-in-emboss
|
||||
*/
|
||||
|
|
|
@ -279,82 +279,6 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub plug_in_edge {
|
||||
$blurb = 'Several simple methods for detecting edges';
|
||||
|
||||
$help = <<'HELP';
|
||||
Perform edge detection on the contents of the specified drawable.
|
||||
AMOUNT is an arbitrary constant, WRAPMODE is like displace plug-in
|
||||
(useful for tileable image). EDGEMODE sets the kind of matrix transform
|
||||
applied to the pixels, SOBEL was the method used in older versions.
|
||||
HELP
|
||||
|
||||
&std_pdb_compat('gegl:edge');
|
||||
$date = '2015';
|
||||
|
||||
@inargs = (
|
||||
{ name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
|
||||
desc => 'The run mode' },
|
||||
{ name => 'image', type => 'image', dead => 1,
|
||||
desc => 'Input image (unused)' },
|
||||
{ name => 'drawable', type => 'drawable',
|
||||
desc => 'Input drawable' },
|
||||
{ name => 'amount', type => '1.0 <= double <= 10.0',
|
||||
desc => 'Edge detection amount' },
|
||||
{ name => 'warpmode', type => '0 <= int32 <= 3',
|
||||
desc => 'Edge detection behavior { NONE (0), WRAP (1), SMEAR (2), BLACK (3) }' },
|
||||
{ name => 'edgemode', type => '0 <= int32 <= 5',
|
||||
desc => 'Edge detection algorithm { SOBEL (0), PREWITT (1), GRADIENT (2), ROBERTS (3), DIFFERENTIAL (4), LAPLACE (5) }' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
|
||||
GIMP_PDB_ITEM_CONTENT, error) &&
|
||||
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
|
||||
{
|
||||
GeglNode *node;
|
||||
GeglAbyssPolicy border_behavior = GEGL_ABYSS_NONE;
|
||||
|
||||
switch (warpmode)
|
||||
{
|
||||
case 0:
|
||||
border_behavior = GEGL_ABYSS_NONE;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
border_behavior = GEGL_ABYSS_LOOP;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
border_behavior = GEGL_ABYSS_CLAMP;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
border_behavior = GEGL_ABYSS_BLACK;
|
||||
break;
|
||||
}
|
||||
|
||||
node = gegl_node_new_child (NULL,
|
||||
"operation", "gegl:edge",
|
||||
"algorithm", edgemode,
|
||||
"amount", amount,
|
||||
"border-behavior", border_behavior,
|
||||
NULL);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "Edge"),
|
||||
node);
|
||||
g_object_unref (node);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub plug_in_emboss {
|
||||
$blurb = 'Simulate an image created by embossing';
|
||||
|
||||
|
@ -1404,7 +1328,6 @@ CODE
|
|||
plug_in_autocrop_layer
|
||||
plug_in_bump_map
|
||||
plug_in_displace
|
||||
plug_in_edge
|
||||
plug_in_emboss
|
||||
plug_in_gauss
|
||||
plug_in_maze
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
(gimp-image-select-item image CHANNEL-OP-REPLACE active-selection)
|
||||
(plug-in-maze RUN-NONINTERACTIVE image active-layer 5 5 TRUE 0 seed 57 1)
|
||||
(plug-in-oilify RUN-NONINTERACTIVE image active-layer mask-size 0)
|
||||
(plug-in-edge RUN-NONINTERACTIVE image active-layer 2 1 0)
|
||||
(gimp-drawable-merge-new-filter active-layer "gegl:edge" 0 LAYER-MODE-REPLACE 1.0 "amount" 2.0 "border-behavior" "loop" "algorithm" "sobel")
|
||||
(if (= type RGBA-IMAGE)
|
||||
(gimp-drawable-desaturate active-layer DESATURATE-LIGHTNESS))
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
(plug-in-solid-noise RUN-NONINTERACTIVE image active-layer FALSE TRUE seed 2 2 2)
|
||||
(gimp-drawable-merge-new-filter active-layer "gegl:cubism" 0 LAYER-MODE-REPLACE 1.0 "tile-size" tile_size "tile-saturation" 2.5 "bg-color" '(0 0 0))
|
||||
(plug-in-oilify RUN-NONINTERACTIVE image active-layer mask_size 0)
|
||||
(plug-in-edge RUN-NONINTERACTIVE image active-layer 2 0 0)
|
||||
(gimp-drawable-merge-new-filter active-layer "gegl:edge" 0 LAYER-MODE-REPLACE 1.0 "amount" 2.0 "border-behavior" "none" "algorithm" "sobel")
|
||||
(plug-in-gauss RUN-NONINTERACTIVE image active-layer 0.64 0.64 0)
|
||||
(plug-in-gradmap RUN-NONINTERACTIVE image selected-layers-array)
|
||||
|
||||
|
|
Loading…
Reference in New Issue