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



commit 7313cb559edcd82312bb72adbfdf8aef59adad60
Author: Michael Natterer <mitch gimp org>
Date:   Thu Dec 4 20:42:15 2014 +0100

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

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |   91 ++++++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   18 --
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/illusion.c          |  436 -----------------------------------
 plug-ins/common/plugin-defs.pl      |    1 -
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   50 ++++
 9 files changed, 142 insertions(+), 460 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 241d682..626d734 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 746 procedures registered total */
+/* 747 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 b01d5d9..454722f 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1252,6 +1252,49 @@ plug_in_hsv_noise_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_illusion_invoker (GimpProcedure         *procedure,
+                          Gimp                  *gimp,
+                          GimpContext           *context,
+                          GimpProgress          *progress,
+                          const GimpValueArray  *args,
+                          GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 division;
+  gint32 type;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  division = g_value_get_int (gimp_value_array_index (args, 3));
+  type = g_value_get_int (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:illusion",
+                                 "division",      (gint) division,
+                                 "illusion-type", (gint) type,
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Illusion"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 plug_in_laplace_invoker (GimpProcedure         *procedure,
                          Gimp                  *gimp,
                          GimpContext           *context,
@@ -4061,6 +4104,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-illusion
+   */
+  procedure = gimp_procedure_new (plug_in_illusion_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-illusion");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-illusion",
+                                     "Superimpose many altered copies of the image",
+                                     "Produce illusion.",
+                                     "Compatibility procedure. Please see 'gegl:illusion' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:illusion' 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 ("division",
+                                                      "division",
+                                                      "The number of divisions",
+                                                      0, 64, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("type",
+                                                      "type",
+                                                      "Illusion type { TYPE1 (0), TYPE2 (1) }",
+                                                      0, 1, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-plug-in-laplace
    */
   procedure = gimp_procedure_new (plug_in_laplace_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index f7be41c..0da43b2 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -152,8 +152,6 @@
 /guillotine.exe
 /hot
 /hot.exe
-/illusion
-/illusion.exe
 /jigsaw
 /jigsaw.exe
 /lcms
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 50c6c4c..1e921e8 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -119,7 +119,6 @@ libexec_PROGRAMS = \
        grid \
        guillotine \
        hot \
-       illusion \
        jigsaw \
        lcms \
        lens-flare \
@@ -1508,23 +1507,6 @@ hot_LDADD = \
        $(INTLLIBS)             \
        $(hot_RC)
 
-illusion_SOURCES = \
-       illusion.c
-
-illusion_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(illusion_RC)
-
 jigsaw_SOURCES = \
        jigsaw.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 50665a3..9dcf4e7 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -73,7 +73,6 @@ gradient_map_RC = gradient-map.rc.o
 grid_RC = grid.rc.o
 guillotine_RC = guillotine.rc.o
 hot_RC = hot.rc.o
-illusion_RC = illusion.rc.o
 jigsaw_RC = jigsaw.rc.o
 lcms_RC = lcms.rc.o
 lens_flare_RC = lens-flare.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 84fb352..8f4c4c3 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -74,7 +74,6 @@
     'grid' => { ui => 1 },
     'guillotine' => {},
     'hot' => { ui => 1 },
-    'illusion' => { ui => 1 },
     'jigsaw' => { ui => 1 },
     'lcms' => { ui => 1, gegl => 1, libs => 'LCMS_LIBS', cflags => 'LCMS_CFLAGS' },
     'lens-flare' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 2d32190..6709517 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -78,7 +78,6 @@ plug-ins/common/gradient-map.c
 plug-ins/common/grid.c
 plug-ins/common/guillotine.c
 plug-ins/common/hot.c
-plug-ins/common/illusion.c
 plug-ins/common/jigsaw.c
 plug-ins/common/lcms.c
 plug-ins/common/lens-flare.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 5235792..c5bf2cb 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -1225,6 +1225,55 @@ CODE
     );
 }
 
+sub plug_in_illusion {
+    $blurb = 'Superimpose many altered copies of the image';
+
+    $help = <<'HELP';
+Produce illusion.
+HELP
+
+    &std_pdb_compat('gegl:illusion');
+    $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 => 'division', type => '0 <= int32 <= 64',
+          desc => 'The number of divisions' },
+        { name => 'type', type => '0 <= int32 <= 1',
+          desc => 'Illusion type { TYPE1 (0), TYPE2 (1) }' }
+    );
+
+    %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:illusion",
+                             "division",      (gint) division,
+                             "illusion-type", (gint) type,
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Illusion"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_laplace {
     $blurb = 'High-resolution edge detection';
 
@@ -3276,6 +3325,7 @@ CODE
             plug_in_gauss_rle2
             plug_in_glasstile
             plug_in_hsv_noise
+            plug_in_illusion
             plug_in_laplace
             plug_in_lens_distortion
             plug_in_make_seamless


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