[gimp] plug-ins, pdb: remove plug-in noise-randomize



commit e21e3bce5cdbda2b249fa4a1ae8f6fd58dc50109
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 8 17:06:53 2013 +0100

    plug-ins, pdb: remove plug-in noise-randomize
    
    and implement its procedures as compat wrappers around GEGL ops.

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |  342 +++++++++++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 -
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/noise-randomize.c   |  809 -----------------------------------
 plug-ins/common/plugin-defs.pl      |    1 -
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |  191 ++++++++-
 tools/pdbgen/stddefs.pdb            |    5 +
 10 files changed, 538 insertions(+), 834 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 64376c8..38cea33 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 681 procedures registered total */
+/* 684 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 fef1f60..15be099 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -335,6 +335,168 @@ plug_in_polar_coords_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_randomize_hurl_invoker (GimpProcedure         *procedure,
+                                Gimp                  *gimp,
+                                GimpContext           *context,
+                                GimpProgress          *progress,
+                                const GimpValueArray  *args,
+                                GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble rndm_pct;
+  gdouble rndm_rcount;
+  gboolean randomize;
+  gint32 seed;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  rndm_pct = g_value_get_double (gimp_value_array_index (args, 3));
+  rndm_rcount = g_value_get_double (gimp_value_array_index (args, 4));
+  randomize = g_value_get_boolean (gimp_value_array_index (args, 5));
+  seed = 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;
+
+          if (randomize)
+            seed = g_random_int ();
+
+          node =
+            gegl_node_new_child (NULL,
+                                 "operation",  "gegl:noise-hurl",
+                                 "seed",       seed,
+                                 "pct-random", rndm_pct,
+                                 "repeat",     (gint) rndm_rcount,
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Random Hurl"),
+                                         node);
+
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_randomize_pick_invoker (GimpProcedure         *procedure,
+                                Gimp                  *gimp,
+                                GimpContext           *context,
+                                GimpProgress          *progress,
+                                const GimpValueArray  *args,
+                                GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble rndm_pct;
+  gdouble rndm_rcount;
+  gboolean randomize;
+  gint32 seed;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  rndm_pct = g_value_get_double (gimp_value_array_index (args, 3));
+  rndm_rcount = g_value_get_double (gimp_value_array_index (args, 4));
+  randomize = g_value_get_boolean (gimp_value_array_index (args, 5));
+  seed = 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;
+
+          if (randomize)
+            seed = g_random_int ();
+
+          node =
+            gegl_node_new_child (NULL,
+                                 "operation",  "gegl:noise-pick",
+                                 "seed",       seed,
+                                 "pct-random", rndm_pct,
+                                 "repeat",     (gint) rndm_rcount,
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Random Pick"),
+                                         node);
+
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_randomize_slur_invoker (GimpProcedure         *procedure,
+                                Gimp                  *gimp,
+                                GimpContext           *context,
+                                GimpProgress          *progress,
+                                const GimpValueArray  *args,
+                                GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble rndm_pct;
+  gdouble rndm_rcount;
+  gboolean randomize;
+  gint32 seed;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  rndm_pct = g_value_get_double (gimp_value_array_index (args, 3));
+  rndm_rcount = g_value_get_double (gimp_value_array_index (args, 4));
+  randomize = g_value_get_boolean (gimp_value_array_index (args, 5));
+  seed = 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;
+
+          if (randomize)
+            seed = g_random_int ();
+
+          node =
+            gegl_node_new_child (NULL,
+                                 "operation",  "gegl:noise-slur",
+                                 "seed",       seed,
+                                 "pct-random", rndm_pct,
+                                 "repeat",     (gint) rndm_rcount,
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Random Slur"),
+                                         node);
+
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_semiflatten_invoker (GimpProcedure         *procedure,
                              Gimp                  *gimp,
                              GimpContext           *context,
@@ -736,6 +898,186 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-randomize-hurl
+   */
+  procedure = gimp_procedure_new (plug_in_randomize_hurl_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-randomize-hurl");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-randomize-hurl",
+                                     "Completely randomize a fraction of pixels",
+                                     "This plug-in \"hurls\" randomly-valued pixels onto the selection or 
image. You may select the percentage of pixels to modify and the number of times to repeat the process.",
+                                     "Compatibility procedure. Please see 'gegl:noise-hurl' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:noise-hurl' 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 ("rndm-pct",
+                                                    "rndm pct",
+                                                    "Randomization percentage",
+                                                    1.0, 100.0, 1.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("rndm-rcount",
+                                                    "rndm rcount",
+                                                    "Repeat count",
+                                                    1.0, 100.0, 1.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("randomize",
+                                                     "randomize",
+                                                     "Use random seed",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("seed",
+                                                      "seed",
+                                                      "Seed value (used only if randomize is FALSE)",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-plug-in-randomize-pick
+   */
+  procedure = gimp_procedure_new (plug_in_randomize_pick_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-randomize-pick");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-randomize-pick",
+                                     "Randomly interchange some pixels with neighbors",
+                                     "This plug-in replaces a pixel with a random adjacent pixel. You may 
select the percentage of pixels to modify and the number of times to repeat the process.",
+                                     "Compatibility procedure. Please see 'gegl:noise-pick' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:noise-pick' 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 ("rndm-pct",
+                                                    "rndm pct",
+                                                    "Randomization percentage",
+                                                    1.0, 100.0, 1.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("rndm-rcount",
+                                                    "rndm rcount",
+                                                    "Repeat count",
+                                                    1.0, 100.0, 1.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("randomize",
+                                                     "randomize",
+                                                     "Use random seed",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("seed",
+                                                      "seed",
+                                                      "Seed value (used only if randomize is FALSE)",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-plug-in-randomize-slur
+   */
+  procedure = gimp_procedure_new (plug_in_randomize_slur_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-randomize-slur");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-randomize-slur",
+                                     "Randomly slide some pixels downward (similar to melting",
+                                     "This plug-in \"slurs\" (melts like a bunch of icicles) an image. You 
may select the percentage of pixels to modify and the number of times to repeat the process.",
+                                     "Compatibility procedure. Please see 'gegl:noise-slur' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:noise-slur' 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 ("rndm-pct",
+                                                    "rndm pct",
+                                                    "Randomization percentage",
+                                                    1.0, 100.0, 1.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("rndm-rcount",
+                                                    "rndm rcount",
+                                                    "Repeat count",
+                                                    1.0, 100.0, 1.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("randomize",
+                                                     "randomize",
+                                                     "Use random seed",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("seed",
+                                                      "seed",
+                                                      "Seed value (used only if randomize is FALSE)",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-semiflatten
    */
   procedure = gimp_procedure_new (plug_in_semiflatten_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 899d516..6ca7861 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -204,8 +204,6 @@
 /nl-filter.exe
 /noise-hsv
 /noise-hsv.exe
-/noise-randomize
-/noise-randomize.exe
 /noise-rgb
 /noise-rgb.exe
 /noise-solid
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 8d56062..bf10449 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -145,7 +145,6 @@ libexec_PROGRAMS = \
        newsprint \
        nl-filter \
        noise-hsv \
-       noise-randomize \
        noise-rgb \
        noise-solid \
        noise-spread \
@@ -1964,23 +1963,6 @@ noise_hsv_LDADD = \
        $(INTLLIBS)             \
        $(noise_hsv_RC)
 
-noise_randomize_SOURCES = \
-       noise-randomize.c
-
-noise_randomize_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(noise_randomize_RC)
-
 noise_rgb_SOURCES = \
        noise-rgb.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index d837475..f4faa7d 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -99,7 +99,6 @@ mosaic_RC = mosaic.rc.o
 newsprint_RC = newsprint.rc.o
 nl_filter_RC = nl-filter.rc.o
 noise_hsv_RC = noise-hsv.rc.o
-noise_randomize_RC = noise-randomize.rc.o
 noise_rgb_RC = noise-rgb.rc.o
 noise_solid_RC = noise-solid.rc.o
 noise_spread_RC = noise-spread.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 5c09d14..8e022d7 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -100,7 +100,6 @@
     'newsprint' => { ui => 1 },
     'nl-filter' => { ui => 1 },
     'noise-hsv' => { ui => 1 },
-    'noise-randomize' => { ui => 1 },
     'noise-rgb' => { ui => 1 },
     'noise-solid' => { ui => 1 },
     'noise-spread' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index e2dcefa..f85d358 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -107,7 +107,6 @@ plug-ins/common/mosaic.c
 plug-ins/common/newsprint.c
 plug-ins/common/nl-filter.c
 plug-ins/common/noise-hsv.c
-plug-ins/common/noise-randomize.c
 plug-ins/common/noise-rgb.c
 plug-ins/common/noise-solid.c
 plug-ins/common/noise-spread.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index f3505ec..cab29e0 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -335,6 +335,192 @@ CODE
     );
 }
 
+sub plug_in_randomize_hurl {
+    $blurb = 'Completely randomize a fraction of pixels';
+
+    $help = <<'HELP';
+This plug-in "hurls" randomly-valued pixels onto the selection or
+image.  You may select the percentage of pixels to modify and the
+number of times to repeat the process.
+HELP
+
+    &std_pdb_compat('gegl:noise-hurl');
+    $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 => 'rndm_pct', type => '1.0 <= float <= 100.0',
+          desc => 'Randomization percentage' },
+        { name => 'rndm_rcount', type => '1.0 <= float <= 100.0',
+          desc => 'Repeat count' },
+        { name => 'randomize', type => 'boolean',
+          desc => 'Use random seed' },
+        { name => 'seed', type => 'int32',
+          desc => 'Seed value (used only if randomize is 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))
+    {
+      GeglNode *node;
+
+      if (randomize)
+        seed = g_random_int ();
+
+      node =
+        gegl_node_new_child (NULL,
+                             "operation",  "gegl:noise-hurl",
+                             "seed",       seed,
+                             "pct-random", rndm_pct,
+                             "repeat",     (gint) rndm_rcount,
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Random Hurl"),
+                                     node);
+
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub plug_in_randomize_pick {
+    $blurb = 'Randomly interchange some pixels with neighbors';
+
+    $help = <<'HELP';
+This plug-in replaces a pixel with a random adjacent pixel.  You may
+select the percentage of pixels to modify and the number of times to
+repeat the process.
+HELP
+
+    &std_pdb_compat('gegl:noise-pick');
+    $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 => 'rndm_pct', type => '1.0 <= float <= 100.0',
+          desc => 'Randomization percentage' },
+        { name => 'rndm_rcount', type => '1.0 <= float <= 100.0',
+          desc => 'Repeat count' },
+        { name => 'randomize', type => 'boolean',
+          desc => 'Use random seed' },
+        { name => 'seed', type => 'int32',
+          desc => 'Seed value (used only if randomize is 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))
+    {
+      GeglNode *node;
+
+      if (randomize)
+        seed = g_random_int ();
+
+      node =
+        gegl_node_new_child (NULL,
+                             "operation",  "gegl:noise-pick",
+                             "seed",       seed,
+                             "pct-random", rndm_pct,
+                             "repeat",     (gint) rndm_rcount,
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Random Pick"),
+                                     node);
+
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub plug_in_randomize_slur {
+    $blurb = 'Randomly slide some pixels downward (similar to melting';
+
+    $help = <<'HELP';
+This plug-in "slurs" (melts like a bunch of icicles) an image.  You may
+select the percentage of pixels to modify and the number of times to
+repeat the process.
+HELP
+
+    &std_pdb_compat('gegl:noise-slur');
+    $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 => 'rndm_pct', type => '1.0 <= float <= 100.0',
+          desc => 'Randomization percentage' },
+        { name => 'rndm_rcount', type => '1.0 <= float <= 100.0',
+          desc => 'Repeat count' },
+        { name => 'randomize', type => 'boolean',
+          desc => 'Use random seed' },
+        { name => 'seed', type => 'int32',
+          desc => 'Seed value (used only if randomize is 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))
+    {
+      GeglNode *node;
+
+      if (randomize)
+        seed = g_random_int ();
+
+      node =
+        gegl_node_new_child (NULL,
+                             "operation",  "gegl:noise-slur",
+                             "seed",       seed,
+                             "pct-random", rndm_pct,
+                             "repeat",     (gint) rndm_rcount,
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Random Slur"),
+                                     node);
+
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_semiflatten {
     $blurb = 'Replace partial transparency with the current background color';
 
@@ -502,8 +688,11 @@ CODE
             plug_in_pixelize
             plug_in_pixelize2
             plug_in_polar_coords
+            plug_in_randomize_hurl
+            plug_in_randomize_pick
+            plug_in_randomize_slur
             plug_in_semiflatten
-           plug_in_threshold_alpha
+            plug_in_threshold_alpha
             plug_in_vinvert);
 
 %exports = (app => [ procs], lib => []);
diff --git a/tools/pdbgen/stddefs.pdb b/tools/pdbgen/stddefs.pdb
index dbd638d..2f79546 100644
--- a/tools/pdbgen/stddefs.pdb
+++ b/tools/pdbgen/stddefs.pdb
@@ -164,4 +164,9 @@ sub std_pdb_deprecated {
     $author = $copyright = $date = '';
 }
 
+sub std_pdb_compat {
+    $author = $copyright = "Compatibility procedure. Please see '@_' for credits.";
+}
+
+
 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]