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



commit 769bc933d4dfb2fa0e2b215ec9384822a6549acc
Author: Thomas Manni <thomas manni free fr>
Date:   Thu Jun 11 01:26:49 2015 +0200

    plug-ins, pdb: remove the wind plug-in and add a PDB compat proc

 app/pdb/internal-procs.c            |    2 +-
 app/pdb/plug-in-compat-cmds.c       |  118 ++++
 plug-ins/common/.gitignore          |    2 -
 plug-ins/common/Makefile.am         |   21 +-
 plug-ins/common/gimprc.common       |    1 -
 plug-ins/common/plugin-defs.pl      |    3 +-
 plug-ins/common/wind.c              | 1048 -----------------------------------
 po-plug-ins/POTFILES.in             |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb |   61 ++-
 9 files changed, 182 insertions(+), 1075 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index cada75b..ca8a863 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 761 procedures registered total */
+/* 762 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 a4d26c2..c255b39 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -3575,6 +3575,58 @@ plug_in_whirl_pinch_invoker (GimpProcedure         *procedure,
                                            error ? *error : NULL);
 }
 
+static GimpValueArray *
+plug_in_wind_invoker (GimpProcedure         *procedure,
+                      Gimp                  *gimp,
+                      GimpContext           *context,
+                      GimpProgress          *progress,
+                      const GimpValueArray  *args,
+                      GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 threshold;
+  gint32 direction;
+  gint32 strength;
+  gint32 algorithm;
+  gint32 edge;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  threshold = g_value_get_int (gimp_value_array_index (args, 3));
+  direction = g_value_get_int (gimp_value_array_index (args, 4));
+  strength = g_value_get_int (gimp_value_array_index (args, 5));
+  algorithm = g_value_get_int (gimp_value_array_index (args, 6));
+  edge = g_value_get_int (gimp_value_array_index (args, 7));
+
+  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:wind",
+                                 "threshold", threshold,
+                                 "direction", direction,
+                                 "strength",  strength,
+                                 "style",     algorithm,
+                                 "edge",      edge,
+                                 NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Wind"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
 void
 register_plug_in_compat_procs (GimpPDB *pdb)
 {
@@ -7127,4 +7179,70 @@ register_plug_in_compat_procs (GimpPDB *pdb)
                                                     GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
+
+  /*
+   * gimp-plug-in-wind
+   */
+  procedure = gimp_procedure_new (plug_in_wind_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-wind");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-wind",
+                                     "Smear image to give windblown effect",
+                                     "Renders a wind effect.",
+                                     "Compatibility procedure. Please see 'gegl:wind' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:wind' for credits.",
+                                     "2015",
+                                     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 ("threshold",
+                                                      "threshold",
+                                                      "Controls where blending will be done",
+                                                      0, 50, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("direction",
+                                                      "direction",
+                                                      "Wind direction { 0:left, 1:right, 2:top, 3:bottom }",
+                                                      0, 3, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("strength",
+                                                      "strength",
+                                                      "Controls the extent of the blending",
+                                                      1, 100, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("algorithm",
+                                                      "algorithm",
+                                                      "Algorithm { WIND (0), BLAST (1) }",
+                                                      0, 1, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("edge",
+                                                      "edge",
+                                                      "Affected edge { BOTH (0), LEADING (1), TRAILING (2) 
}",
+                                                      0, 2, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
 }
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 5038140..9b3d1f8 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -202,5 +202,3 @@
 /web-browser.exe
 /web-page
 /web-page.exe
-/wind
-/wind.exe
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index dc489a5..70bc258 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -143,8 +143,8 @@ libexec_PROGRAMS = \
        van-gogh-lic \
        warp \
        web-browser \
-       $(WEB_PAGE) \
-       wind
+       $(WEB_PAGE)
+
 
 EXTRA_PROGRAMS = \
        file-aa \
@@ -1940,20 +1940,3 @@ web_page_LDADD = \
        $(RT_LIBS)              \
        $(INTLLIBS)             \
        $(web_page_RC)
-
-wind_SOURCES = \
-       wind.c
-
-wind_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(wind_RC)
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 56d8ef7..5b40760 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -98,4 +98,3 @@ van_gogh_lic_RC = van-gogh-lic.rc.o
 warp_RC = warp.rc.o
 web_browser_RC = web-browser.rc.o
 web_page_RC = web-page.rc.o
-wind_RC = wind.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index a9e615c..c9e719b 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -98,6 +98,5 @@
     'van-gogh-lic' => { ui => 1 },
     'warp' => { ui => 1 },
     'web-browser' => { ui => 1 },
-    'web-page' => { ui => 1, optional => 1, libs => 'WEBKIT_LIBS', cflags => 'WEBKIT_CFLAGS' },
-    'wind' => { ui => 1 }
+    'web-page' => { ui => 1, optional => 1, libs => 'WEBKIT_LIBS', cflags => 'WEBKIT_CFLAGS' }
 );
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 376879e..86712f9 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -103,7 +103,6 @@ plug-ins/common/van-gogh-lic.c
 plug-ins/common/warp.c
 plug-ins/common/web-browser.c
 plug-ins/common/web-page.c
-plug-ins/common/wind.c
 plug-ins/file-bmp/bmp-read.c
 plug-ins/file-bmp/bmp-write.c
 plug-ins/file-bmp/bmp.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index 4c92b43..5128f0a 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -3852,6 +3852,64 @@ CODE
     );
 }
 
+sub plug_in_wind {
+    $blurb = 'Smear image to give windblown effect';
+
+    $help = <<'HELP';
+Renders a wind effect.
+HELP
+
+    &std_pdb_compat('gegl:wind');
+    $date = '2015';
+
+    @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 => 'threshold', type => '0 <= int32 <= 50',
+    desc => 'Controls where blending will be done' },
+  { name => 'direction', type => '0 <= int32 <= 3',
+    desc => 'Wind direction { 0:left, 1:right, 2:top, 3:bottom }' },
+  { name => 'strength', type => '1 <= int32 <= 100',
+    desc => 'Controls the extent of the blending' },
+  { name => 'algorithm', type => '0 <= int32 <= 1',
+    desc => 'Algorithm { WIND (0), BLAST (1) }' },
+  { name => 'edge', type => '0 <= int32 <= 2',
+    desc => 'Affected edge { BOTH (0), LEADING (1), TRAILING (2) }' },
+    );
+
+    %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:wind",
+                             "threshold", threshold,
+                             "direction", direction,
+                             "strength",  strength,
+                             "style",     algorithm,
+                             "edge",      edge,
+                             NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Wind"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 $extra{app}->{code} = <<'CODE';
 static GeglNode *
 wrap_in_selection_bounds (GeglNode     *node,
@@ -4075,7 +4133,8 @@ CODE
             plug_in_dilate
             plug_in_erode
             plug_in_waves
-            plug_in_whirl_pinch);
+            plug_in_whirl_pinch
+            plug_in_wind);
 
 %exports = (app => [ procs], lib => []);
 


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