[gimp] plug-ins, pdb: remove the Solid Noise plug-in and add a PDB compat procedure



commit 212b44cf2fb96b861b8d70eb8b4a10cff0930a62
Author: Michael Natterer <mitch gimp org>
Date:   Sat Nov 22 21:04:31 2014 +0100

    plug-ins, pdb: remove the Solid Noise plug-in and add a PDB compat procedure

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |  133 +++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 -
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/noise-solid.c       |  686 -----------------------------------
 plug-ins/common/plugin-defs.pl      |    1 -
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   68 ++++
 9 files changed, 202 insertions(+), 710 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 5c67464..241d682 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 745 procedures registered total */
+/* 746 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 2b92acf..b01d5d9 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -2559,6 +2559,67 @@ plug_in_sobel_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_solid_noise_invoker (GimpProcedure         *procedure,
+                             Gimp                  *gimp,
+                             GimpContext           *context,
+                             GimpProgress          *progress,
+                             const GimpValueArray  *args,
+                             GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gboolean tilable;
+  gboolean turbulent;
+  gint32 seed;
+  gint32 detail;
+  gdouble xsize;
+  gdouble ysize;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  tilable = g_value_get_boolean (gimp_value_array_index (args, 3));
+  turbulent = g_value_get_boolean (gimp_value_array_index (args, 4));
+  seed = g_value_get_int (gimp_value_array_index (args, 5));
+  detail = g_value_get_int (gimp_value_array_index (args, 6));
+  xsize = g_value_get_double (gimp_value_array_index (args, 7));
+  ysize = g_value_get_double (gimp_value_array_index (args, 8));
+
+  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;
+          gint      x, y, width, height;
+
+          gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+          node = gegl_node_new_child (NULL,
+                                      "operation", "gegl:noise-solid",
+                                      "x-size",    xsize,
+                                      "y-size",    ysize,
+                                      "detail",    detail,
+                                      "tilable",   tilable,
+                                      "turbulent", turbulent,
+                                      "seed",      seed,
+                                      "width",     width,
+                                      "height",    height,
+                                      NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Solid Noise"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_spread_invoker (GimpProcedure         *procedure,
                         Gimp                  *gimp,
                         GimpContext           *context,
@@ -5323,6 +5384,78 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-solid-noise
+   */
+  procedure = gimp_procedure_new (plug_in_solid_noise_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-solid-noise");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-solid-noise",
+                                     "Create a random cloud-like texture",
+                                     "Generates 2D textures using Perlin's classic solid noise function.",
+                                     "Compatibility procedure. Please see 'gegl:noise-solid' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:noise-solid' 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_boolean ("tilable",
+                                                     "tilable",
+                                                     "Create a tilable output",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("turbulent",
+                                                     "turbulent",
+                                                     "Make a turbulent noise",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("seed",
+                                                      "seed",
+                                                      "Random seed",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("detail",
+                                                      "detail",
+                                                      "Detail level",
+                                                      0, 15, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("xsize",
+                                                    "xsize",
+                                                    "Horizontal texture size",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("ysize",
+                                                    "ysize",
+                                                    "Vertical texture size",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-spread
    */
   procedure = gimp_procedure_new (plug_in_spread_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 3cb7858..f7be41c 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -170,8 +170,6 @@
 /newsprint.exe
 /nl-filter
 /nl-filter.exe
-/noise-solid
-/noise-solid.exe
 /oilify
 /oilify.exe
 /photocopy
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index bf8d258..50c6c4c 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -128,7 +128,6 @@ libexec_PROGRAMS = \
        metadata \
        newsprint \
        nl-filter \
-       noise-solid \
        oilify \
        photocopy \
        plugin-browser \
@@ -1669,23 +1668,6 @@ nl_filter_LDADD = \
        $(INTLLIBS)             \
        $(nl_filter_RC)
 
-noise_solid_SOURCES = \
-       noise-solid.c
-
-noise_solid_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(noise_solid_RC)
-
 oilify_SOURCES = \
        oilify.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index a968247..50665a3 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -82,7 +82,6 @@ max_rgb_RC = max-rgb.rc.o
 metadata_RC = metadata.rc.o
 newsprint_RC = newsprint.rc.o
 nl_filter_RC = nl-filter.rc.o
-noise_solid_RC = noise-solid.rc.o
 oilify_RC = oilify.rc.o
 photocopy_RC = photocopy.rc.o
 plugin_browser_RC = plugin-browser.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index e7b460c..84fb352 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -83,7 +83,6 @@
     'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
     'newsprint' => { ui => 1 },
     'nl-filter' => { ui => 1 },
-    'noise-solid' => { ui => 1 },
     'oilify' => { ui => 1 },
     'photocopy' => { ui => 1 },
     'plugin-browser' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index f3c655a..2d32190 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -87,7 +87,6 @@ plug-ins/common/max-rgb.c
 plug-ins/common/metadata.c
 plug-ins/common/newsprint.c
 plug-ins/common/nl-filter.c
-plug-ins/common/noise-solid.c
 plug-ins/common/oilify.c
 plug-ins/common/photocopy.c
 plug-ins/common/plugin-browser.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index da7f110..a3ee8d5 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -2697,6 +2697,73 @@ CODE
     );
 }
 
+sub plug_in_solid_noise {
+    $blurb = 'Create a random cloud-like texture';
+
+    $help = <<'HELP';
+Generates 2D textures using Perlin's classic solid noise function.
+HELP
+
+    &std_pdb_compat('gegl:noise-solid');
+    $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 => 'tilable', type => 'boolean',
+          desc => 'Create a tilable output' },
+        { name => 'turbulent', type => 'boolean',
+          desc => 'Make a turbulent noise' },
+        { name => 'seed', type => 'int32',
+          desc => 'Random seed' },
+        { name => 'detail', type => '0 <= int32 <= 15',
+          desc => 'Detail level' },
+        { name => 'xsize', type => 'float',
+          desc => 'Horizontal texture size' },
+        { name => 'ysize', type => 'float',
+          desc => 'Vertical texture size' }
+    );
+
+    %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;
+      gint      x, y, width, height;
+
+      gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
+
+      node = gegl_node_new_child (NULL,
+                                  "operation", "gegl:noise-solid",
+                                  "x-size",    xsize,
+                                  "y-size",    ysize,
+                                  "detail",    detail,
+                                  "tilable",   tilable,
+                                  "turbulent", turbulent,
+                                  "seed",      seed,
+                                  "width",     width,
+                                  "height",    height,
+                                  NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Solid Noise"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_spread {
     $blurb = 'Move pixels around randomly';
 
@@ -3231,6 +3298,7 @@ CODE
             plug_in_shift
             plug_in_sinus
             plug_in_sobel
+            plug_in_solid_noise
             plug_in_spread
             plug_in_threshold_alpha
             plug_in_video


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