[gimp] plug-ins,pdb: Add a compatibility wrapper for noise-hsv
- From: Téo Mazars <teom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins,pdb: Add a compatibility wrapper for noise-hsv
- Date: Thu, 26 Sep 2013 17:31:39 +0000 (UTC)
commit 8e25b5407db2b8556367f08d58afc2eb2cb598e8
Author: Téo Mazars <teo mazars ensimag fr>
Date: Thu Sep 26 19:29:27 2013 +0200
plug-ins,pdb: Add a compatibility wrapper for noise-hsv
... and remove the old plugin
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 114 +++++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 18 --
plug-ins/common/gimprc.common | 1 -
plug-ins/common/noise-hsv.c | 455 -----------------------------------
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 62 +++++
9 files changed, 177 insertions(+), 479 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 8504f1d..439eda1 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 698 procedures registered total */
+/* 699 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 4290272..32e7e3a 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -434,6 +434,60 @@ plug_in_cubism_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_hsv_noise_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+ gint32 holdness;
+ gint32 hue_distance;
+ gint32 saturation_distance;
+ gint32 value_distance;
+
+ drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+ holdness = g_value_get_int (gimp_value_array_index (args, 3));
+ hue_distance = g_value_get_int (gimp_value_array_index (args, 4));
+ saturation_distance = g_value_get_int (gimp_value_array_index (args, 5));
+ value_distance = g_value_get_int (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 saturation = saturation_distance / 255.0;
+ gdouble value = value_distance / 255.0;
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:noise-hsv",
+ "holdness", (gint) holdness,
+ "hue-distance", (gdouble) hue_distance,
+ "saturation-distance", (gdouble) saturation,
+ "value-distance", (gdouble) value,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Noise HSV"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_mblur_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -1848,6 +1902,66 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-hsv-noise
+ */
+ procedure = gimp_procedure_new (plug_in_hsv_noise_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-hsv-noise");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-hsv-noise",
+ "Randomize hue, saturation and value independently",
+ "Scattering pixel values in HSV space",
+ "Compatibility procedure. Please see 'gegl:noise-hsv' for credits.",
+ "Compatibility procedure. Please see 'gegl:noise-hsv' 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 ("holdness",
+ "holdness",
+ "Convolution strength",
+ 1, 8, 1,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("hue-distance",
+ "hue distance",
+ "Scattering of hue angle",
+ 0, 180, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("saturation-distance",
+ "saturation distance",
+ "Distribution distance on saturation axis",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("value-distance",
+ "value distance",
+ "Distribution distance on value axis",
+ 0, 255, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-mblur
*/
procedure = gimp_procedure_new (plug_in_mblur_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 5e69a6f..16da47b 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -190,8 +190,6 @@
/newsprint.exe
/nl-filter
/nl-filter.exe
-/noise-hsv
-/noise-hsv.exe
/noise-rgb
/noise-rgb.exe
/noise-solid
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 7bc509c..8ebe9b2 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -138,7 +138,6 @@ libexec_PROGRAMS = \
max-rgb \
newsprint \
nl-filter \
- noise-hsv \
noise-rgb \
noise-solid \
nova \
@@ -1842,23 +1841,6 @@ nl_filter_LDADD = \
$(INTLLIBS) \
$(nl_filter_RC)
-noise_hsv_SOURCES = \
- noise-hsv.c
-
-noise_hsv_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(noise_hsv_RC)
-
noise_rgb_SOURCES = \
noise-rgb.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 8d035ab..5904c1b 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -92,7 +92,6 @@ mail_RC = mail.rc.o
max_rgb_RC = max-rgb.rc.o
newsprint_RC = newsprint.rc.o
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
nova_RC = nova.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 54858ed..03fc2da 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -93,7 +93,6 @@
'max-rgb' => { ui => 1 },
'newsprint' => { ui => 1 },
'nl-filter' => { ui => 1 },
- 'noise-hsv' => { ui => 1 },
'noise-rgb' => { ui => 1 },
'noise-solid' => { ui => 1 },
'nova' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 4353404..482347a 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -100,7 +100,6 @@ plug-ins/common/mail.c
plug-ins/common/max-rgb.c
plug-ins/common/newsprint.c
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/nova.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index dbf8828..2bead1d 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -437,6 +437,67 @@ CODE
);
}
+sub plug_in_hsv_noise {
+ $blurb = 'Randomize hue, saturation and value independently';
+
+ $help = <<'HELP';
+Scattering pixel values in HSV space
+HELP
+
+ &std_pdb_compat('gegl:noise-hsv');
+ $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 => 'holdness', type => '1 <= int32 <= 8',
+ desc => 'Convolution strength' },
+ { name => 'hue_distance', type => '0 <= int32 <= 180',
+ desc => 'Scattering of hue angle' },
+ { name => 'saturation_distance', type => '0 <= int32 <= 255',
+ desc => 'Distribution distance on saturation axis' },
+ { name => 'value_distance', type => '0 <= int32 <= 255',
+ desc => 'Distribution distance on value axis' }
+ );
+
+ %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 saturation = saturation_distance / 255.0;
+ gdouble value = value_distance / 255.0;
+
+
+ node = gegl_node_new_child (NULL,
+ "operation", "gegl:noise-hsv",
+ "holdness", (gint) holdness,
+ "hue-distance", (gdouble) hue_distance,
+ "saturation-distance", (gdouble) saturation,
+ "value-distance", (gdouble) value,
+ NULL);
+
+ gimp_drawable_apply_operation (drawable, progress,
+ C_("undo-type", "Noise HSV"),
+ node);
+
+ g_object_unref (node);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_mblur {
$blurb = 'Simulate movement using directional blur';
@@ -1615,6 +1676,7 @@ CODE
plug_in_colors_channel_mixer
plug_in_colortoalpha
plug_in_cubism
+ plug_in_hsv_noise
plug_in_mblur
plug_in_mblur_inward
plug_in_mosaic
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]