mirror of https://github.com/GNOME/gimp.git
plug-ins, pdb: remove the edge-dog plug-in and add a PDB compat procedure
This is not for 2.10 because the result of the GEGL op looks different, but without doubt more correct.
This commit is contained in:
parent
798d5571e1
commit
a0ae31d337
|
@ -28,7 +28,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 739 procedures registered total */
|
||||
/* 740 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -1440,6 +1440,85 @@ plug_in_displace_polar_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
plug_in_dog_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GimpValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
gdouble inner;
|
||||
gdouble outer;
|
||||
gboolean normalize;
|
||||
gboolean invert;
|
||||
|
||||
image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
|
||||
drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
|
||||
inner = g_value_get_double (gimp_value_array_index (args, 3));
|
||||
outer = g_value_get_double (gimp_value_array_index (args, 4));
|
||||
normalize = g_value_get_boolean (gimp_value_array_index (args, 5));
|
||||
invert = g_value_get_boolean (gimp_value_array_index (args, 6));
|
||||
|
||||
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;
|
||||
|
||||
if (normalize || invert)
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC,
|
||||
C_("undo-type", "DoG Edge Detect"));
|
||||
|
||||
node = gegl_node_new_child (NULL,
|
||||
"operation", "gegl:difference-of-gaussians",
|
||||
"radius1", inner * 0.32,
|
||||
"radius2", outer * 0.32,
|
||||
NULL);
|
||||
|
||||
node = wrap_in_gamma_cast (node, drawable);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "DoG Edge Detect"),
|
||||
node);
|
||||
g_object_unref (node);
|
||||
|
||||
if (normalize)
|
||||
{
|
||||
node = gegl_node_new_child (NULL,
|
||||
"operation", "gegl:stretch-contrast",
|
||||
"keep-colors", TRUE,
|
||||
"perceptual", TRUE,
|
||||
NULL);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "Normalize"),
|
||||
node);
|
||||
g_object_unref (node);
|
||||
}
|
||||
|
||||
if (invert)
|
||||
gimp_drawable_apply_operation_by_name (drawable, progress,
|
||||
C_("undo-type", "Invert"),
|
||||
"gegl:invert-gamma",
|
||||
NULL);
|
||||
|
||||
if (normalize || invert)
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GimpValueArray *
|
||||
plug_in_edge_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -5589,6 +5668,66 @@ register_plug_in_compat_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-plug-in-dog
|
||||
*/
|
||||
procedure = gimp_procedure_new (plug_in_dog_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"plug-in-dog");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"plug-in-dog",
|
||||
"Edge detection with control of edge thickness",
|
||||
"Applies two Gaussian blurs to the drawable, and subtracts the results. This is robust and widely used method for detecting edges.",
|
||||
"Compatibility procedure. Please see 'gegl:difference-of-gaussians' for credits.",
|
||||
"Compatibility procedure. Please see 'gegl:difference-of-gaussians' 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 ("inner",
|
||||
"inner",
|
||||
"Radius of inner gaussian blur in pixels",
|
||||
0.0, 10.0, 0.0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_double ("outer",
|
||||
"outer",
|
||||
"Radius of outer gaussian blur in pixels",
|
||||
0.0, 10.0, 0.0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("normalize",
|
||||
"normalize",
|
||||
"Normalize",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_boolean ("invert",
|
||||
"invert",
|
||||
"Invert",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-plug-in-edge
|
||||
*/
|
||||
|
|
|
@ -1255,6 +1255,90 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub plug_in_dog {
|
||||
$blurb = 'Edge detection with control of edge thickness';
|
||||
|
||||
$help = <<'HELP';
|
||||
Applies two Gaussian blurs to the drawable, and subtracts the results.
|
||||
This is robust and widely used method for detecting edges.
|
||||
HELP
|
||||
|
||||
&std_pdb_compat('gegl:difference-of-gaussians');
|
||||
$date = '2015';
|
||||
|
||||
@inargs = (
|
||||
{ name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
|
||||
desc => 'The run mode' },
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'Input image (unused)' },
|
||||
{ name => 'drawable', type => 'drawable',
|
||||
desc => 'Input drawable' },
|
||||
{ name => 'inner', type => '0.0 <= float <= 10.0',
|
||||
desc => 'Radius of inner gaussian blur in pixels' },
|
||||
{ name => 'outer', type => '0.0 <= float <= 10.0',
|
||||
desc => 'Radius of outer gaussian blur in pixels' },
|
||||
{ name => 'normalize', type => 'boolean',
|
||||
desc => 'Normalize' },
|
||||
{ name => 'invert', type => 'boolean',
|
||||
desc => 'Invert' }
|
||||
);
|
||||
|
||||
%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;
|
||||
|
||||
if (normalize || invert)
|
||||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_MISC,
|
||||
C_("undo-type", "DoG Edge Detect"));
|
||||
|
||||
node = gegl_node_new_child (NULL,
|
||||
"operation", "gegl:difference-of-gaussians",
|
||||
"radius1", inner * 0.32,
|
||||
"radius2", outer * 0.32,
|
||||
NULL);
|
||||
|
||||
node = wrap_in_gamma_cast (node, drawable);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "DoG Edge Detect"),
|
||||
node);
|
||||
g_object_unref (node);
|
||||
|
||||
if (normalize)
|
||||
{
|
||||
node = gegl_node_new_child (NULL,
|
||||
"operation", "gegl:stretch-contrast",
|
||||
"keep-colors", TRUE,
|
||||
"perceptual", TRUE,
|
||||
NULL);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, progress,
|
||||
C_("undo-type", "Normalize"),
|
||||
node);
|
||||
g_object_unref (node);
|
||||
}
|
||||
|
||||
if (invert)
|
||||
gimp_drawable_apply_operation_by_name (drawable, progress,
|
||||
C_("undo-type", "Invert"),
|
||||
"gegl:invert-gamma",
|
||||
NULL);
|
||||
|
||||
if (normalize || invert)
|
||||
gimp_image_undo_group_end (image);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub plug_in_edge {
|
||||
$blurb = 'Several simple methods for detecting edges';
|
||||
|
||||
|
@ -4980,6 +5064,7 @@ CODE
|
|||
plug_in_diffraction
|
||||
plug_in_displace
|
||||
plug_in_displace_polar
|
||||
plug_in_dog
|
||||
plug_in_edge
|
||||
plug_in_engrave
|
||||
plug_in_exchange
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
/despeckle.exe
|
||||
/destripe
|
||||
/destripe.exe
|
||||
/edge-dog
|
||||
/edge-dog.exe
|
||||
/emboss
|
||||
/emboss.exe
|
||||
/file-aa
|
||||
|
|
|
@ -65,7 +65,6 @@ decompose_libexecdir = $(gimpplugindir)/plug-ins/decompose
|
|||
depth_merge_libexecdir = $(gimpplugindir)/plug-ins/depth-merge
|
||||
despeckle_libexecdir = $(gimpplugindir)/plug-ins/despeckle
|
||||
destripe_libexecdir = $(gimpplugindir)/plug-ins/destripe
|
||||
edge_dog_libexecdir = $(gimpplugindir)/plug-ins/edge-dog
|
||||
emboss_libexecdir = $(gimpplugindir)/plug-ins/emboss
|
||||
file_aa_libexecdir = $(gimpplugindir)/plug-ins/file-aa
|
||||
file_cel_libexecdir = $(gimpplugindir)/plug-ins/file-cel
|
||||
|
@ -153,7 +152,6 @@ decompose_libexec_PROGRAMS = decompose
|
|||
depth_merge_libexec_PROGRAMS = depth-merge
|
||||
despeckle_libexec_PROGRAMS = despeckle
|
||||
destripe_libexec_PROGRAMS = destripe
|
||||
edge_dog_libexec_PROGRAMS = edge-dog
|
||||
emboss_libexec_PROGRAMS = emboss
|
||||
file_aa_libexec_PROGRAMS = $(FILE_AA)
|
||||
file_cel_libexec_PROGRAMS = file-cel
|
||||
|
@ -577,23 +575,6 @@ destripe_LDADD = \
|
|||
$(INTLLIBS) \
|
||||
$(destripe_RC)
|
||||
|
||||
edge_dog_SOURCES = \
|
||||
edge-dog.c
|
||||
|
||||
edge_dog_LDADD = \
|
||||
$(libgimpui) \
|
||||
$(libgimpwidgets) \
|
||||
$(libgimpmodule) \
|
||||
$(libgimp) \
|
||||
$(libgimpmath) \
|
||||
$(libgimpconfig) \
|
||||
$(libgimpcolor) \
|
||||
$(libgimpbase) \
|
||||
$(GTK_LIBS) \
|
||||
$(RT_LIBS) \
|
||||
$(INTLLIBS) \
|
||||
$(edge_dog_RC)
|
||||
|
||||
emboss_SOURCES = \
|
||||
emboss.c
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,6 @@ decompose_RC = decompose.rc.o
|
|||
depth_merge_RC = depth-merge.rc.o
|
||||
despeckle_RC = despeckle.rc.o
|
||||
destripe_RC = destripe.rc.o
|
||||
edge_dog_RC = edge-dog.rc.o
|
||||
emboss_RC = emboss.rc.o
|
||||
file_aa_RC = file-aa.rc.o
|
||||
file_cel_RC = file-cel.rc.o
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
'depth-merge' => { ui => 1 },
|
||||
'despeckle' => { ui => 1, gegl => 1 },
|
||||
'destripe' => { ui => 1, gegl => 1 },
|
||||
'edge-dog' => { ui => 1 },
|
||||
'emboss' => { ui => 1 },
|
||||
'file-aa' => { ui => 1, gegl => 1, optional => 1, libs => 'AA_LIBS' },
|
||||
'file-cel' => { ui => 1, gegl => 1 },
|
||||
|
|
|
@ -23,7 +23,6 @@ plug-ins/common/decompose.c
|
|||
plug-ins/common/depth-merge.c
|
||||
plug-ins/common/despeckle.c
|
||||
plug-ins/common/destripe.c
|
||||
plug-ins/common/edge-dog.c
|
||||
plug-ins/common/emboss.c
|
||||
plug-ins/common/file-aa.c
|
||||
plug-ins/common/file-cel.c
|
||||
|
|
Loading…
Reference in New Issue