[gimp] plug-ins, pdb: remove plugin waves and add a PDB compat procedure
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove plugin waves and add a PDB compat procedure
- Date: Sat, 1 Jun 2013 14:05:59 +0000 (UTC)
commit 7d544e25fe1fb6e246528de7e11cf3949cdfbea6
Author: Michael Natterer <mitch gimp org>
Date: Sat Jun 1 16:04:43 2013 +0200
plug-ins, pdb: remove plugin waves and add a PDB compat procedure
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 131 +++++++++++++++++++++++++++++++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 -----
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 | 74 ++++++++++++++++++++
8 files changed, 206 insertions(+), 24 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index b8a42b7..3ae9b07 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 689 procedures registered total */
+/* 690 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 8829ae3..66575b3 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -27,6 +27,7 @@
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
+#include "libgimpmath/gimpmath.h"
#include "libgimpbase/gimpbase.h"
@@ -815,6 +816,70 @@ plug_in_vinvert_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_waves_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble amplitude;
+ gdouble phase;
+ gdouble wavelength;
+ gboolean type;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ amplitude = g_value_get_double (gimp_value_array_index (args, 3));
+ phase = g_value_get_double (gimp_value_array_index (args, 4));
+ wavelength = g_value_get_double (gimp_value_array_index (args, 5));
+ type = 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;
+ gdouble width = gimp_item_get_width (GIMP_ITEM (drawable));
+ gdouble height = gimp_item_get_height (GIMP_ITEM (drawable));
+ gdouble aspect;
+
+ while (phase < 0)
+ phase += 360.0;
+
+ phase = fmod (phase, 360.0);
+
+ aspect = CLAMP (width / height, 0.1, 10.0);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:waves",
+ "x", width / 2.0,
+ "y", height / 2.0,
+ "amplitude", amplitude,
+ "phi", (phase - 180.0) / 180.0,
+ "period", wavelength * 2.0,
+ "aspect", aspect,
+ "clamp", ! type,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Waves"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_whirl_pinch_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1624,6 +1689,72 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-waves
+ */
+ procedure = gimp_procedure_new (plug_in_waves_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-waves");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-waves",
+ "Distort the image with waves",
+ "Distort the image with waves.",
+ "Compatibility procedure. Please see 'gegl:waves' for credits.",
+ "Compatibility procedure. Please see 'gegl:waves' 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_procedure_add_argument (procedure,
+ g_param_spec_double ("amplitude",
+ "amplitude",
+ "The Amplitude of the Waves",
+ 0, 101, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("phase",
+ "phase",
+ "The Phase of the Waves",
+ -360, 360, -360,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("wavelength",
+ "wavelength",
+ "The Wavelength of the Waves",
+ 0.1, 50, 0.1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("type",
+ "type",
+ "Type of waves: { 0 = smeared, 1 = black }",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("reflective",
+ "reflective",
+ "Use Reflection (not implemented)",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-whirl-pinch
*/
procedure = gimp_procedure_new (plug_in_whirl_pinch_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 67f0b9f..c240c46 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -262,8 +262,6 @@
/video.exe
/warp
/warp.exe
-/waves
-/waves.exe
/web-browser
/web-browser.exe
/web-page
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index a727333..ac6864b 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -174,7 +174,6 @@ libexec_PROGRAMS = \
van-gogh-lic \
video \
warp \
- waves \
web-browser \
$(WEB_PAGE) \
wind
@@ -2453,23 +2452,6 @@ warp_LDADD = \
$(INTLLIBS) \
$(warp_RC)
-waves_SOURCES = \
- waves.c
-
-waves_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(waves_RC)
-
web_browser_SOURCES = \
web-browser.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 421d4a4..e980100 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -128,7 +128,6 @@ value_propagate_RC = value-propagate.rc.o
van_gogh_lic_RC = van-gogh-lic.rc.o
video_RC = video.rc.o
warp_RC = warp.rc.o
-waves_RC = waves.rc.o
web_browser_RC = web-browser.rc.o
web_page_RC = web-page.rc.o
wind_RC = wind.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 935f1b4..9f76a78 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -129,7 +129,6 @@
'van-gogh-lic' => { ui => 1 },
'video' => { ui => 1 },
'warp' => { ui => 1 },
- 'waves' => { ui => 1 },
'web-browser' => { ui => 1 },
'web-page' => { ui => 1, optional => 1, libs => 'WEBKIT_LIBS', cflags => 'WEBKIT_CFLAGS' },
'wind' => { ui => 1 }
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 953d477..b6afce8 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -136,7 +136,6 @@ plug-ins/common/value-propagate.c
plug-ins/common/van-gogh-lic.c
plug-ins/common/video.c
plug-ins/common/warp.c
-plug-ins/common/waves.c
plug-ins/common/web-browser.c
plug-ins/common/web-page.c
plug-ins/common/wind.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 01a36d8..152fb2c 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -892,6 +892,78 @@ CODE
);
}
+sub plug_in_waves {
+ $blurb = 'Distort the image with waves';
+
+ $help = <<'HELP';
+Distort the image with waves.
+HELP
+
+ &std_pdb_compat('gegl:waves');
+ $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' },
+ { name => 'amplitude', type => '0 <= float <= 101',
+ desc => 'The Amplitude of the Waves' },
+ { name => 'phase', type => '-360 <= float <= 360',
+ desc => 'The Phase of the Waves' },
+ { name => 'wavelength', type => '0.1 <= float <= 50',
+ desc => 'The Wavelength of the Waves' },
+ { name => 'type', type => 'boolean',
+ desc => 'Type of waves: { 0 = smeared, 1 = black }' },
+ { name => 'reflective', type => 'boolean', dead => 1,
+ desc => 'Use Reflection (not implemented)' }
+ );
+
+ %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;
+ gdouble width = gimp_item_get_width (GIMP_ITEM (drawable));
+ gdouble height = gimp_item_get_height (GIMP_ITEM (drawable));
+ gdouble aspect;
+
+ while (phase < 0)
+ phase += 360.0;
+
+ phase = fmod (phase, 360.0);
+
+ aspect = CLAMP (width / height, 0.1, 10.0);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:waves",
+ "x", width / 2.0,
+ "y", height / 2.0,
+ "amplitude", amplitude,
+ "phi", (phase - 180.0) / 180.0,
+ "period", wavelength * 2.0,
+ "aspect", aspect,
+ "clamp", ! type,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Waves"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_whirl_pinch {
$blurb = 'Distort an image by whirling and pinching';
@@ -951,6 +1023,7 @@ CODE
@headers = qw("libgimpbase/gimpbase.h"
+ "libgimpmath/gimpmath.h"
"gegl/gimp-gegl-utils.h"
"core/gimpcontext.h"
"core/gimpdrawable.h"
@@ -978,6 +1051,7 @@ CODE
plug_in_spread
plug_in_threshold_alpha
plug_in_vinvert
+ plug_in_waves
plug_in_whirl_pinch);
%exports = (app => [ procs], lib => []);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]