[gimp] plug-ins, pdb: remove plug-in noise-spread 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 plug-in noise-spread and add a PDB compat procedure
- Date: Wed, 29 May 2013 17:55:58 +0000 (UTC)
commit 894d7568aca120484cce1238ac0c8c50235c12da
Author: Michael Natterer <mitch gimp org>
Date: Wed May 29 19:54:42 2013 +0200
plug-ins, pdb: remove plug-in noise-spread and add a PDB compat procedure
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 93 ++++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 --
plug-ins/common/gimprc.common | 1 -
plug-ins/common/noise-spread.c | 419 -----------------------------------
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 54 +++++
9 files changed, 148 insertions(+), 443 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index bb2acd2..15ae99d 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 687 procedures registered total */
+/* 688 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 1a9c8ad..f185b13 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -690,6 +690,51 @@ plug_in_shift_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_spread_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gdouble spread_amount_x;
+ gdouble spread_amount_y;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ spread_amount_x = g_value_get_double (gimp_value_array_index (args, 3));
+ spread_amount_y = 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))
+ {
+ GeglNode *node =
+ gegl_node_new_child (NULL,
+ "operation", "gegl:noise-spread",
+ "amount-x", (gint) spread_amount_x,
+ "amount-y", (gint) spread_amount_y,
+ "seed", (guint) g_random_int (),
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Spread"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_threshold_alpha_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1406,6 +1451,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-spread
+ */
+ procedure = gimp_procedure_new (plug_in_spread_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-spread");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-spread",
+ "Move pixels around randomly",
+ "Spreads the pixels of the specified drawable. Pixels are randomly
moved to another location whose distance varies from the original by the horizontal and vertical spread
amounts.",
+ "Compatibility procedure. Please see 'gegl:noise-spread' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-spread' 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 ("spread-amount-x",
+ "spread amount x",
+ "Horizontal spread amount",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_double ("spread-amount-y",
+ "spread amount y",
+ "Vertical spread amount",
+ 0, 200, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-threshold-alpha
*/
procedure = gimp_procedure_new (plug_in_threshold_alpha_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index e8d18be..4a4422e 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -206,8 +206,6 @@
/noise-rgb.exe
/noise-solid
/noise-solid.exe
-/noise-spread
-/noise-spread.exe
/nova
/nova.exe
/oilify
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index ddad3b6..88a75dd 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -146,7 +146,6 @@ libexec_PROGRAMS = \
noise-hsv \
noise-rgb \
noise-solid \
- noise-spread \
nova \
oilify \
photocopy \
@@ -1979,23 +1978,6 @@ noise_solid_LDADD = \
$(INTLLIBS) \
$(noise_solid_RC)
-noise_spread_SOURCES = \
- noise-spread.c
-
-noise_spread_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(noise_spread_RC)
-
nova_SOURCES = \
nova.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index b0755cf..1f98589 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -100,7 +100,6 @@ nl_filter_RC = nl-filter.rc.o
noise_hsv_RC = noise-hsv.rc.o
noise_rgb_RC = noise-rgb.rc.o
noise_solid_RC = noise-solid.rc.o
-noise_spread_RC = noise-spread.rc.o
nova_RC = nova.rc.o
oilify_RC = oilify.rc.o
photocopy_RC = photocopy.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index f5e4354..6263fca 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -101,7 +101,6 @@
'noise-hsv' => { ui => 1 },
'noise-rgb' => { ui => 1 },
'noise-solid' => { ui => 1 },
- 'noise-spread' => { ui => 1 },
'nova' => { ui => 1 },
'oilify' => { ui => 1 },
'photocopy' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index c9be367..9daec35 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -108,7 +108,6 @@ plug-ins/common/nl-filter.c
plug-ins/common/noise-hsv.c
plug-ins/common/noise-rgb.c
plug-ins/common/noise-solid.c
-plug-ins/common/noise-spread.c
plug-ins/common/nova.c
plug-ins/common/oilify.c
plug-ins/common/photocopy.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 4b4c0ee..f4289f4 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -743,6 +743,59 @@ CODE
);
}
+sub plug_in_spread {
+ $blurb = 'Move pixels around randomly';
+
+ $help = <<'HELP';
+Spreads the pixels of the specified drawable. Pixels are randomly
+moved to another location whose distance varies from the original by
+the horizontal and vertical spread amounts.
+HELP
+
+ &std_pdb_compat('gegl:noise-spread');
+ $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 => 'spread_amount_x', type => '0 <= float <= 200',
+ desc => 'Horizontal spread amount' },
+ { name => 'spread_amount_y', type => '0 <= float <= 200',
+ desc => 'Vertical spread amount' }
+ );
+
+ %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:noise-spread",
+ "amount-x", (gint) spread_amount_x,
+ "amount-y", (gint) spread_amount_y,
+ "seed", (guint) g_random_int (),
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Spread"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_threshold_alpha {
$blurb = 'Make transparency all-or-nothing';
@@ -865,6 +918,7 @@ CODE
plug_in_randomize_slur
plug_in_semiflatten
plug_in_shift
+ plug_in_spread
plug_in_threshold_alpha
plug_in_vinvert);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]