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



commit b94ba871ac4d44e635d4975678b02c2ccd48f1f3
Author: Michael Natterer <mitch gimp org>
Date:   Tue Nov 18 21:05:32 2014 +0100

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

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |  135 +++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 -
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/nova.c              |  994 -----------------------------------
 plug-ins/common/plugin-defs.pl      |    1 -
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   71 +++
 9 files changed, 207 insertions(+), 1018 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 6eaa8e6..c01b1b0 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 743 procedures registered total */
+/* 744 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 1c4888a..a64cf05 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1673,6 +1673,68 @@ plug_in_mosaic_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_nova_invoker (GimpProcedure         *procedure,
+                      Gimp                  *gimp,
+                      GimpContext           *context,
+                      GimpProgress          *progress,
+                      const GimpValueArray  *args,
+                      GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 xcenter;
+  gint32 ycenter;
+  GimpRGB color;
+  gint32 radius;
+  gint32 nspoke;
+  gint32 randomhue;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  xcenter = g_value_get_int (gimp_value_array_index (args, 3));
+  ycenter = g_value_get_int (gimp_value_array_index (args, 4));
+  gimp_value_get_rgb (gimp_value_array_index (args, 5), &color);
+  radius = g_value_get_int (gimp_value_array_index (args, 6));
+  nspoke = g_value_get_int (gimp_value_array_index (args, 7));
+  randomhue = g_value_get_int (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;
+          GeglColor *gegl_color = gimp_gegl_color_new (&color);
+          gdouble    center_x   = (gdouble) xcenter / (gdouble) gimp_item_get_width (GIMP_ITEM (drawable));
+          gdouble    center_y   = (gdouble) ycenter / (gdouble) gimp_item_get_height (GIMP_ITEM (drawable));
+
+          node = gegl_node_new_child (NULL,
+                                      "operation",    "gegl:supernova",
+                                      "center-x",     center_x,
+                                      "center-y",     center_y,
+                                      "radius",       radius,
+                                      "spokes-count", nspoke,
+                                      "random-hue",   randomhue,
+                                      "color",        gegl_color,
+                                      "seed",         g_random_int (),
+                                      NULL);
+
+          g_object_unref (gegl_color);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Supernova"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_pixelize_invoker (GimpProcedure         *procedure,
                           Gimp                  *gimp,
                           GimpContext           *context,
@@ -4219,6 +4281,79 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-nova
+   */
+  procedure = gimp_procedure_new (plug_in_nova_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-nova");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-nova",
+                                     "Add a starburst to the image",
+                                     "This plug-in produces an effect like a supernova burst. The amount of 
the light effect is approximately in proportion to 1/r, where r is the distance from the center of the star.",
+                                     "Compatibility procedure. Please see 'gegl:supernova' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:supernova' 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,
+                               gimp_param_spec_int32 ("xcenter",
+                                                      "xcenter",
+                                                      "X coordinates of the center of supernova",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("ycenter",
+                                                      "ycenter",
+                                                      "Y coordinates of the center of supernova",
+                                                      G_MININT32, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_rgb ("color",
+                                                    "color",
+                                                    "Color of supernova",
+                                                    FALSE,
+                                                    NULL,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("radius",
+                                                      "radius",
+                                                      "Radius of supernova",
+                                                      1, 3000, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("nspoke",
+                                                      "nspoke",
+                                                      "Number of spokes",
+                                                      1, 1024, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("randomhue",
+                                                      "randomhue",
+                                                      "Random hue",
+                                                      0, 360, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-pixelize
    */
   procedure = gimp_procedure_new (plug_in_pixelize_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 14f9187..9dd20c1 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -172,8 +172,6 @@
 /nl-filter.exe
 /noise-solid
 /noise-solid.exe
-/nova
-/nova.exe
 /oilify
 /oilify.exe
 /photocopy
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index d5b6242..8e5ee1f 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -129,7 +129,6 @@ libexec_PROGRAMS = \
        newsprint \
        nl-filter \
        noise-solid \
-       nova \
        oilify \
        photocopy \
        plugin-browser \
@@ -1688,23 +1687,6 @@ noise_solid_LDADD = \
        $(INTLLIBS)             \
        $(noise_solid_RC)
 
-nova_SOURCES = \
-       nova.c
-
-nova_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(nova_RC)
-
 oilify_SOURCES = \
        oilify.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 2f956fb..b5a01bb 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -83,7 +83,6 @@ metadata_RC = metadata.rc.o
 newsprint_RC = newsprint.rc.o
 nl_filter_RC = nl-filter.rc.o
 noise_solid_RC = noise-solid.rc.o
-nova_RC = nova.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 2caeb92..52976e8 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -84,7 +84,6 @@
     'newsprint' => { ui => 1 },
     'nl-filter' => { ui => 1 },
     'noise-solid' => { ui => 1 },
-    'nova' => { 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 de91c2e..f635099 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -88,7 +88,6 @@ 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/nova.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 8fb7d48..d614c8e 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -1692,6 +1692,76 @@ CODE
     );
 }
 
+sub plug_in_nova {
+    $blurb = 'Add a starburst to the image';
+
+    $help = <<'HELP';
+This plug-in produces an effect like a supernova burst. The amount of
+the light effect is approximately in proportion to 1/r, where r is the
+distance from the center of the star.
+HELP
+
+    &std_pdb_compat('gegl:supernova');
+    $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 => 'xcenter', type => 'int32',
+          desc => 'X coordinates of the center of supernova' },
+        { name => 'ycenter', type => 'int32',
+          desc => 'Y coordinates of the center of supernova' },
+       { name => 'color', type => 'color',
+         desc => 'Color of supernova' },
+        { name => 'radius', type => '1 <= int32 <= 3000',
+          desc => 'Radius of supernova' },
+        { name => 'nspoke', type => '1 <= int32 <= 1024',
+          desc => 'Number of spokes' },
+        { name => 'randomhue', type => '0 <= int32 <= 360',
+          desc => 'Random hue' }
+    );
+
+    %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;
+      GeglColor *gegl_color = gimp_gegl_color_new (&color);
+      gdouble    center_x   = (gdouble) xcenter / (gdouble) gimp_item_get_width (GIMP_ITEM (drawable));
+      gdouble    center_y   = (gdouble) ycenter / (gdouble) gimp_item_get_height (GIMP_ITEM (drawable));
+
+      node = gegl_node_new_child (NULL,
+                                  "operation",    "gegl:supernova",
+                                  "center-x",     center_x,
+                                  "center-y",     center_y,
+                                  "radius",       radius,
+                                  "spokes-count", nspoke,
+                                  "random-hue",   randomhue,
+                                  "color",        gegl_color,
+                                  "seed",         g_random_int (),
+                                  NULL);
+
+      g_object_unref (gegl_color);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Supernova"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_pixelize {
     $blurb = 'Simplify image into an array of solid-colored squares';
 
@@ -3039,6 +3109,7 @@ CODE
             plug_in_mblur
             plug_in_mblur_inward
             plug_in_mosaic
+            plug_in_nova
             plug_in_pixelize
             plug_in_pixelize2
             plug_in_plasma


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