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



commit 8a51993e3fdfcfc54d7b382a91d2f30ecf9b2219
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jul 18 15:05:48 2019 +0200

    pdb, plug-ins: remove the emboss plug-in and add a PDB compat procedure
    
    Not for 2.10 because it looks a bit different.

 app/pdb/internal-procs.c       |   2 +-
 app/pdb/plug-in-compat-cmds.c  | 111 +++++++++
 pdb/groups/plug_in_compat.pdb  |  59 +++++
 plug-ins/common/.gitignore     |   2 -
 plug-ins/common/Makefile.am    |  19 --
 plug-ins/common/emboss.c       | 550 -----------------------------------------
 plug-ins/common/gimprc.common  |   1 -
 plug-ins/common/plugin-defs.pl |   1 -
 po-plug-ins/POTFILES.in        |   1 -
 9 files changed, 171 insertions(+), 575 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 3a30068838..113c95cae2 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 742 procedures registered total */
+/* 743 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 6d22881a04..1447ec27fd 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1627,6 +1627,57 @@ plug_in_edge_invoker (GimpProcedure         *procedure,
                                            error ? *error : NULL);
 }
 
+static GimpValueArray *
+plug_in_emboss_invoker (GimpProcedure         *procedure,
+                        Gimp                  *gimp,
+                        GimpContext           *context,
+                        GimpProgress          *progress,
+                        const GimpValueArray  *args,
+                        GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gdouble azimuth;
+  gdouble elevation;
+  gint32 depth;
+  gboolean emboss;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  azimuth = g_value_get_double (gimp_value_array_index (args, 3));
+  elevation = g_value_get_double (gimp_value_array_index (args, 4));
+  depth = g_value_get_int (gimp_value_array_index (args, 5));
+  emboss = g_value_get_boolean (gimp_value_array_index (args, 6));
+
+  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:emboss",
+                                      "type",       emboss ? 0 : 1,
+                                      "azimuth",    azimuth,
+                                      "elevation",  elevation,
+                                      "depth",      depth,
+                                      NULL);
+
+          node = wrap_in_gamma_cast (node, drawable);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Emboss"),
+                                         node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
 static GimpValueArray *
 plug_in_engrave_invoker (GimpProcedure         *procedure,
                          Gimp                  *gimp,
@@ -5959,6 +6010,66 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
+  /*
+   * gimp-plug-in-emboss
+   */
+  procedure = gimp_procedure_new (plug_in_emboss_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-emboss");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-emboss",
+                                     "Simulate an image created by embossing",
+                                     "Emboss or Bumpmap the given drawable, specifying the angle and 
elevation for the light source.",
+                                     "Compatibility procedure. Please see 'gegl:emboss' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:emboss' 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 ("azimuth",
+                                                    "azimuth",
+                                                    "The Light Angle (degrees)",
+                                                    0.0, 360.0, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("elevation",
+                                                    "elevation",
+                                                    "The Elevation Angle (degrees)",
+                                                    0.0, 180, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("depth",
+                                                      "depth",
+                                                      "The Filter Width",
+                                                      1, 99, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("emboss",
+                                                     "emboss",
+                                                     "Emboss (TRUE), Bumpmap (FALSE)",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
   /*
    * gimp-plug-in-engrave
    */
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index 5b49418f9a..c8db8d79f7 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -1415,6 +1415,64 @@ CODE
     );
 }
 
+sub plug_in_emboss {
+    $blurb = 'Simulate an image created by embossing';
+
+    $help = <<'HELP';
+Emboss or Bumpmap the given drawable, specifying the angle and
+elevation for the light source.
+HELP
+
+    &std_pdb_compat('gegl:emboss');
+    $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 => 'azimuth', type => '0.0 <= float <= 360.0',
+         desc => 'The Light Angle (degrees)' },
+       { name => 'elevation', type => '0.0 <= float <= 180',
+         desc => 'The Elevation Angle (degrees)' },
+       { name => 'depth', type => '0 < int32 < 100',
+         desc => 'The Filter Width' },
+       { name => 'emboss', type => 'boolean',
+         desc => 'Emboss (TRUE), Bumpmap (FALSE)' }
+    );
+
+    %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:emboss",
+                                  "type",       emboss ? 0 : 1,
+                                  "azimuth",    azimuth,
+                                  "elevation",  elevation,
+                                  "depth",      depth,
+                                  NULL);
+
+      node = wrap_in_gamma_cast (node, drawable);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Emboss"),
+                                     node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_engrave {
     $blurb = 'Simulate an antique engraving';
 
@@ -5262,6 +5320,7 @@ CODE
             plug_in_displace_polar
             plug_in_dog
             plug_in_edge
+            plug_in_emboss
             plug_in_engrave
             plug_in_exchange
             plug_in_flarefx
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 6df0f80887..509f28f5e5 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -34,8 +34,6 @@
 /despeckle.exe
 /destripe
 /destripe.exe
-/emboss
-/emboss.exe
 /file-aa
 /file-aa.exe
 /file-cel
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 95bf7a2823..7e946a4507 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -62,7 +62,6 @@ decompose_libexecdir = $(gimpplugindir)/plug-ins/decompose
 depth_merge_libexecdir = $(gimpplugindir)/plug-ins/depth-merge
 despeckle_libexecdir = $(gimpplugindir)/plug-ins/despeckle
 destripe_libexecdir = $(gimpplugindir)/plug-ins/destripe
-emboss_libexecdir = $(gimpplugindir)/plug-ins/emboss
 file_aa_libexecdir = $(gimpplugindir)/plug-ins/file-aa
 file_cel_libexecdir = $(gimpplugindir)/plug-ins/file-cel
 file_compressor_libexecdir = $(gimpplugindir)/plug-ins/file-compressor
@@ -142,7 +141,6 @@ decompose_libexec_PROGRAMS = decompose
 depth_merge_libexec_PROGRAMS = depth-merge
 despeckle_libexec_PROGRAMS = despeckle
 destripe_libexec_PROGRAMS = destripe
-emboss_libexec_PROGRAMS = emboss
 file_aa_libexec_PROGRAMS = $(FILE_AA)
 file_cel_libexec_PROGRAMS = file-cel
 file_compressor_libexec_PROGRAMS = file-compressor
@@ -514,23 +512,6 @@ destripe_LDADD = \
        $(INTLLIBS)             \
        $(destripe_RC)
 
-emboss_SOURCES = \
-       emboss.c
-
-emboss_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(emboss_RC)
-
 file_aa_SOURCES = \
        file-aa.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 345245b225..83381d99e9 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -14,7 +14,6 @@ decompose_RC = decompose.rc.o
 depth_merge_RC = depth-merge.rc.o
 despeckle_RC = despeckle.rc.o
 destripe_RC = destripe.rc.o
-emboss_RC = emboss.rc.o
 file_aa_RC = file-aa.rc.o
 file_cel_RC = file-cel.rc.o
 file_compressor_RC = file-compressor.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 30f203b310..916e0fadaf 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -16,7 +16,6 @@
     'depth-merge' => { ui => 1, gegl => 1 },
     'despeckle' => { ui => 1, gegl => 1 },
     'destripe' => { ui => 1, gegl => 1 },
-    'emboss' => { ui => 1 },
     'file-aa' => { ui => 1, gegl => 1, optional => 1, libs => 'AA_LIBS' },
     'file-cel' => { ui => 1, gegl => 1 },
     'file-csource' => { ui => 1, gegl => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index d737657050..1c3229df75 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -20,7 +20,6 @@ plug-ins/common/decompose.c
 plug-ins/common/depth-merge.c
 plug-ins/common/despeckle.c
 plug-ins/common/destripe.c
-plug-ins/common/emboss.c
 plug-ins/common/file-aa.c
 plug-ins/common/file-cel.c
 plug-ins/common/file-csource.c


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