Commit 573f0f69 authored by Michael Natterer's avatar Michael Natterer

plug-ins, pdb: remove the edge plug-in and add a PDB compat procedure

parent e44e7382
......@@ -28,7 +28,7 @@
#include "internal-procs.h"
/* 753 procedures registered total */
/* 754 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
......
......@@ -1032,6 +1032,69 @@ plug_in_diffraction_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;
gint32 warpmode;
gint32 edgemode;
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
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 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",
"algorihm", 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_engrave_invoker (GimpProcedure *procedure,
Gimp *gimp,
......@@ -4136,6 +4199,60 @@ 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_strings (procedure,
"plug-in-edge",
"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 tilable image). EDGEMODE sets the kind of matrix transform applied to the pixels, SOBEL was the method used in older versions.",
"Compatibility procedure. Please see 'gegl:edge' for credits.",
"Compatibility procedure. Please see 'gegl:edge' for credits.",
"2015",
NULL);
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_id ("image",
"image",
"Input image (unused)",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_drawable_id ("drawable",
"drawable",
"Input drawable",
pdb->gimp, 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,
gimp_param_spec_int32 ("warpmode",
"warpmode",
"Edge detection behavior { WRAP (1), SMEAR (2), BLACK (3) }",
1, 3, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_int32 ("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-engrave
*/
......
......@@ -52,8 +52,6 @@
/destripe.exe
/displace
/displace.exe
/edge
/edge.exe
/edge-dog
/edge-dog.exe
/edge-neon
......
......@@ -69,7 +69,6 @@ libexec_PROGRAMS = \
despeckle \
destripe \
displace \
edge \
edge-dog \
edge-neon \
emboss \
......@@ -602,23 +601,6 @@ displace_LDADD = \
$(INTLLIBS) \
$(displace_RC)
edge_SOURCES = \
edge.c
edge_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpmodule) \
$(libgimp) \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS) \
$(edge_RC)
edge_dog_SOURCES = \
edge-dog.c
......
This diff is collapsed.
......@@ -23,7 +23,6 @@ depth_merge_RC = depth-merge.rc.o
despeckle_RC = despeckle.rc.o
destripe_RC = destripe.rc.o
displace_RC = displace.rc.o
edge_RC = edge.rc.o
edge_dog_RC = edge-dog.rc.o
edge_neon_RC = edge-neon.rc.o
emboss_RC = emboss.rc.o
......
......@@ -24,7 +24,6 @@
'despeckle' => { ui => 1 },
'destripe' => { ui => 1 },
'displace' => { ui => 1 },
'edge' => { ui => 1 },
'edge-dog' => { ui => 1 },
'edge-neon' => { ui => 1 },
'emboss' => { ui => 1 },
......
......@@ -28,7 +28,6 @@ plug-ins/common/depth-merge.c
plug-ins/common/despeckle.c
plug-ins/common/destripe.c
plug-ins/common/displace.c
plug-ins/common/edge.c
plug-ins/common/edge-dog.c
plug-ins/common/edge-neon.c
plug-ins/common/emboss.c
......
......@@ -942,6 +942,78 @@ 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 tilable 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 <= float <= 10.0',
desc => 'Edge detection amount' },
{ name => 'warpmode', type => '1 <= int32 <= 3',
desc => 'Edge detection behavior { 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 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",
"algorihm", 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_engrave {
$blurb = 'Simulate an antique engraving';
......@@ -3761,6 +3833,7 @@ CODE
plug_in_cubism
plug_in_deinterlace
plug_in_diffraction
plug_in_edge
plug_in_engrave
plug_in_exchange
plug_in_flarefx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment