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



commit 2ead56096d9813f710f4fb545e1b70502affe53b
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jul 14 21:34:27 2019 +0200

    plug-ins, pdb: remove the softglow plug-in and add a PDB compat procedure
    
    Not for 2.10 because the GEGL op's result looks different. I have no
    clue how softglow is supposed to look at all, but the removed plug-in
    did things that can't possibly be done with physical light in a
    darkroom, so chances are the GEGL op is more correct.

 app/pdb/internal-procs.c       |   2 +-
 app/pdb/plug-in-compat-cmds.c  | 102 ++++++
 pdb/groups/plug_in_compat.pdb  |  64 ++++
 plug-ins/common/.gitignore     |   2 -
 plug-ins/common/Makefile.am    |  19 --
 plug-ins/common/gimprc.common  |   1 -
 plug-ins/common/plugin-defs.pl |   1 -
 plug-ins/common/softglow.c     | 723 -----------------------------------------
 po-plug-ins/POTFILES.in        |   1 -
 9 files changed, 167 insertions(+), 748 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 4a4674c786..3cbfb383e1 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 740 procedures registered total */
+/* 741 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 2ba137e6cb..5c12fdda07 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -3809,6 +3809,54 @@ plug_in_sobel_invoker (GimpProcedure         *procedure,
                                            error ? *error : NULL);
 }
 
+static GimpValueArray *
+plug_in_softglow_invoker (GimpProcedure         *procedure,
+                          Gimp                  *gimp,
+                          GimpContext           *context,
+                          GimpProgress          *progress,
+                          const GimpValueArray  *args,
+                          GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble glow_radius;
+  gdouble brightness;
+  gdouble sharpness;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  glow_radius = g_value_get_double (gimp_value_array_index (args, 3));
+  brightness = g_value_get_double (gimp_value_array_index (args, 4));
+  sharpness = g_value_get_double (gimp_value_array_index (args, 5));
+
+  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:softglow",
+                                 "glow-radius", glow_radius,
+                                 "brightness",  brightness,
+                                 "sharpness",   sharpness,
+                                 NULL);
+
+          node = wrap_in_gamma_cast (node, drawable);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Softglow"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
 static GimpValueArray *
 plug_in_solid_noise_invoker (GimpProcedure         *procedure,
                              Gimp                  *gimp,
@@ -8211,6 +8259,60 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
+  /*
+   * gimp-plug-in-softglow
+   */
+  procedure = gimp_procedure_new (plug_in_softglow_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-softglow");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-softglow",
+                                     "Simulate glow by making highlights intense and fuzzy",
+                                     "Gives an image a softglow effect by intensifying the highlights in the 
image. This is done by screening a modified version of the drawable with itself. The modified version is 
desaturated and then a sigmoidal transfer function is applied to force the distribution of intensities into 
very small and very large only. This desaturated version is then blurred to give it a fuzzy 
'vaseline-on-the-lens' effect. The glow radius parameter controls the sharpness of the glow effect. The 
brightness parameter controls the degree of intensification applied to image highlights. The sharpness 
parameter controls how defined or alternatively, diffuse, the glow effect should be.",
+                                     "Compatibility procedure. Please see 'gegl:softglow' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:softglow' for credits.",
+                                     "2019",
+                                     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 ("glow-radius",
+                                                    "glow radius",
+                                                    "Glow radius in pixels",
+                                                    0, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("brightness",
+                                                    "brightness",
+                                                    "Glow brightness",
+                                                    0.0, 1.0, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("sharpness",
+                                                    "sharpness",
+                                                    "Glow sharpness",
+                                                    0.0, 1.0, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
   /*
    * gimp-plug-in-solid-noise
    */
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index cbca2f7470..fcd7c4e3d3 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -3981,6 +3981,69 @@ CODE
     );
 }
 
+sub plug_in_softglow {
+    $blurb = 'Simulate glow by making highlights intense and fuzzy';
+
+    $help = <<'HELP';
+Gives an image a softglow effect by intensifying the highlights in the
+image. This is done by screening a modified version of the drawable
+with itself. The modified version is desaturated and then a sigmoidal
+transfer function is applied to force the distribution of intensities
+into very small and very large only. This desaturated version is then
+blurred to give it a fuzzy 'vaseline-on-the-lens' effect. The glow
+radius parameter controls the sharpness of the glow effect. The
+brightness parameter controls the degree of intensification applied to
+image highlights. The sharpness parameter controls how defined or
+alternatively, diffuse, the glow effect should be.
+HELP
+
+    &std_pdb_compat('gegl:softglow');
+    $date = '2019';
+
+    @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 => 'glow_radius', type => '0 <= float',
+         desc => 'Glow radius in pixels' },
+       { name => 'brightness', type => '0.0 <= float <= 1.0',
+         desc => 'Glow brightness' },
+       { name => 'sharpness', type => '0.0 <= float <= 1.0',
+         desc => 'Glow sharpness' }
+    );
+
+    %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:softglow",
+                             "glow-radius", glow_radius,
+                             "brightness",  brightness,
+                             "sharpness",   sharpness,
+                             NULL);
+
+      node = wrap_in_gamma_cast (node, drawable);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Softglow"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_solid_noise {
     $blurb = 'Create a random cloud-like texture';
 
