[gimp] plug-ins, pdb: remove the lens-apply plug-in and add a compat procedure
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove the lens-apply plug-in and add a compat procedure
- Date: Sun, 13 Apr 2014 19:20:22 +0000 (UTC)
commit 260a4a51b1a740c6db1f795f67d734f7e7f1d3f4
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 13 21:18:35 2014 +0200
plug-ins, pdb: remove the lens-apply plug-in and add a compat procedure
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 119 ++++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 --
plug-ins/common/gimprc.common | 1 -
plug-ins/common/lens-apply.c | 503 -----------------------------------
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 68 +++++
9 files changed, 188 insertions(+), 527 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 39cfc35..35d2985 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 720 procedures registered total */
+/* 721 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 3857921..b814248 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -203,6 +203,65 @@ plug_in_apply_canvas_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_applylens_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble refraction;
+ gint32 keep_surroundings;
+ gint32 set_background;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ refraction = g_value_get_double (gimp_value_array_index (args, 3));
+ keep_surroundings = g_value_get_int (gimp_value_array_index (args, 4));
+ set_background = 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))
+ {
+ GimpRGB color;
+ GeglColor *gegl_color;
+ GeglNode *node;
+
+ if (set_background)
+ gimp_context_get_background (context, &color);
+ else
+ gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0);
+
+ gegl_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:apply-lens",
+ "refraction-index", refraction,
+ "keep-surroundings", keep_surroundings,
+ "background-color", gegl_color,
+ NULL);
+
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Apply Lens"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_autocrop_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1916,6 +1975,66 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-applylens
+ */
+ procedure = gimp_procedure_new (plug_in_applylens_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-applylens");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-applylens",
+ "Simulate an elliptical lens over the image",
+ "This plug-in uses Snell's law to draw an ellipsoid lens over the
image",
+ "Compatibility procedure. Please see 'gegl:apply-lens' for credits.",
+ "Compatibility procedure. Please see 'gegl:apply-lens' for credits.",
+ "2014",
+ 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 ("refraction",
+ "refraction",
+ "Lens refraction index",
+ 1.0, 100.0, 1.0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("keep-surroundings",
+ "keep surroundings",
+ "Keep lens surroundings { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("set-background",
+ "set background",
+ "Set lens surroundings to BG value { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("set-transparent",
+ "set transparent",
+ "Set lens surroundings transparent { TRUE, FALSE }",
+ 0, 1, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-autocrop
*/
procedure = gimp_procedure_new (plug_in_autocrop_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index d82d57e..39d9982 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -168,8 +168,6 @@
/jigsaw.exe
/lcms
/lcms.exe
-/lens-apply
-/lens-apply.exe
/lens-flare
/lens-flare.exe
/mail
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 19f5ebe..55f7048 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -127,7 +127,6 @@ libexec_PROGRAMS = \
iwarp \
jigsaw \
lcms \
- lens-apply \
lens-flare \
$(MAIL) \
max-rgb \
@@ -1658,23 +1657,6 @@ lcms_LDADD = \
$(INTLLIBS) \
$(lcms_RC)
-lens_apply_SOURCES = \
- lens-apply.c
-
-lens_apply_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(lens_apply_RC)
-
lens_flare_SOURCES = \
lens-flare.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 64c3495..573cc89 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -81,7 +81,6 @@ illusion_RC = illusion.rc.o
iwarp_RC = iwarp.rc.o
jigsaw_RC = jigsaw.rc.o
lcms_RC = lcms.rc.o
-lens_apply_RC = lens-apply.rc.o
lens_flare_RC = lens-flare.rc.o
mail_RC = mail.rc.o
max_rgb_RC = max-rgb.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 67b3fdb..3fd4c27 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -82,7 +82,6 @@
'iwarp' => { ui => 1 },
'jigsaw' => { ui => 1 },
'lcms' => { ui => 1, gegl => 1, libs => 'LCMS_LIBS', cflags => 'LCMS_CFLAGS' },
- 'lens-apply' => { ui => 1 },
'lens-flare' => { ui => 1 },
'mail' => { ui => 1, optional => 1 },
'max-rgb' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 8d05dc8..233a60f 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -89,7 +89,6 @@ plug-ins/common/illusion.c
plug-ins/common/iwarp.c
plug-ins/common/jigsaw.c
plug-ins/common/lcms.c
-plug-ins/common/lens-apply.c
plug-ins/common/lens-flare.c
plug-ins/common/mail.c
plug-ins/common/max-rgb.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 9740340..dcdeee0 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -184,6 +184,73 @@ CODE
);
}
+sub plug_in_applylens {
+ $blurb = 'Simulate an elliptical lens over the image';
+
+ $help = <<'HELP';
+This plug-in uses Snell's law to draw an ellipsoid lens over the image
+HELP
+
+ &std_pdb_compat('gegl:apply-lens');
+ $date = '2014';
+
+ @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 => 'refraction', type => '1.0 <= float <= 100.0',
+ desc => 'Lens refraction index' },
+ { name => 'keep_surroundings', type => '0 <= int32 <= 1',
+ desc => 'Keep lens surroundings { TRUE, FALSE }' },
+ { name => 'set_background', type => '0 <= int32 <= 1',
+ desc => 'Set lens surroundings to BG value { TRUE, FALSE }' },
+ { name => 'set_transparent', type => '0 <= int32 <= 1', dead => 1,
+ desc => 'Set lens surroundings transparent { TRUE, FALSE }' }
+ );
+
+ %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))
+ {
+ GimpRGB color;
+ GeglColor *gegl_color;
+ GeglNode *node;
+
+ if (set_background)
+ gimp_context_get_background (context, &color);
+ else
+ gimp_rgba_set (&color, 0.0, 0.0, 0.0, 0.0);
+
+ gegl_color = gimp_gegl_color_new (&color);
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:apply-lens",
+ "refraction-index", refraction,
+ "keep-surroundings", keep_surroundings,
+ "background-color", gegl_color,
+ NULL);
+
+ g_object_unref (gegl_color);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Apply Lens"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_autocrop {
$blurb = 'Remove empty borders from the image';
@@ -1947,6 +2014,7 @@ CODE
@procs = qw(plug_in_alienmap2
plug_in_antialias
plug_in_apply_canvas
+ plug_in_applylens
plug_in_autocrop
plug_in_autocrop_layer
plug_in_autostretch_hsv
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]