[gimp] plug-ins,pdb: Add a compatibility wrapper for edge-laplace
- From: Téo Mazars <teom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins,pdb: Add a compatibility wrapper for edge-laplace
- Date: Tue, 1 Oct 2013 15:11:40 +0000 (UTC)
commit e1fe2e35cb315bcef5ec6ac903b9f920033d7e94
Author: Téo Mazars <teo mazars ensimag fr>
Date: Tue Oct 1 17:09:14 2013 +0200
plug-ins,pdb: Add a compatibility wrapper for edge-laplace
... and remove the old plug-in
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 73 +++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 16 --
plug-ins/common/edge-laplace.c | 380 -----------------------------------
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 49 +++++
9 files changed, 123 insertions(+), 402 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 439eda1..2a26826 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 699 procedures registered total */
+/* 700 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 32e7e3a..732ba50 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -434,6 +434,43 @@ plug_in_cubism_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_laplace_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+ 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 =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:edge-laplace",
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Laplace"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_hsv_noise_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1902,6 +1939,42 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-laplace
+ */
+ procedure = gimp_procedure_new (plug_in_laplace_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-laplace");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-laplace",
+ "High-resolution edge detection",
+ "This plugin creates one-pixel wide edges from the image, with the
value proportional to the gradient. It uses the Laplace operator (a 3x3 kernel with -8 in the middle). The
image has to be laplacered to get useful results, a gauss_iir with 1.5 - 5.0 depending on the noise in the
image is best.",
+ "Compatibility procedure. Please see 'gegl:edge-laplace' for credits.",
+ "Compatibility procedure. Please see 'gegl:edge-laplace' for credits.",
+ "2013",
+ 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_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-hsv-noise
*/
procedure = gimp_procedure_new (plug_in_hsv_noise_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 16da47b..2ab2824 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -72,8 +72,6 @@
/edge.exe
/edge-dog
/edge-dog.exe
-/edge-laplace
-/edge-laplace.exe
/edge-neon
/edge-neon.exe
/edge-sobel
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 8ebe9b2..1094d3a 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -79,7 +79,6 @@ libexec_PROGRAMS = \
displace \
edge \
edge-dog \
- edge-laplace \
edge-neon \
edge-sobel \
emboss \
@@ -791,21 +790,6 @@ edge_dog_LDADD = \
$(INTLLIBS) \
$(edge_dog_RC)
-edge_laplace_SOURCES = \
- edge-laplace.c
-
-edge_laplace_LDADD = \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(CAIRO_LIBS) \
- $(GDK_PIXBUF_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(edge_laplace_RC)
-
edge_neon_SOURCES = \
edge-neon.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 5904c1b..39b7fb1 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -33,7 +33,6 @@ diffraction_RC = diffraction.rc.o
displace_RC = displace.rc.o
edge_RC = edge.rc.o
edge_dog_RC = edge-dog.rc.o
-edge_laplace_RC = edge-laplace.rc.o
edge_neon_RC = edge-neon.rc.o
edge_sobel_RC = edge-sobel.rc.o
emboss_RC = emboss.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 03fc2da..100e8c0 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -34,7 +34,6 @@
'displace' => { ui => 1 },
'edge' => { ui => 1 },
'edge-dog' => { ui => 1 },
- 'edge-laplace' => {},
'edge-neon' => { ui => 1 },
'edge-sobel' => { ui => 1 },
'emboss' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 15e6637..058f53b 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -41,7 +41,6 @@ plug-ins/common/diffraction.c
plug-ins/common/displace.c
plug-ins/common/edge.c
plug-ins/common/edge-dog.c
-plug-ins/common/edge-laplace.c
plug-ins/common/edge-neon.c
plug-ins/common/edge-sobel.c
plug-ins/common/emboss.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 2bead1d..4a63d83 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -437,6 +437,54 @@ CODE
);
}
+sub plug_in_laplace {
+ $blurb = 'High-resolution edge detection';
+
+ $help = <<'HELP';
+This plugin creates one-pixel wide edges from the
+image, with the value proportional to the gradient.
+It uses the Laplace operator (a 3x3 kernel with -8
+in the middle). The image has to be laplacered to
+get useful results, a gauss_iir with 1.5 - 5.0
+depending on the noise in the image is best.
+HELP
+
+ &std_pdb_compat('gegl:edge-laplace');
+ $date = '2013';
+
+ @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' }
+ );
+
+ %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 =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:edge-laplace",
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Laplace"),
+ node);
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_hsv_noise {
$blurb = 'Randomize hue, saturation and value independently';
@@ -1676,6 +1724,7 @@ CODE
plug_in_colors_channel_mixer
plug_in_colortoalpha
plug_in_cubism
+ plug_in_laplace
plug_in_hsv_noise
plug_in_mblur
plug_in_mblur_inward
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]