@@ -5107,6 +5170,7 @@ CODE
             plug_in_shift
             plug_in_sinus
             plug_in_sobel
+            plug_in_softglow
             plug_in_solid_noise
             plug_in_spread
             plug_in_threshold_alpha
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 216a3faa82..e8fbb1a877 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -150,8 +150,6 @@
 /sharpen.exe
 /smooth-palette
 /smooth-palette.exe
-/softglow
-/softglow.exe
 /sparkle
 /sparkle.exe
 /sphere-designer
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index b4cf6f7fa0..9e478a14b1 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -120,7 +120,6 @@ qbist_libexecdir = $(gimpplugindir)/plug-ins/qbist
 sample_colorize_libexecdir = $(gimpplugindir)/plug-ins/sample-colorize
 sharpen_libexecdir = $(gimpplugindir)/plug-ins/sharpen
 smooth_palette_libexecdir = $(gimpplugindir)/plug-ins/smooth-palette
-softglow_libexecdir = $(gimpplugindir)/plug-ins/softglow
 sparkle_libexecdir = $(gimpplugindir)/plug-ins/sparkle
 sphere_designer_libexecdir = $(gimpplugindir)/plug-ins/sphere-designer
 tile_libexecdir = $(gimpplugindir)/plug-ins/tile
@@ -207,7 +206,6 @@ qbist_libexec_PROGRAMS = qbist
 sample_colorize_libexec_PROGRAMS = sample-colorize
 sharpen_libexec_PROGRAMS = sharpen
 smooth_palette_libexec_PROGRAMS = smooth-palette
-softglow_libexec_PROGRAMS = softglow
 sparkle_libexec_PROGRAMS = sparkle
 sphere_designer_libexec_PROGRAMS = sphere-designer
 tile_libexec_PROGRAMS = tile
@@ -1573,23 +1571,6 @@ smooth_palette_LDADD = \
        $(INTLLIBS)             \
        $(smooth_palette_RC)
 
-softglow_SOURCES = \
-       softglow.c
-
-softglow_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(softglow_RC)
-
 sparkle_SOURCES = \
        sparkle.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index d0f056754e..08f017ec4c 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -72,7 +72,6 @@ qbist_RC = qbist.rc.o
 sample_colorize_RC = sample-colorize.rc.o
 sharpen_RC = sharpen.rc.o
 smooth_palette_RC = smooth-palette.rc.o
-softglow_RC = softglow.rc.o
 sparkle_RC = sparkle.rc.o
 sphere_designer_RC = sphere-designer.rc.o
 tile_RC = tile.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 1bc05b0986..3bc5dbfdf5 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -74,7 +74,6 @@
     'sample-colorize' => { ui => 1, gegl => 1 },
     'sharpen' => { ui => 1 },
     'smooth-palette' => { ui => 1, gegl => 1 },
-    'softglow' => { ui => 1 },
     'sparkle' => { ui => 1, gegl => 1 },
     'sphere-designer' => { ui => 1, gegl => 1 },
     'tile' => { ui => 1, gegl => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 3d3b2e9843..9f130c8017 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -78,7 +78,6 @@ plug-ins/common/qbist.c
 plug-ins/common/sample-colorize.c
 plug-ins/common/sharpen.c
 plug-ins/common/smooth-palette.c
-plug-ins/common/softglow.c
 plug-ins/common/sparkle.c
 plug-ins/common/sphere-designer.c
 plug-ins/common/tile.c


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