[gimp/gimp-2-10] plug-ins, pdb: remove the contrast-normalize plug-in



commit 6f5f466321df0ac913f63fe25e0fcdb66e3c0f40
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jul 14 14:28:40 2019 +0200

    plug-ins, pdb: remove the contrast-normalize plug-in
    
    and add a PDB compat procedure.
    
    (cherry picked from commit 8fcccf3f881d2aa921b767aabafa1c7363952ad0)

 app/pdb/internal-procs.c             |   2 +-
 app/pdb/plug-in-compat-cmds.c        |  76 ++++++++
 pdb/groups/plug_in_compat.pdb        |  52 +++++
 plug-ins/common/.gitignore           |   2 -
 plug-ins/common/Makefile.am          |  17 --
 plug-ins/common/contrast-normalize.c | 354 -----------------------------------
 plug-ins/common/gimprc.common        |   1 -
 plug-ins/common/plugin-defs.pl       |   1 -
 po-plug-ins/POTFILES.in              |   1 -
 9 files changed, 129 insertions(+), 377 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 630450faff..26a3c3f049 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 844 procedures registered total */
+/* 845 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 0d06beecc4..a86fcabfd1 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -2787,6 +2787,46 @@ plug_in_neon_invoker (GimpProcedure         *procedure,
                                            error ? *error : NULL);
 }
 
+static GimpValueArray *
+plug_in_normalize_invoker (GimpProcedure         *procedure,
+                           Gimp                  *gimp,
+                           GimpContext           *context,
+                           GimpProgress          *progress,
+                           const GimpValueArray  *args,
+                           GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+
+  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:stretch-contrast",
+                                      "keep-colors", TRUE,
+                                      "perceptual",  TRUE,
+                                      NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Normalize"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
 static GimpValueArray *
 plug_in_nova_invoker (GimpProcedure         *procedure,
                       Gimp                  *gimp,
@@ -7102,6 +7142,42 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
+  /*
+   * gimp-plug-in-normalize
+   */
+  procedure = gimp_procedure_new (plug_in_normalize_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-normalize");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-normalize",
+                                     "Stretch brightness values to cover the full range",
+                                     "This plug-in performs almost the same operation as the 'contrast 
autostretch' plug-in, except that it won't allow the color channels to normalize independently. This is 
actually what most people probably want instead of contrast-autostretch; use c-a only if you wish to remove 
an undesirable color-tint from a source image which is supposed to contain pure-white and pure-black.",
+                                     "Compatibility procedure. Please see 'gegl:stretch-contrast' for 
credits.",
+                                     "Compatibility procedure. Please see 'gegl:stretch-contrast' 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_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
   /*
    * gimp-plug-in-nova
    */
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index 030635c1d2..eea04197ec 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -2771,6 +2771,57 @@ CODE
     );
 }
 
+sub plug_in_normalize {
+    $blurb = 'Stretch brightness values to cover the full range';
+
+    $help = <<'HELP';
+This plug-in performs almost the same operation as the 'contrast
+autostretch' plug-in, except that it won't allow the color channels to
+normalize independently.  This is actually what most people probably
+want instead of contrast-autostretch; use c-a only if you wish to
+remove an undesirable color-tint from a source image which is supposed
+to contain pure-white and pure-black.
+HELP
+
+    &std_pdb_compat('gegl:stretch-contrast');
+    $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' }
+    );
+
+    %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:stretch-contrast",
+                                  "keep-colors", TRUE,
+                                  "perceptual",  TRUE,
+                                  NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Normalize"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_nova {
     $blurb = 'Add a starburst to the image';
 
@@ -5116,6 +5167,7 @@ CODE
             plug_in_mblur_inward
             plug_in_mosaic
             plug_in_neon
+            plug_in_normalize
             plug_in_nova
             plug_in_papertile
             plug_in_pixelize
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 58b0f604c5..5e224aeedd 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -32,8 +32,6 @@
 /colormap-remap.exe
 /compose
 /compose.exe
-/contrast-normalize
-/contrast-normalize.exe
 /contrast-retinex
 /contrast-retinex.exe
 /crop-zealous
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index a5588fb2d0..5be08b2ef0 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -61,7 +61,6 @@ color_enhance_libexecdir = $(gimpplugindir)/plug-ins/color-enhance
 colorify_libexecdir = $(gimpplugindir)/plug-ins/colorify
 colormap_remap_libexecdir = $(gimpplugindir)/plug-ins/colormap-remap
 compose_libexecdir = $(gimpplugindir)/plug-ins/compose
-contrast_normalize_libexecdir = $(gimpplugindir)/plug-ins/contrast-normalize
 contrast_retinex_libexecdir = $(gimpplugindir)/plug-ins/contrast-retinex
 crop_zealous_libexecdir = $(gimpplugindir)/plug-ins/crop-zealous
 curve_bend_libexecdir = $(gimpplugindir)/plug-ins/curve-bend
@@ -155,7 +154,6 @@ color_enhance_libexec_PROGRAMS = color-enhance
 colorify_libexec_PROGRAMS = colorify
 colormap_remap_libexec_PROGRAMS = colormap-remap
 compose_libexec_PROGRAMS = compose
-contrast_normalize_libexec_PROGRAMS = contrast-normalize
 contrast_retinex_libexec_PROGRAMS = contrast-retinex
 crop_zealous_libexec_PROGRAMS = crop-zealous
 curve_bend_libexec_PROGRAMS = curve-bend
@@ -518,21 +516,6 @@ compose_LDADD = \
        $(INTLLIBS)             \
        $(compose_RC)
 
-contrast_normalize_SOURCES = \
-       contrast-normalize.c
-
-contrast_normalize_LDADD = \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(CAIRO_LIBS)           \
-       $(GDK_PIXBUF_LIBS)      \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(contrast_normalize_RC)
-
 contrast_retinex_SOURCES = \
        contrast-retinex.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 77d946983b..fc319399bc 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -13,7 +13,6 @@ color_enhance_RC = color-enhance.rc.o
 colorify_RC = colorify.rc.o
 colormap_remap_RC = colormap-remap.rc.o
 compose_RC = compose.rc.o
-contrast_normalize_RC = contrast-normalize.rc.o
 contrast_retinex_RC = contrast-retinex.rc.o
 crop_zealous_RC = crop-zealous.rc.o
 curve_bend_RC = curve-bend.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index a979f4f2d0..214fa3ba51 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -14,7 +14,6 @@
     'colorify' => { ui => 1 },
     'colormap-remap' => { ui => 1, gegl => 1 },
     'compose' => { ui => 1, gegl => 1 },
-    'contrast-normalize' => {},
     'contrast-retinex' => { ui => 1, gegl => 1 },
     'crop-zealous' => { gegl => 1 },
     'curve-bend' => { ui => 1, gegl => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index aa3e281588..db0c1f364d 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -18,7 +18,6 @@ plug-ins/common/color-enhance.c
 plug-ins/common/colorify.c
 plug-ins/common/colormap-remap.c
 plug-ins/common/compose.c
-plug-ins/common/contrast-normalize.c
 plug-ins/common/contrast-retinex.c
 plug-ins/common/crop-zealous.c
 plug-ins/common/curve-bend.c


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