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



commit b7cf8506719bf51126361d22e49ffab4dd1ca404
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jul 19 17:35:13 2019 +0200

    plug-ins: remove the oilify plug-in and add a PDB compat procedure

 app/pdb/internal-procs.c       |   2 +-
 app/pdb/plug-in-compat-cmds.c  | 223 ++++++++++
 pdb/groups/plug_in_compat.pdb  | 165 ++++++-
 plug-ins/common/.gitignore     |   2 -
 plug-ins/common/Makefile.am    |  19 -
 plug-ins/common/gimprc.common  |   1 -
 plug-ins/common/oilify.c       | 945 -----------------------------------------
 plug-ins/common/plugin-defs.pl |   1 -
 po-plug-ins/POTFILES.in        |   1 -
 9 files changed, 369 insertions(+), 990 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 113c95cae2..3db3f2bff3 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 743 procedures registered total */
+/* 745 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 e381dba867..937d3ca486 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -2910,6 +2910,115 @@ plug_in_nova_invoker (GimpProcedure         *procedure,
                                            error ? *error : NULL);
 }
 
+static GimpValueArray *
+plug_in_oilify2_invoker (GimpProcedure         *procedure,
+                         Gimp                  *gimp,
+                         GimpContext           *context,
+                         GimpProgress          *progress,
+                         const GimpValueArray  *args,
+                         GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 mask_size;
+  gint32 mode;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  mask_size = g_value_get_int (gimp_value_array_index (args, 3));
+  mode = 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:oilify",
+                                      "mask-radius",     MAX (1, mask_size / 2),
+                                      "use-inten",       mode ? TRUE : FALSE,
+                                      NULL);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Oilify"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_oilify_enhanced2_invoker (GimpProcedure         *procedure,
+                                  Gimp                  *gimp,
+                                  GimpContext           *context,
+                                  GimpProgress          *progress,
+                                  const GimpValueArray  *args,
+                                  GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 mode;
+  gint32 mask_size;
+  GimpDrawable *mask_size_map;
+  gint32 exponent;
+  GimpDrawable *exponent_map;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2), gimp);
+  mode = g_value_get_int (gimp_value_array_index (args, 3));
+  mask_size = g_value_get_int (gimp_value_array_index (args, 4));
+  mask_size_map = gimp_value_get_drawable (gimp_value_array_index (args, 5), gimp);
+  exponent = g_value_get_int (gimp_value_array_index (args, 6));
+  exponent_map = gimp_value_get_drawable (gimp_value_array_index (args, 7), 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:oilify",
+                                      "mask-radius", MAX (1, mask_size / 2),
+                                      "use-inten",   mode ? TRUE : FALSE,
+                                      "exponent",    exponent,
+                                      NULL);
+
+          if (mask_size_map)
+            {
+              GeglNode *src_node;
+              src_node = create_buffer_source_node (node, mask_size_map);
+              gegl_node_connect_to (src_node, "output", node, "aux");
+            }
+
+          if (exponent_map)
+            {
+              GeglNode *src_node;
+              src_node = create_buffer_source_node (node, exponent_map);
+              gegl_node_connect_to (src_node, "output", node, "aux2");
+            }
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         C_("undo-type", "Oilify"),
+                                         node);
+          g_object_unref (node);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
 static GimpValueArray *
 plug_in_papertile_invoker (GimpProcedure         *procedure,
                            Gimp                  *gimp,
@@ -7469,6 +7578,120 @@ register_plug_in_compat_procs (GimpPDB *pdb)
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
 
+  /*
+   * gimp-plug-in-oilify2
+   */
+  procedure = gimp_procedure_new (plug_in_oilify2_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-oilify2");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-oilify2",
+                                     "Smear colors to simulate an oil painting",
+                                     "This function performs the well-known oil-paint effect on the 
specified drawable.",
+                                     "Compatibility procedure. Please see 'gegl:oilify' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:oilify' 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,
+                               gimp_param_spec_int32 ("mask-size",
+                                                      "mask size",
+                                                      "Oil paint mask size",
+                                                      1, 200, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("mode",
+                                                      "mode",
+                                                      "Algorithm { RGB (0), INTENSITY (1) }",
+                                                      0, 1, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-plug-in-oilify-enhanced2
+   */
+  procedure = gimp_procedure_new (plug_in_oilify_enhanced2_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "plug-in-oilify-enhanced2");
+  gimp_procedure_set_static_strings (procedure,
+                                     "plug-in-oilify-enhanced2",
+                                     "Smear colors to simulate an oil painting",
+                                     "This function performs the well-known oil-paint effect on the 
specified drawable.",
+                                     "Compatibility procedure. Please see 'gegl:oilify' for credits.",
+                                     "Compatibility procedure. Please see 'gegl:oilify' 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,
+                               gimp_param_spec_int32 ("mode",
+                                                      "mode",
+                                                      "Algorithm { RGB (0), INTENSITY (1) }",
+                                                      0, 1, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("mask-size",
+                                                      "mask size",
+                                                      "Oil paint mask size",
+                                                      1, 200, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("mask-size-map",
+                                                            "mask size map",
+                                                            "Mask size control map",
+                                                            pdb->gimp, TRUE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("exponent",
+                                                      "exponent",
+                                                      "Oil paint exponent",
+                                                      1, 20, 1,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("exponent-map",
+                                                            "exponent map",
+                                                            "Exponent control map",
+                                                            pdb->gimp, TRUE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
   /*
    * gimp-plug-in-papertile
    */
diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb
index 96d9617d29..afe281cacf 100644
--- a/pdb/groups/plug_in_compat.pdb
+++ b/pdb/groups/plug_in_compat.pdb
@@ -1214,26 +1214,26 @@ HELP
     $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 => 'amount_x', type => '-500.0 <= float <= 500.0',
-    desc => 'Displace multiplier for radial direction' },
-  { name => 'amount_y', type => '-500.0 <= float <= 500.0',
-    desc => 'Displace multiplier for tangent direction' },
-  { name => 'do_x', type => 'boolean',
-    desc => 'Displace in radial direction ?' },
-  { name => 'do_y', type => 'boolean',
-    desc => 'Displace in tangent direction ?' },
-  { name => 'displace_map_x', type => 'drawable',
-    desc => 'Displacement map for radial direction' },
-  { name => 'displace_map_y', type => 'drawable',
-    desc => 'Displacement map for tangent direction' },
-  { name => 'displace_type', type => '1 <= int32 <= 3',
-    desc => 'Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }' }
+        { 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 => 'amount_x', type => '-500.0 <= float <= 500.0',
+          desc => 'Displace multiplier for radial direction' },
+        { name => 'amount_y', type => '-500.0 <= float <= 500.0',
+          desc => 'Displace multiplier for tangent direction' },
+        { name => 'do_x', type => 'boolean',
+          desc => 'Displace in radial direction ?' },
+        { name => 'do_y', type => 'boolean',
+          desc => 'Displace in tangent direction ?' },
+        { name => 'displace_map_x', type => 'drawable',
+          desc => 'Displacement map for radial direction' },
+        { name => 'displace_map_y', type => 'drawable',
+          desc => 'Displacement map for tangent direction' },
+        { name => 'displace_type', type => '1 <= int32 <= 3',
+          desc => 'Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }' }
     );
 
     %invoke = (
@@ -2891,6 +2891,129 @@ CODE
     );
 }
 
+sub plug_in_oilify2 {
+    $blurb = 'Smear colors to simulate an oil painting';
+
+    $help = <<'HELP';
+This function performs the well-known oil-paint effect on the
+specified drawable.
+HELP
+
+    &std_pdb_compat('gegl:oilify');
+    $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 => 'mask_size', type => '1 <= int32 <= 200',
+          desc => 'Oil paint mask size' },
+        { name => 'mode', type => '0 <= int32 <= 1',
+          desc => 'Algorithm { RGB (0), INTENSITY (1) }' }
+    );
+
+    %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:oilify",
+                                  "mask-radius",     MAX (1, mask_size / 2),
+                                  "use-inten",       mode ? TRUE : FALSE,
+                                  NULL);
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Oilify"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub plug_in_oilify_enhanced2 {
+    $blurb = 'Smear colors to simulate an oil painting';
+
+    $help = <<'HELP';
+This function performs the well-known oil-paint effect on the
+specified drawable.
+HELP
+
+    &std_pdb_compat('gegl:oilify');
+    $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 => 'mode', type => '0 <= int32 <= 1',
+          desc => 'Algorithm { RGB (0), INTENSITY (1) }' },
+        { name => 'mask_size', type => '1 <= int32 <= 200',
+          desc => 'Oil paint mask size' },
+        { name => 'mask_size_map', type => 'drawable', none_ok => 1,
+          desc => 'Mask size control map' },
+        { name => 'exponent', type => '1 <= int32 <= 20',
+          desc => 'Oil paint exponent' },
+        { name => 'exponent_map', type => 'drawable', none_ok => 1,
+          desc => 'Exponent control map' }
+    );
+
+    %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:oilify",
+                                  "mask-radius", MAX (1, mask_size / 2),
+                                  "use-inten",   mode ? TRUE : FALSE,
+                                  "exponent",    exponent,
+                                  NULL);
+
+      if (mask_size_map)
+        {
+          GeglNode *src_node;
+          src_node = create_buffer_source_node (node, mask_size_map);
+          gegl_node_connect_to (src_node, "output", node, "aux");
+        }
+
+      if (exponent_map)
+        {
+          GeglNode *src_node;
+          src_node = create_buffer_source_node (node, exponent_map);
+          gegl_node_connect_to (src_node, "output", node, "aux2");
+        }
+
+      gimp_drawable_apply_operation (drawable, progress,
+                                     C_("undo-type", "Oilify"),
+                                     node);
+      g_object_unref (node);
+    }
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub plug_in_papertile {
     $blurb = 'Cut image into paper tiles, and slide them';
 
@@ -5344,6 +5467,8 @@ CODE
             plug_in_newsprint
             plug_in_normalize
             plug_in_nova
+            plug_in_oilify2
+            plug_in_oilify_enhanced2
             plug_in_papertile
             plug_in_photocopy
             plug_in_pixelize
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 509f28f5e5..a80516e9aa 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -124,8 +124,6 @@
 /mail.exe
 /nl-filter
 /nl-filter.exe
-/oilify
-/oilify.exe
 /plugin-browser
 /plugin-browser.exe
 /procedure-browser
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 63c643e2ae..0d10866721 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -107,7 +107,6 @@ hot_libexecdir = $(gimpplugindir)/plug-ins/hot
 jigsaw_libexecdir = $(gimpplugindir)/plug-ins/jigsaw
 mail_libexecdir = $(gimpplugindir)/plug-ins/mail
 nl_filter_libexecdir = $(gimpplugindir)/plug-ins/nl-filter
-oilify_libexecdir = $(gimpplugindir)/plug-ins/oilify
 plugin_browser_libexecdir = $(gimpplugindir)/plug-ins/plugin-browser
 procedure_browser_libexecdir = $(gimpplugindir)/plug-ins/procedure-browser
 qbist_libexecdir = $(gimpplugindir)/plug-ins/qbist
@@ -186,7 +185,6 @@ hot_libexec_PROGRAMS = hot
 jigsaw_libexec_PROGRAMS = jigsaw
 mail_libexec_PROGRAMS = $(MAIL)
 nl_filter_libexec_PROGRAMS = nl-filter
-oilify_libexec_PROGRAMS = oilify
 plugin_browser_libexec_PROGRAMS = plugin-browser
 procedure_browser_libexec_PROGRAMS = procedure-browser
 qbist_libexec_PROGRAMS = qbist
@@ -1337,23 +1335,6 @@ nl_filter_LDADD = \
        $(INTLLIBS)             \
        $(nl_filter_RC)
 
-oilify_SOURCES = \
-       oilify.c
-
-oilify_LDADD = \
-       $(libgimpui)            \
-       $(libgimpwidgets)       \
-       $(libgimpmodule)        \
-       $(libgimp)              \
-       $(libgimpmath)          \
-       $(libgimpconfig)        \
-       $(libgimpcolor)         \
-       $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(RT_LIBS)              \
-       $(INTLLIBS)             \
-       $(oilify_RC)
-
 plugin_browser_SOURCES = \
        plugin-browser.c
 
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 83381d99e9..f643c8bc56 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -59,7 +59,6 @@ hot_RC = hot.rc.o
 jigsaw_RC = jigsaw.rc.o
 mail_RC = mail.rc.o
 nl_filter_RC = nl-filter.rc.o
-oilify_RC = oilify.rc.o
 plugin_browser_RC = plugin-browser.rc.o
 procedure_browser_RC = procedure-browser.rc.o
 qbist_RC = qbist.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 8b3a2c2ae4..91b999f2b3 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -61,7 +61,6 @@
     'jigsaw' => { ui => 1, gegl => 1 },
     'mail' => { ui => 1, optional => 1 },
     'nl-filter' => { ui => 1, gegl => 1 },
-    'oilify' => { ui => 1 },
     'plugin-browser' => { ui => 1 },
     'procedure-browser' => { ui => 1 },
     'qbist' => { ui => 1, gegl => 1 },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 1c3229df75..42c52ee0fd 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -65,7 +65,6 @@ plug-ins/common/hot.c
 plug-ins/common/jigsaw.c
 plug-ins/common/mail.c
 plug-ins/common/nl-filter.c
-plug-ins/common/oilify.c
 plug-ins/common/plugin-browser.c
 plug-ins/common/procedure-browser.c
 plug-ins/common/qbist.c


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