[gimp] plug-ins, pdb: remove the blur-gauss-selective plug-in, add a PDB compat proc



commit 16a042189407125bab5d0c0a67b5efbe373774a3
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 29 22:01:53 2015 +0100

    plug-ins, pdb: remove the blur-gauss-selective plug-in, add a PDB compat proc

 app/pdb/internal-procs.c               |    2 +-
 app/pdb/plug-in-compat-cmds.c          |   92 ++++
 plug-ins/common/.gitignore             |    2 -
 plug-ins/common/Makefile.am            |   20 -
 plug-ins/common/blur-gauss-selective.c |  852 --------------------------------
 plug-ins/common/gimprc.common          |    1 -
 plug-ins/common/plugin-defs.pl         |    1 -
 po-plug-ins/POTFILES.in                |    1 -
 tools/pdbgen/pdb/plug_in_compat.pdb    |   55 ++
 9 files changed, 148 insertions(+), 878 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 3d24d91..6f5fb9f 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 789 procedures registered total */
+/* 790 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 a6969f2..c07b846 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -3472,6 +3472,50 @@ plug_in_noisify_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+plug_in_sel_gauss_invoker (GimpProcedure         *procedure,
+                           Gimp                  *gimp,
+                           GimpContext           *context,
+                           GimpProgress          *progress,
+                           const GimpValueArray  *args,
+                           GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble radius;
+  gint32 max_delta;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  radius = g_value_get_double (gimp_value_array_index (args, 3));
+  max_delta = 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;
+
+          node = gegl_node_new_child (NULL,
+                                      "operation",   "gegl:gaussian-blur-selective",
+                                      "blur-radius", radius,
+                                      "max-delta",   (gdouble) max_delta / 255.0,
+                                      NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Selective Gaussian Blur"),
+                                         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,
@@ -7609,6 +7653,54 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-plug-in-sel-gauss
+   */
+  procedure = gimp_procedure_new (plug_in_sel_gauss_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-sel-gauss");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-sel-gauss",
+                                     "Blur neighboring pixels, but only in low-contrast areas",
+                                     "This filter functions similar to the regular gaussian blur filter 
except that neighbouring pixels that differ more than the given maxdelta parameter will not be blended with. 
This way with the correct parameters, an image can be smoothed out without losing details. However, this 
filter can be rather slow.",
+                                     "Compatibility procedure. Please see 'gegl:gaussian-blur-selective' for 
credits.",
+                                     "Compatibility procedure. Please see 'gegl:gaussian-blur-selective' for 
credits.",
+                                     "2099",
+                                     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 ("radius",
+                                                    "radius",
+                                                    "Radius of gaussian blur (in pixels)",
+                                                    0.0, G_MAXDOUBLE, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("max-delta",
+                                                      "max delta",
+                                                      "Maximum delta",
+                                                      0, 255, 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 c7dc24b..f661e5c 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -12,8 +12,6 @@
 /blinds.exe
 /blur
 /blur.exe
-/blur-gauss-selective
-/blur-gauss-selective.exe
 /border-average
 /border-average.exe
 /cartoon
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 0995134..899a817 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -49,7 +49,6 @@ libexec_PROGRAMS = \
        animation-play \
        blinds \
        blur \
-       blur-gauss-selective \
        border-average \
        cartoon \
        checkerboard \
@@ -251,25 +250,6 @@ blur_LDADD = \
        $(INTLLIBS)             \
        $(blur_RC)
 
-blur_gauss_selective_CFLAGS = $(MMX_EXTRA_CFLAGS)
-
-blur_gauss_selective_SOURCES = \
-       blur-gauss-selective.c
-
-blur_gauss_selective_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(blur_gauss_selective_RC)
-
 border_average_SOURCES = \
        border-average.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index afe68b9..1045642 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -3,7 +3,6 @@ animation_optimize_RC = animation-optimize.rc.o
 animation_play_RC = animation-play.rc.o
 blinds_RC = blinds.rc.o
 blur_RC = blur.rc.o
-blur_gauss_selective_RC = blur-gauss-selective.rc.o
 border_average_RC = border-average.rc.o
 cartoon_RC = cartoon.rc.o
 checkerboard_RC = checkerboard.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index a3356a3..a402065 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -4,7 +4,6 @@
     'animation-play' => { ui => 1, gegl => 1 },
     'blinds' => { ui => 1 },
     'blur' => {},
-    'blur-gauss-selective' => { ui => 1, cflags => 'MMX_EXTRA_CFLAGS' },
     'border-average' => { ui => 1, gegl => 1 },
     'cartoon' => { ui => 1 },
     'checkerboard' => { ui => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index ac3749e..27c70eb 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -8,7 +8,6 @@ plug-ins/common/animation-optimize.c
 plug-ins/common/animation-play.c
 plug-ins/common/blinds.c
 plug-ins/common/blur.c
-plug-ins/common/blur-gauss-selective.c
 plug-ins/common/border-average.c
 plug-ins/common/cartoon.c
 plug-ins/common/checkerboard.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index fc948df..48a2e49 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -3543,6 +3543,60 @@ CODE
     );
 }
 
+sub plug_in_sel_gauss {
+    $blurb = 'Blur neighboring pixels, but only in low-contrast areas';
+
+    $help = <<'HELP';
+This filter functions similar to the regular gaussian blur filter
+except that neighbouring pixels that differ more than the given
+maxdelta parameter will not be blended with. This way with the correct
+parameters, an image can be smoothed out without losing
+details. However, this filter can be rather slow.
+HELP
+
+    &std_pdb_compat('gegl:gaussian-blur-selective');
+    $date = '2099';
+
+    @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 => 'radius', type => '0.0 < float',
+          desc => 'Radius of gaussian blur (in pixels)' },
+        { name => 'max_delta', type => '0 <= int32 <= 255',
+          desc => 'Maximum delta' }
+    );
+
+    %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;
+
+      node = gegl_node_new_child (NULL,
+                                  "operation",   "gegl:gaussian-blur-selective",
+                                  "blur-radius", radius,
+                                  "max-delta",   (gdouble) max_delta / 255.0,
+                                  NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Selective Gaussian Blur"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_semiflatten {
     $blurb = 'Replace partial transparency with the current background color';
 
@@ -4875,6 +4929,7 @@ CODE
             plug_in_rgb_noise
             plug_in_rotate
             plug_in_noisify
+            plug_in_sel_gauss
             plug_in_semiflatten
             plug_in_shift
             plug_in_sinus


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