[gimp] plugins: Add compat wrappers for plasma.c
- From: Téo Mazars <teom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plugins: Add compat wrappers for plasma.c
- Date: Thu, 12 Sep 2013 23:31:29 +0000 (UTC)
commit 6fefd5af0c3b0dcd0592657960ec47d6cb60e78b
Author: Téo Mazars <teo mazars ensimag fr>
Date: Fri Sep 13 01:28:38 2013 +0200
plugins: Add compat wrappers for plasma.c
... and remove the old plugin.
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 108 ++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 -
plug-ins/common/gimprc.common | 1 -
plug-ins/common/plasma.c | 701 -----------------------------------
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 67 ++++
9 files changed, 176 insertions(+), 725 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 90abfc5..87fda3e 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 696 procedures registered total */
+/* 697 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 0d7e718..f7f7e5f 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -678,6 +678,66 @@ plug_in_pixelize2_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_plasma_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 seed;
+ gdouble turbulence;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ seed = g_value_get_int (gimp_value_array_index (args, 3));
+ turbulence = g_value_get_double (gimp_value_array_index (args, 4));
+
+ 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))
+ {
+ gint x, y, width, height;
+ GeglNode *plasma, *over, *node;
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new ();
+
+ plasma = gegl_node_new_child (node,
+ "operation", "gegl:plasma",
+ "seed", seed,
+ "turbulence", turbulence,
+ "x", x,
+ "y", y,
+ "width", width,
+ "height", height,
+ NULL);
+
+ over = gegl_node_new_child (node,
+ "operation", "svg:src-over",
+ NULL);
+
+ gegl_node_connect_to (plasma, "output", over, "aux");
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Plasma"),
+ over);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_polar_coords_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1921,6 +1981,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-plasma
+ */
+ procedure = gimp_procedure_new (plug_in_plasma_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-plasma");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-plasma",
+ "Create a random plasma texture",
+ "This plug-in produces plasma fractal images.",
+ "Compatibility procedure. Please see 'gegl:plasma' for credits.",
+ "Compatibility procedure. Please see 'gegl:plasma' 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,
+ gimp_param_spec_int32 ("seed",
+ "seed",
+ "Random seed",
+ -1, G_MAXINT, -1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("turbulence",
+ "turbulence",
+ "The value of the turbulence",
+ 0.0, 7.0, 0.0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-polar-coords
*/
procedure = gimp_procedure_new (plug_in_polar_coords_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 545795b..31ebf19 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -204,8 +204,6 @@
/oilify.exe
/photocopy
/photocopy.exe
-/plasma
-/plasma.exe
/plugin-browser
/plugin-browser.exe
/procedure-browser
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 893ad4f..047b52c 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -145,7 +145,6 @@ libexec_PROGRAMS = \
nova \
oilify \
photocopy \
- plasma \
plugin-browser \
procedure-browser \
qbist \
@@ -1963,23 +1962,6 @@ photocopy_LDADD = \
$(INTLLIBS) \
$(photocopy_RC)
-plasma_SOURCES = \
- plasma.c
-
-plasma_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(plasma_RC)
-
plugin_browser_SOURCES = \
plugin-browser.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index d77949e..d4f731f 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -99,7 +99,6 @@ noise_solid_RC = noise-solid.rc.o
nova_RC = nova.rc.o
oilify_RC = oilify.rc.o
photocopy_RC = photocopy.rc.o
-plasma_RC = plasma.rc.o
plugin_browser_RC = plugin-browser.rc.o
procedure_browser_RC = procedure-browser.rc.o
qbist_RC = qbist.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index b83ffe8..7dfe32e 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -100,7 +100,6 @@
'nova' => { ui => 1 },
'oilify' => { ui => 1 },
'photocopy' => { ui => 1 },
- 'plasma' => { ui => 1 },
'plugin-browser' => { ui => 1 },
'procedure-browser' => { ui => 1 },
'qbist' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 315ced3..c64b268 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -107,7 +107,6 @@ plug-ins/common/noise-solid.c
plug-ins/common/nova.c
plug-ins/common/oilify.c
plug-ins/common/photocopy.c
-plug-ins/common/plasma.c
plug-ins/common/plugin-browser.c
plug-ins/common/procedure-browser.c
plug-ins/common/qbist.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 6511890..c5047cc 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -710,6 +710,72 @@ CODE
);
}
+sub plug_in_plasma {
+ $blurb = 'Create a random plasma texture';
+
+ $help = <<'HELP';
+This plug-in produces plasma fractal images.
+HELP
+
+ &std_pdb_compat('gegl:plasma');
+ $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 => 'seed', type => '-1 <= int32 <= G_MAXINT',
+ desc => 'Random seed' },
+ { name => 'turbulence', type => '0.0 <= float <= 7.0',
+ desc => 'The value of the turbulence' }
+ );
+
+ %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))
+ {
+ gint x, y, width, height;
+ GeglNode *plasma, *over, *node;
+
+ gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+ node = gegl_node_new ();
+
+ plasma = gegl_node_new_child (node,
+ "operation", "gegl:plasma",
+ "seed", seed,
+ "turbulence", turbulence,
+ "x", x,
+ "y", y,
+ "width", width,
+ "height", height,
+ NULL);
+
+ over = gegl_node_new_child (node,
+ "operation", "svg:src-over",
+ NULL);
+
+ gegl_node_connect_to (plasma, "output", over, "aux");
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Plasma"),
+ over);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_polar_coords {
$blurb = 'Convert image to or from polar coordinates';
@@ -1456,6 +1522,7 @@ CODE
plug_in_mblur_inward
plug_in_pixelize
plug_in_pixelize2
+ plug_in_plasma
plug_in_polar_coords
plug_in_red_eye_removal
plug_in_randomize_hurl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]