[gimp] Bug 795230 - Rename Blend tool and provide PDB compatibility



commit 50536e1c3822a58db26c8061a51240bb94782e20
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 15 14:57:25 2018 +0200

    Bug 795230 - Rename Blend tool and provide PDB compatibility
    
    Add new PDB group "drawable_edit" which has all procedures from the
    "edit" group which are not cut/copy/paste.
    
    The new group's procedures don't have opacity, paint_mode
    etc. arguments but take them from the context instead. Unlike the old
    gimp-edit-fill, gimp-drawable-edit-fill now uses the context's opacity
    and paint_mode.
    
    The new gimp-drawable-edit-gradient-fill procedure uses even more
    context properties which are also newly added with this commit
    (gradient_color_space, gradient_repeat_mode, gradient_reverse).
    
    And some cleanup in context.pdb.
    
    This is still WIP, nothing in the edit group is depcreated yet.

 app/pdb/Makefile.am                     |    1 +
 app/pdb/context-cmds.c                  |  532 ++++++++++++++++++++++-----
 app/pdb/drawable-edit-cmds.c            |  609 +++++++++++++++++++++++++++++++
 app/pdb/edit-cmds.c                     |    6 +-
 app/pdb/internal-procs.c                |    3 +-
 app/pdb/internal-procs.h                |    1 +
 devel-docs/libgimp/libgimp-docs.sgml    |    1 +
 devel-docs/libgimp/libgimp-sections.txt |   10 +
 libgimp/Makefile.am                     |    2 +
 libgimp/gimp.def                        |   12 +
 libgimp/gimp_pdb_headers.h              |    1 +
 libgimp/gimpcontext_pdb.c               |  352 ++++++++++++++----
 libgimp/gimpcontext_pdb.h               |  226 ++++++------
 libgimp/gimpdrawableedit_pdb.c          |  310 ++++++++++++++++
 libgimp/gimpdrawableedit_pdb.h          |   60 +++
 pdb/Makefile.am                         |    1 +
 pdb/groups.pl                           |    1 +
 pdb/groups/context.pdb                  |  303 ++++++++++++----
 pdb/groups/edit.pdb                     |    2 -
 po/POTFILES.in                          |    1 +
 20 files changed, 2077 insertions(+), 357 deletions(-)
---
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index 645d323..f4b9dcd 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -45,6 +45,7 @@ libappinternal_procs_a_SOURCES = \
        display-cmds.c                  \
        drawable-cmds.c                 \
        drawable-color-cmds.c           \
+       drawable-edit-cmds.c            \
        drawable-transform-cmds.c       \
        dynamics-cmds.c                 \
        edit-cmds.c                     \
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index e30cd43..dbf9cad 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -36,6 +36,7 @@
 #include "core/gimpcontainer.h"
 #include "core/gimpdashpattern.h"
 #include "core/gimpdatafactory.h"
+#include "core/gimplist.h"
 #include "core/gimpparamspecs.h"
 #include "core/gimpstrokeoptions.h"
 #include "paint/gimppaintoptions.h"
@@ -1562,6 +1563,195 @@ context_set_gradient_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+context_get_gradient_blend_color_space_invoker (GimpProcedure         *procedure,
+                                                Gimp                  *gimp,
+                                                GimpContext           *context,
+                                                GimpProgress          *progress,
+                                                const GimpValueArray  *args,
+                                                GError               **error)
+{
+  gboolean success = TRUE;
+  GimpValueArray *return_vals;
+  gint32 blend_color_space = 0;
+
+  /* all options should have the same value, so pick a random one */
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
+
+  if (options)
+    g_object_get (options,
+                  "gradient-blend-color-space", &blend_color_space,
+                  NULL);
+  else
+    success = FALSE;
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_enum (gimp_value_array_index (return_vals, 1), blend_color_space);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_blend_color_space_invoker (GimpProcedure         *procedure,
+                                                Gimp                  *gimp,
+                                                GimpContext           *context,
+                                                GimpProgress          *progress,
+                                                const GimpValueArray  *args,
+                                                GError               **error)
+{
+  gboolean success = TRUE;
+  gint32 blend_color_space;
+
+  blend_color_space = g_value_get_enum (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpContainer *options;
+      GList         *list;
+
+      options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+      for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+        g_object_set (list->data,
+                      "gradient-blend-color-space", blend_color_space,
+                       NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_gradient_repeat_mode_invoker (GimpProcedure         *procedure,
+                                          Gimp                  *gimp,
+                                          GimpContext           *context,
+                                          GimpProgress          *progress,
+                                          const GimpValueArray  *args,
+                                          GError               **error)
+{
+  gboolean success = TRUE;
+  GimpValueArray *return_vals;
+  gint32 repeat_mode = 0;
+
+  /* all options should have the same value, so pick a random one */
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
+
+  if (options)
+    g_object_get (options,
+                  "gradient-repeat", &repeat_mode,
+                  NULL);
+  else
+    success = FALSE;
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_enum (gimp_value_array_index (return_vals, 1), repeat_mode);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_repeat_mode_invoker (GimpProcedure         *procedure,
+                                          Gimp                  *gimp,
+                                          GimpContext           *context,
+                                          GimpProgress          *progress,
+                                          const GimpValueArray  *args,
+                                          GError               **error)
+{
+  gboolean success = TRUE;
+  gint32 repeat_mode;
+
+  repeat_mode = g_value_get_enum (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpContainer *options;
+      GList         *list;
+
+      options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+      for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+        g_object_set (list->data,
+                      "gradient-repeat", repeat_mode,
+                       NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_gradient_reverse_invoker (GimpProcedure         *procedure,
+                                      Gimp                  *gimp,
+                                      GimpContext           *context,
+                                      GimpProgress          *progress,
+                                      const GimpValueArray  *args,
+                                      GError               **error)
+{
+  gboolean success = TRUE;
+  GimpValueArray *return_vals;
+  gboolean reverse = FALSE;
+
+  /* all options should have the same value, so pick a random one */
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
+
+  if (options)
+    g_object_get (options,
+                  "gradient-reverse", &reverse,
+                  NULL);
+  else
+    success = FALSE;
+
+  return_vals = gimp_procedure_get_return_values (procedure, success,
+                                                  error ? *error : NULL);
+
+  if (success)
+    g_value_set_boolean (gimp_value_array_index (return_vals, 1), reverse);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_gradient_reverse_invoker (GimpProcedure         *procedure,
+                                      Gimp                  *gimp,
+                                      GimpContext           *context,
+                                      GimpProgress          *progress,
+                                      const GimpValueArray  *args,
+                                      GError               **error)
+{
+  gboolean success = TRUE;
+  gboolean reverse;
+
+  reverse = g_value_get_boolean (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpContainer *options;
+      GList         *list;
+
+      options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+      for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+        g_object_set (list->data,
+                      "gradient-reverse", reverse,
+                       NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 context_get_palette_invoker (GimpProcedure         *procedure,
                              Gimp                  *gimp,
                              GimpContext           *context,
@@ -2088,6 +2278,51 @@ context_set_diagonal_neighbors_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+context_get_distance_metric_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  GimpValueArray *return_vals;
+  gint32 metric = 0;
+
+  g_object_get (context,
+                "distance-metric", &metric,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_enum (gimp_value_array_index (return_vals, 1), metric);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_distance_metric_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  gboolean success = TRUE;
+  gint32 metric;
+
+  metric = g_value_get_enum (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      g_object_set (context,
+                    "distance-metric", metric,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 context_get_interpolation_invoker (GimpProcedure         *procedure,
                                    Gimp                  *gimp,
                                    GimpContext           *context,
@@ -2764,51 +2999,6 @@ context_set_ink_blob_angle_invoker (GimpProcedure         *procedure,
                                            error ? *error : NULL);
 }
 
-static GimpValueArray *
-context_get_distance_metric_invoker (GimpProcedure         *procedure,
-                                     Gimp                  *gimp,
-                                     GimpContext           *context,
-                                     GimpProgress          *progress,
-                                     const GimpValueArray  *args,
-                                     GError               **error)
-{
-  GimpValueArray *return_vals;
-  gint32 metric = 0;
-
-  g_object_get (context,
-                "distance-metric", &metric,
-                NULL);
-
-  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
-  g_value_set_enum (gimp_value_array_index (return_vals, 1), metric);
-
-  return return_vals;
-}
-
-static GimpValueArray *
-context_set_distance_metric_invoker (GimpProcedure         *procedure,
-                                     Gimp                  *gimp,
-                                     GimpContext           *context,
-                                     GimpProgress          *progress,
-                                     const GimpValueArray  *args,
-                                     GError               **error)
-{
-  gboolean success = TRUE;
-  gint32 metric;
-
-  metric = g_value_get_enum (gimp_value_array_index (args, 0));
-
-  if (success)
-    {
-      g_object_set (context,
-                    "distance-metric", metric,
-                    NULL);
-    }
-
-  return gimp_procedure_get_return_values (procedure, success,
-                                           error ? *error : NULL);
-}
-
 void
 register_context_procs (GimpPDB *pdb)
 {
@@ -3246,7 +3436,7 @@ register_context_procs (GimpPDB *pdb)
                                      "gimp-context-set-line-width",
                                      "Set the line width setting.",
                                      "This procedure modifies the line width setting for stroking lines.\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -3295,7 +3485,7 @@ register_context_procs (GimpPDB *pdb)
                                      "gimp-context-set-line-width-unit",
                                      "Set the line width unit setting.",
                                      "This procedure modifies the line width unit setting for stroking 
lines.\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -3345,7 +3535,7 @@ register_context_procs (GimpPDB *pdb)
                                      "gimp-context-set-line-cap-style",
                                      "Set the line cap style setting.",
                                      "This procedure modifies the line cap style setting for stroking 
lines.\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -3394,7 +3584,7 @@ register_context_procs (GimpPDB *pdb)
                                      "gimp-context-set-line-join-style",
                                      "Set the line join style setting.",
                                      "This procedure modifies the line join style setting for stroking 
lines.\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -3443,7 +3633,7 @@ register_context_procs (GimpPDB *pdb)
                                      "Set the line miter limit setting.",
                                      "This procedure modifies the line miter limit setting for stroking 
lines.\n"
                                      "A mitered join is converted to a bevelled join if the miter would 
extend to a distance of more than (miter-limit * line-width) from the actual join point.\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -3490,7 +3680,7 @@ register_context_procs (GimpPDB *pdb)
                                      "gimp-context-set-line-dash-offset",
                                      "Set the line dash offset setting.",
                                      "This procedure modifies the line dash offset setting for stroking 
lines.\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -3543,7 +3733,7 @@ register_context_procs (GimpPDB *pdb)
                                      "Set the line dash pattern setting.",
                                      "This procedure modifies the line dash pattern setting for stroking 
lines.\n"
                                      "The unit of the dash pattern segments is the actual line width used 
for the stroke operation, in other words a segment length of 1.0 results in a square segment shape (or gap 
shape).\n"
-                                     "This setting affects the following procedures: 'gimp-edit-stroke', 
'gimp-edit-stroke-vectors'.",
+                                     "This setting affects the following procedures: 
'gimp-drawable-edit-stroke-selection-', 'gimp-drawable-edit-stroke-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2015",
@@ -4130,6 +4320,148 @@ register_context_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-context-get-gradient-blend-color-space
+   */
+  procedure = gimp_procedure_new (context_get_gradient_blend_color_space_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-gradient-blend-color-space");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-gradient-blend-color-space",
+                                     "Get the gradient blend color space.",
+                                     "Get the gradient blend color space for paint tools and the gradient 
tool.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_enum ("blend-color-space",
+                                                      "blend color space",
+                                                      "Color blend space",
+                                                      GIMP_TYPE_GRADIENT_BLEND_COLOR_SPACE,
+                                                      GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-gradient-blend-color-space
+   */
+  procedure = gimp_procedure_new (context_set_gradient_blend_color_space_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-gradient-blend-color-space");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-gradient-blend-color-space",
+                                     "Set the gradient blend color space.",
+                                     "Set the gradient blend color space for paint tools and the gradient 
tool.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("blend-color-space",
+                                                  "blend color space",
+                                                  "Blend color space",
+                                                  GIMP_TYPE_GRADIENT_BLEND_COLOR_SPACE,
+                                                  GIMP_GRADIENT_BLEND_RGB_PERCEPTUAL,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-gradient-repeat-mode
+   */
+  procedure = gimp_procedure_new (context_get_gradient_repeat_mode_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-gradient-repeat-mode");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-gradient-repeat-mode",
+                                     "Get the gradient repeat mode.",
+                                     "Get the gradient repeat mode for paint tools and the gradient tool.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_enum ("repeat-mode",
+                                                      "repeat mode",
+                                                      "Repeat mode",
+                                                      GIMP_TYPE_REPEAT_MODE,
+                                                      GIMP_REPEAT_NONE,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-gradient-repeat-mode
+   */
+  procedure = gimp_procedure_new (context_set_gradient_repeat_mode_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-gradient-repeat-mode");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-gradient-repeat-mode",
+                                     "Set the gradient repeat mode.",
+                                     "Set the gradient repeat mode for paint tools and the gradient tool.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("repeat-mode",
+                                                  "repeat mode",
+                                                  "Repeat mode",
+                                                  GIMP_TYPE_REPEAT_MODE,
+                                                  GIMP_REPEAT_NONE,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-gradient-reverse
+   */
+  procedure = gimp_procedure_new (context_get_gradient_reverse_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-gradient-reverse");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-gradient-reverse",
+                                     "Get the gradient reverse setting.",
+                                     "Get the gradient reverse setting for paint tools and the gradient 
tool.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_boolean ("reverse",
+                                                         "reverse",
+                                                         "Reverse",
+                                                         FALSE,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-gradient-reverse
+   */
+  procedure = gimp_procedure_new (context_set_gradient_reverse_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-gradient-reverse");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-gradient-reverse",
+                                     "Set the gradient reverse setting.",
+                                     "Set the gradient reverse setting for paint tools and the gradient 
tool.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("reverse",
+                                                     "reverse",
+                                                     "Reverse",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-context-get-palette
    */
   procedure = gimp_procedure_new (context_get_palette_invoker);
@@ -4662,6 +4994,54 @@ register_context_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-context-get-distance-metric
+   */
+  procedure = gimp_procedure_new (context_get_distance_metric_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-distance-metric");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-distance-metric",
+                                     "Get the distance metric used in some computations.",
+                                     "This procedure returns the distance metric in the current context. See 
'gimp-context-set-distance-metric' to know more about its usage.",
+                                     "Jehan",
+                                     "Jehan",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_enum ("metric",
+                                                      "metric",
+                                                      "The distance metric",
+                                                      GEGL_TYPE_DISTANCE_METRIC,
+                                                      GEGL_DISTANCE_METRIC_EUCLIDEAN,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-distance-metric
+   */
+  procedure = gimp_procedure_new (context_set_distance_metric_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-distance-metric");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-distance-metric",
+                                     "Set the distance metric used in some computations.",
+                                     "This procedure modifies the distance metric used in some computations, 
such as 'gimp-drawable-edit-gradient-fill'. In particular, it does not change the metric used in generic 
distance computation on canvas, as in the Measure tool.",
+                                     "Jehan",
+                                     "Jehan",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("metric",
+                                                  "metric",
+                                                  "The distance metric",
+                                                  GEGL_TYPE_DISTANCE_METRIC,
+                                                  GEGL_DISTANCE_METRIC_EUCLIDEAN,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-context-get-interpolation
    */
   procedure = gimp_procedure_new (context_get_interpolation_invoker);
@@ -5223,52 +5603,4 @@ register_context_procs (GimpPDB *pdb)
                                                     GIMP_PARAM_READWRITE));
   gimp_pdb_register_procedure (pdb, procedure);
   g_object_unref (procedure);
-
-  /*
-   * gimp-context-get-distance-metric
-   */
-  procedure = gimp_procedure_new (context_get_distance_metric_invoker);
-  gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-context-get-distance-metric");
-  gimp_procedure_set_static_strings (procedure,
-                                     "gimp-context-get-distance-metric",
-                                     "Get the distance metric used in some computations.",
-                                     "This procedure returns the distance metric in the current context. See 
'gimp-context-set-distance-metric' to know more about its usage.",
-                                     "Jehan",
-                                     "Jehan",
-                                     "2018",
-                                     NULL);
-  gimp_procedure_add_return_value (procedure,
-                                   g_param_spec_enum ("metric",
-                                                      "metric",
-                                                      "The distance metric",
-                                                      GEGL_TYPE_DISTANCE_METRIC,
-                                                      GEGL_DISTANCE_METRIC_EUCLIDEAN,
-                                                      GIMP_PARAM_READWRITE));
-  gimp_pdb_register_procedure (pdb, procedure);
-  g_object_unref (procedure);
-
-  /*
-   * gimp-context-set-distance-metric
-   */
-  procedure = gimp_procedure_new (context_set_distance_metric_invoker);
-  gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-context-set-distance-metric");
-  gimp_procedure_set_static_strings (procedure,
-                                     "gimp-context-set-distance-metric",
-                                     "Set the distance metric used in some computations.",
-                                     "This procedure modifies the distance metric used in some computations, 
such as 'gimp-edit-blend'. In particular, it does not change the metric used in generic distance computation 
on canvas, as in the Measure tool.",
-                                     "Jehan",
-                                     "Jehan",
-                                     "2018",
-                                     NULL);
-  gimp_procedure_add_argument (procedure,
-                               g_param_spec_enum ("metric",
-                                                  "metric",
-                                                  "The distance metric",
-                                                  GEGL_TYPE_DISTANCE_METRIC,
-                                                  GEGL_DISTANCE_METRIC_EUCLIDEAN,
-                                                  GIMP_PARAM_READWRITE));
-  gimp_pdb_register_procedure (pdb, procedure);
-  g_object_unref (procedure);
 }
diff --git a/app/pdb/drawable-edit-cmds.c b/app/pdb/drawable-edit-cmds.c
new file mode 100644
index 0000000..7dcb2d5
--- /dev/null
+++ b/app/pdb/drawable-edit-cmds.c
@@ -0,0 +1,609 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpconfig/gimpconfig.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimp-edit.h"
+#include "core/gimp-gradients.h"
+#include "core/gimp.h"
+#include "core/gimpbuffer.h"
+#include "core/gimpdrawable-bucket-fill.h"
+#include "core/gimpdrawable-gradient.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
+#include "core/gimpitem.h"
+#include "core/gimpparamspecs.h"
+#include "core/gimpprogress.h"
+#include "core/gimpstrokeoptions.h"
+#include "paint/gimppaintoptions.h"
+
+#include "gimppdb.h"
+#include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+drawable_edit_clear_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, 0), 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))
+        {
+          GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
+
+          gimp_edit_clear (image, drawable, context);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_fill_invoker (GimpProcedure         *procedure,
+                            Gimp                  *gimp,
+                            GimpContext           *context,
+                            GimpProgress          *progress,
+                            const GimpValueArray  *args,
+                            GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 fill_type;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+  fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
+
+  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))
+        {
+          GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
+          GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+          gimp_context_set_opacity (GIMP_CONTEXT (options),
+                                    gimp_context_get_opacity (context));
+          gimp_context_set_paint_mode (GIMP_CONTEXT (options),
+                                       gimp_context_get_paint_mode (context));
+
+          if (gimp_fill_options_set_by_fill_type (options, context,
+                                                  fill_type, error))
+            {
+              gimp_edit_fill (image, drawable, options, NULL);
+            }
+          else
+            success = FALSE;
+
+          g_object_unref (options);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_bucket_fill_invoker (GimpProcedure         *procedure,
+                                   Gimp                  *gimp,
+                                   GimpContext           *context,
+                                   GimpProgress          *progress,
+                                   const GimpValueArray  *args,
+                                   GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 fill_type;
+  gdouble x;
+  gdouble y;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+  fill_type = g_value_get_enum (gimp_value_array_index (args, 1));
+  x = g_value_get_double (gimp_value_array_index (args, 2));
+  y = g_value_get_double (gimp_value_array_index (args, 3));
+
+  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))
+        {
+          GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
+
+          gimp_context_set_opacity (GIMP_CONTEXT (options),
+                                    gimp_context_get_opacity (context));
+          gimp_context_set_paint_mode (GIMP_CONTEXT (options),
+                                       gimp_context_get_paint_mode (context));
+
+          gimp_fill_options_set_antialias (options,
+                                           GIMP_PDB_CONTEXT (context)->antialias);
+
+          if (gimp_fill_options_set_by_fill_type (options, context,
+                                                  fill_type, error))
+            {
+              gimp_drawable_bucket_fill (drawable, options,
+                                         GIMP_PDB_CONTEXT (context)->sample_transparent,
+                                         GIMP_PDB_CONTEXT (context)->sample_criterion,
+                                         GIMP_PDB_CONTEXT (context)->sample_threshold,
+                                         GIMP_PDB_CONTEXT (context)->sample_merged,
+                                         GIMP_PDB_CONTEXT (context)->diagonal_neighbors,
+                                         x, y);
+            }
+          else
+            success = FALSE;
+
+          g_object_unref (options);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_gradient_fill_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  gint32 gradient_type;
+  gdouble offset;
+  gboolean supersample;
+  gint32 supersample_max_depth;
+  gdouble supersample_threshold;
+  gboolean dither;
+  gdouble x1;
+  gdouble y1;
+  gdouble x2;
+  gdouble y2;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+  gradient_type = g_value_get_enum (gimp_value_array_index (args, 1));
+  offset = g_value_get_double (gimp_value_array_index (args, 2));
+  supersample = g_value_get_boolean (gimp_value_array_index (args, 3));
+  supersample_max_depth = g_value_get_int (gimp_value_array_index (args, 4));
+  supersample_threshold = g_value_get_double (gimp_value_array_index (args, 5));
+  dither = g_value_get_boolean (gimp_value_array_index (args, 6));
+  x1 = g_value_get_double (gimp_value_array_index (args, 7));
+  y1 = g_value_get_double (gimp_value_array_index (args, 8));
+  x2 = g_value_get_double (gimp_value_array_index (args, 9));
+  y2 = g_value_get_double (gimp_value_array_index (args, 10));
+
+  if (success)
+    {
+      success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL,
+                                            GIMP_PDB_ITEM_CONTENT, error) &&
+                 gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
+
+      if (success && supersample)
+        {
+          if (supersample_max_depth < 1 || supersample_max_depth > 9)
+            success = FALSE;
+
+          if (supersample_threshold < 0.0 || supersample_threshold > 4.0)
+            success = FALSE;
+        }
+
+      if (success)
+        {
+          /* all options should have the same value, so pick a random one */
+          GimpPaintOptions *options =
+            gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                                "gimp-paintbrush");
+
+          if (progress)
+            gimp_progress_start (progress, FALSE, _("Gradient"));
+
+          gimp_drawable_gradient (drawable,
+                                  context,
+                                  gimp_context_get_gradient (context),
+                                  GIMP_PDB_CONTEXT (context)->distance_metric,
+                                  gimp_context_get_paint_mode (context),
+                                  gradient_type,
+                                  gimp_context_get_opacity (context),
+                                  offset,
+                                  options->gradient_options->gradient_repeat,
+                                  options->gradient_options->gradient_reverse,
+                                  options->gradient_options->gradient_blend_color_space,
+                                  supersample,
+                                  supersample_max_depth,
+                                  supersample_threshold,
+                                  dither,
+                                  x1, y1, x2, y2,
+                                  progress);
+
+          if (progress)
+            gimp_progress_end (progress);
+        }
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_stroke_selection_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, 0), 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))
+        {
+          GimpImage         *image = gimp_item_get_image (GIMP_ITEM (drawable));
+          GimpStrokeOptions *options;
+          GimpPaintOptions  *paint_options;
+
+          options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+          paint_options =
+            gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+          paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+          success = gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
+                                      drawable, context, options, paint_options,
+                                      TRUE, progress, error);
+
+          g_object_unref (paint_options);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+drawable_edit_stroke_item_invoker (GimpProcedure         *procedure,
+                                   Gimp                  *gimp,
+                                   GimpContext           *context,
+                                   GimpProgress          *progress,
+                                   const GimpValueArray  *args,
+                                   GError               **error)
+{
+  gboolean success = TRUE;
+  GimpDrawable *drawable;
+  GimpItem *item;
+
+  drawable = gimp_value_get_drawable (gimp_value_array_index (args, 0), gimp);
+  item = gimp_value_get_item (gimp_value_array_index (args, 1), 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) &&
+          gimp_pdb_item_is_attached (item,
+                                     gimp_item_get_image (GIMP_ITEM (drawable)),
+                                     0, error))
+        {
+          GimpStrokeOptions *options;
+          GimpPaintOptions  *paint_options;
+
+          options = gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+          paint_options =
+            gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context), NULL);
+          paint_options = gimp_config_duplicate (GIMP_CONFIG (paint_options));
+
+          success = gimp_item_stroke (item, drawable,
+                                      context, options, paint_options,
+                                      TRUE, progress, error);
+
+          g_object_unref (paint_options);
+        }
+      else
+        success = FALSE;
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+void
+register_drawable_edit_procs (GimpPDB *pdb)
+{
+  GimpProcedure *procedure;
+
+  /*
+   * gimp-drawable-edit-clear
+   */
+  procedure = gimp_procedure_new (drawable_edit_clear_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-edit-clear");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-edit-clear",
+                                     "Clear selected area of drawable.",
+                                     "This procedure clears the specified drawable. If the drawable has an 
alpha channel, the cleared pixels will become transparent. If the drawable does not have an alpha channel, 
cleared pixels will be set to the background color. This procedure only affects regions within a selection if 
there is a selection active.\n"
+                                     "This procedure is affected by the following context setters: 
'gimp-context-set-background'.",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The drawable to clear from",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-drawable-edit-fill
+   */
+  procedure = gimp_procedure_new (drawable_edit_fill_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-edit-fill");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-edit-fill",
+                                     "Fill selected area of drawable.",
+                                     "This procedure fills the specified drawable according to fill mode. 
This procedure only affects regions within a selection if there is a selection active. If you want to fill 
the whole drawable, regardless of the selection, use 'gimp-drawable-fill'.\n"
+                                     "This procedure is affected by the following context setters: 
'gimp-context-set-opacity', 'gimp-context-set-paint-mode', 'gimp-context-set-foreground', 
'gimp-context-set-background', 'gimp-context-set-pattern'.",
+                                     "Spencer Kimball & Peter Mattis & Raphael Quinet",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-2000",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The drawable to fill to",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("fill-type",
+                                                  "fill type",
+                                                  "The type of fill",
+                                                  GIMP_TYPE_FILL_TYPE,
+                                                  GIMP_FILL_FOREGROUND,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-drawable-edit-bucket-fill
+   */
+  procedure = gimp_procedure_new (drawable_edit_bucket_fill_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-edit-bucket-fill");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-edit-bucket-fill",
+                                     "Fill the area by a seed fill starting at the specified coordinates.",
+                                     "This procedure does a seed fill at the specified coordinates, using 
various parameters from the current context.\n"
+                                     "In the case of merged sampling, the x and y coordinates are relative 
to the image's origin; otherwise, they are relative to the drawable's origin.\n"
+                                     "This procedure is affected by the following context setters: 
'gimp-context-set-opacity', 'gimp-context-set-paint-mode', 'gimp-context-set-foreground', 
'gimp-context-set-background', 'gimp-context-set-pattern', 'gimp-context-set-sample-threshold', 
'gimp-context-set-sample-merged', 'gimp-context-set-sample-criterion', 'gimp-context-set-diagonal-neighbors', 
'gimp-context-set-antialias'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The affected drawable",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("fill-type",
+                                                  "fill type",
+                                                  "The type of fill",
+                                                  GIMP_TYPE_FILL_TYPE,
+                                                  GIMP_FILL_FOREGROUND,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("x",
+                                                    "x",
+                                                    "The x coordinate of this bucket fill's application.",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("y",
+                                                    "y",
+                                                    "The y coordinate of this bucket fill's application.",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-drawable-edit-gradient-fill
+   */
+  procedure = gimp_procedure_new (drawable_edit_gradient_fill_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-edit-gradient-fill");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-edit-gradient-fill",
+                                     "Draw a gradient between the starting and ending coordinates with the 
specified gradient type.",
+                                     "This tool requires information on the gradient type. It creates the 
specified variety of gradient using the starting and ending coordinates as defined for each gradient type. 
For shapeburst gradient types, the context's distance metric is also relevant and can be updated with 
'gimp-context-set-distance-metric'.\n"
+                                     "This procedure is affected by the following context setters: 
'gimp-context-set-opacity', 'gimp-context-set-paint-mode', 'gimp-context-set-foreground', 
'gimp-context-set-background', 'gimp-context-set-gradient' and all gradient property settings, 
'gimp-context-set-distance-metric'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The affected drawable",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("gradient-type",
+                                                  "gradient type",
+                                                  "The type of gradient",
+                                                  GIMP_TYPE_GRADIENT_TYPE,
+                                                  GIMP_GRADIENT_LINEAR,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("offset",
+                                                    "offset",
+                                                    "Offset relates to the starting and ending coordinates 
specified for the blend. This parameter is mode dependent.",
+                                                    0, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("supersample",
+                                                     "supersample",
+                                                     "Do adaptive supersampling",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("supersample-max-depth",
+                                                      "supersample max depth",
+                                                      "Maximum recursion levels for supersampling",
+                                                      1, 9, 1,
+                                                      GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("supersample-threshold",
+                                                    "supersample threshold",
+                                                    "Supersampling threshold",
+                                                    0, 4, 0,
+                                                    GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_boolean ("dither",
+                                                     "dither",
+                                                     "Use dithering to reduce banding",
+                                                     FALSE,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("x1",
+                                                    "x1",
+                                                    "The x coordinate of this gradient's starting point",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("y1",
+                                                    "y1",
+                                                    "The y coordinate of this gradient's starting point",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("x2",
+                                                    "x2",
+                                                    "The x coordinate of this gradient's ending point",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("y2",
+                                                    "y2",
+                                                    "The y coordinate of this gradient's ending point",
+                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-drawable-edit-stroke-selection
+   */
+  procedure = gimp_procedure_new (drawable_edit_stroke_selection_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-edit-stroke-selection");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-edit-stroke-selection",
+                                     "Stroke the current selection",
+                                     "This procedure strokes the current selection, painting along the 
selection boundary with the active paint method and brush, or using a plain line with configurable 
properties. The paint is applied to the specified drawable regardless of the active selection.\n"
+                                     "This procedure is affected by the following context setters: 
'gimp-context-set-opacity', 'gimp-context-set-paint-mode', 'gimp-context-set-foreground', 
'gimp-context-set-brush' and all brush property settings, 'gimp-context-set-gradient' and all gradient 
property settings",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "Spencer Kimball & Peter Mattis",
+                                     "1995-1996",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The drawable to stroke to",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-drawable-edit-stroke-item
+   */
+  procedure = gimp_procedure_new (drawable_edit_stroke_item_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-drawable-edit-stroke-item");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-drawable-edit-stroke-item",
+                                     "Stroke the specified item",
+                                     "This procedure strokes the specified item, painting along its outline 
(e.g. along a path, or along a channel's boundary), with the active paint method and brush, or using a plain 
line with configurable properties.\n"
+                                     "This procedure is affected by the following context setters: 
'gimp-context-set-opacity', 'gimp-context-set-paint-mode', 'gimp-context-set-foreground', 
'gimp-context-set-brush' and all brush property settings, 'gimp-context-set-gradient' and all gradient 
property settings",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2018",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_drawable_id ("drawable",
+                                                            "drawable",
+                                                            "The drawable to stroke to",
+                                                            pdb->gimp, FALSE,
+                                                            GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_item_id ("item",
+                                                        "item",
+                                                        "The item to stroke",
+                                                        pdb->gimp, FALSE,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+}
diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c
index 7854f5e..c93a931 100644
--- a/app/pdb/edit-cmds.c
+++ b/app/pdb/edit-cmds.c
@@ -1272,9 +1272,9 @@ register_edit_procs (GimpPDB *pdb)
                                      "gimp-edit-clear",
                                      "Clear selected area of drawable.",
                                      "This procedure clears the specified drawable. If the drawable has an 
alpha channel, the cleared pixels will become transparent. If the drawable does not have an alpha channel, 
cleared pixels will be set to the background color. This procedure only affects regions within a selection if 
there is a selection active.",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "Spencer Kimball & Peter Mattis",
-                                     "1995-1996",
+                                     "",
+                                     "",
+                                     "",
                                      NULL);
   gimp_procedure_add_argument (procedure,
                                gimp_param_spec_drawable_id ("drawable",
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 48c0c3b..28657e3 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 816 procedures registered total */
+/* 828 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
@@ -46,6 +46,7 @@ internal_procs_init (GimpPDB *pdb)
   register_display_procs (pdb);
   register_drawable_procs (pdb);
   register_drawable_color_procs (pdb);
+  register_drawable_edit_procs (pdb);
   register_drawable_transform_procs (pdb);
   register_dynamics_procs (pdb);
   register_edit_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index 3dd0b14..ff66116 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -35,6 +35,7 @@ void   register_debug_procs               (GimpPDB *pdb);
 void   register_display_procs             (GimpPDB *pdb);
 void   register_drawable_procs            (GimpPDB *pdb);
 void   register_drawable_color_procs      (GimpPDB *pdb);
+void   register_drawable_edit_procs       (GimpPDB *pdb);
 void   register_drawable_transform_procs  (GimpPDB *pdb);
 void   register_dynamics_procs            (GimpPDB *pdb);
 void   register_edit_procs                (GimpPDB *pdb);
diff --git a/devel-docs/libgimp/libgimp-docs.sgml b/devel-docs/libgimp/libgimp-docs.sgml
index 99c0898..abd905b 100644
--- a/devel-docs/libgimp/libgimp-docs.sgml
+++ b/devel-docs/libgimp/libgimp-docs.sgml
@@ -44,6 +44,7 @@
       <xi:include href="xml/gimpdisplay.xml" />
       <xi:include href="xml/gimpdrawable.xml" />
       <xi:include href="xml/gimpdrawablecolor.xml" />
+      <xi:include href="xml/gimpdrawableedit.xml" />
       <xi:include href="xml/gimpdrawabletransform.xml" />
       <xi:include href="xml/gimpedit.xml" />
       <xi:include href="xml/gimpfileops.xml" />
diff --git a/devel-docs/libgimp/libgimp-sections.txt b/devel-docs/libgimp/libgimp-sections.txt
index c1ea040..45f82ff 100644
--- a/devel-docs/libgimp/libgimp-sections.txt
+++ b/devel-docs/libgimp/libgimp-sections.txt
@@ -422,6 +422,16 @@ gimp_drawable_threshold
 </SECTION>
 
 <SECTION>
+<FILE>gimpdrawableedit</FILE>
+gimp_drawable_edit_clear
+gimp_drawable_edit_fill
+gimp_drawable_edit_bucket_fill
+gimp_drawable_edit_gradient_fill
+gimp_drawable_edit_stroke_selection
+gimp_drawable_edit_stroke_item
+</SECTION>
+
+<SECTION>
 <FILE>gimpdrawabletransform</FILE>
 gimp_drawable_transform_flip_simple
 gimp_drawable_transform_flip
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index 88ef23a..1c2cdd3 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -103,6 +103,7 @@ PDB_WRAPPERS_C = \
        gimpdisplay_pdb.c               \
        gimpdrawable_pdb.c              \
        gimpdrawablecolor_pdb.c         \
+       gimpdrawableedit_pdb.c          \
        gimpdrawabletransform_pdb.c     \
        gimpdynamics_pdb.c              \
        gimpedit_pdb.c                  \
@@ -161,6 +162,7 @@ PDB_WRAPPERS_H = \
        gimpdisplay_pdb.h               \
        gimpdrawable_pdb.h              \
        gimpdrawablecolor_pdb.h         \
+       gimpdrawableedit_pdb.h          \
        gimpdrawabletransform_pdb.h     \
        gimpdynamics_pdb.h              \
        gimpedit_pdb.h                  \
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index d495d43..3e198af 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -85,6 +85,9 @@ EXPORTS
        gimp_context_get_font
        gimp_context_get_foreground
        gimp_context_get_gradient
+       gimp_context_get_gradient_blend_color_space
+       gimp_context_get_gradient_repeat_mode
+       gimp_context_get_gradient_reverse
        gimp_context_get_ink_angle
        gimp_context_get_ink_blob_angle
        gimp_context_get_ink_blob_aspect_ratio
@@ -141,6 +144,9 @@ EXPORTS
        gimp_context_set_font
        gimp_context_set_foreground
        gimp_context_set_gradient
+       gimp_context_set_gradient_blend_color_space
+       gimp_context_set_gradient_repeat_mode
+       gimp_context_set_gradient_reverse
        gimp_context_set_ink_angle
        gimp_context_set_ink_blob_angle
        gimp_context_set_ink_blob_aspect_ratio
@@ -205,6 +211,12 @@ EXPORTS
        gimp_drawable_delete
        gimp_drawable_desaturate
        gimp_drawable_detach
+       gimp_drawable_edit_bucket_fill
+       gimp_drawable_edit_clear
+       gimp_drawable_edit_fill
+       gimp_drawable_edit_gradient_fill
+       gimp_drawable_edit_stroke_item
+       gimp_drawable_edit_stroke_selection
        gimp_drawable_equalize
        gimp_drawable_fill
        gimp_drawable_flush
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index 000e4ef..d18ffdd 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -39,6 +39,7 @@
 #include <libgimp/gimpdisplay_pdb.h>
 #include <libgimp/gimpdrawable_pdb.h>
 #include <libgimp/gimpdrawablecolor_pdb.h>
+#include <libgimp/gimpdrawableedit_pdb.h>
 #include <libgimp/gimpdrawabletransform_pdb.h>
 #include <libgimp/gimpdynamics_pdb.h>
 #include <libgimp/gimpedit_pdb.h>
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index aebf13f..1102f7f 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -672,8 +672,9 @@ gimp_context_get_line_width (void)
  * Set the line width setting.
  *
  * This procedure modifies the line width setting for stroking lines.
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -736,8 +737,9 @@ gimp_context_get_line_width_unit (void)
  *
  * This procedure modifies the line width unit setting for stroking
  * lines.
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -800,8 +802,9 @@ gimp_context_get_line_cap_style (void)
  *
  * This procedure modifies the line cap style setting for stroking
  * lines.
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -864,8 +867,9 @@ gimp_context_get_line_join_style (void)
  *
  * This procedure modifies the line join style setting for stroking
  * lines.
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -931,8 +935,9 @@ gimp_context_get_line_miter_limit (void)
  * A mitered join is converted to a bevelled join if the miter would
  * extend to a distance of more than (miter-limit * line-width) from
  * the actual join point.
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -995,8 +1000,9 @@ gimp_context_get_line_dash_offset (void)
  *
  * This procedure modifies the line dash offset setting for stroking
  * lines.
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -1077,8 +1083,9 @@ gimp_context_get_line_dash_pattern (gint     *num_dashes,
  * The unit of the dash pattern segments is the actual line width used
  * for the stroke operation, in other words a segment length of 1.0
  * results in a square segment shape (or gap shape).
- * This setting affects the following procedures: gimp_edit_stroke(),
- * gimp_edit_stroke_vectors().
+ * This setting affects the following procedures:
+ * gimp_drawable_edit_stroke_selection_(),
+ * gimp_drawable_edit_stroke_item().
  *
  * Returns: TRUE on success.
  *
@@ -1900,6 +1907,193 @@ gimp_context_set_gradient (const gchar *name)
 }
 
 /**
+ * gimp_context_get_gradient_blend_color_space:
+ *
+ * Get the gradient blend color space.
+ *
+ * Get the gradient blend color space for paint tools and the gradient
+ * tool.
+ *
+ * Returns: Color blend space.
+ *
+ * Since: 2.10
+ **/
+GimpGradientBlendColorSpace
+gimp_context_get_gradient_blend_color_space (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpGradientBlendColorSpace blend_color_space = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-gradient-blend-color-space",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    blend_color_space = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return blend_color_space;
+}
+
+/**
+ * gimp_context_set_gradient_blend_color_space:
+ * @blend_color_space: Blend color space.
+ *
+ * Set the gradient blend color space.
+ *
+ * Set the gradient blend color space for paint tools and the gradient
+ * tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace blend_color_space)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-gradient-blend-color-space",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, blend_color_space,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_context_get_gradient_repeat_mode:
+ *
+ * Get the gradient repeat mode.
+ *
+ * Get the gradient repeat mode for paint tools and the gradient tool.
+ *
+ * Returns: Repeat mode.
+ *
+ * Since: 2.10
+ **/
+GimpRepeatMode
+gimp_context_get_gradient_repeat_mode (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpRepeatMode repeat_mode = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-gradient-repeat-mode",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    repeat_mode = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return repeat_mode;
+}
+
+/**
+ * gimp_context_set_gradient_repeat_mode:
+ * @repeat_mode: Repeat mode.
+ *
+ * Set the gradient repeat mode.
+ *
+ * Set the gradient repeat mode for paint tools and the gradient tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_repeat_mode (GimpRepeatMode repeat_mode)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-gradient-repeat-mode",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, repeat_mode,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_context_get_gradient_reverse:
+ *
+ * Get the gradient reverse setting.
+ *
+ * Get the gradient reverse setting for paint tools and the gradient
+ * tool.
+ *
+ * Returns: Reverse.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_get_gradient_reverse (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean reverse = FALSE;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-gradient-reverse",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    reverse = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return reverse;
+}
+
+/**
+ * gimp_context_set_gradient_reverse:
+ * @reverse: Reverse.
+ *
+ * Set the gradient reverse setting.
+ *
+ * Set the gradient reverse setting for paint tools and the gradient
+ * tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_gradient_reverse (gboolean reverse)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-gradient-reverse",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, reverse,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
  * gimp_context_get_palette:
  *
  * Retrieve the currently active palette.
@@ -2648,6 +2842,71 @@ gimp_context_set_diagonal_neighbors (gboolean diagonal_neighbors)
 }
 
 /**
+ * gimp_context_get_distance_metric:
+ *
+ * Get the distance metric used in some computations.
+ *
+ * This procedure returns the distance metric in the current context.
+ * See gimp_context_set_distance_metric() to know more about its usage.
+ *
+ * Returns: The distance metric.
+ *
+ * Since: 2.10
+ **/
+GeglDistanceMetric
+gimp_context_get_distance_metric (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GeglDistanceMetric metric = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-distance-metric",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    metric = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return metric;
+}
+
+/**
+ * gimp_context_set_distance_metric:
+ * @metric: The distance metric.
+ *
+ * Set the distance metric used in some computations.
+ *
+ * This procedure modifies the distance metric used in some
+ * computations, such as gimp_drawable_edit_gradient_fill(). In
+ * particular, it does not change the metric used in generic distance
+ * computation on canvas, as in the Measure tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_distance_metric (GeglDistanceMetric metric)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-distance-metric",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, metric,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
  * gimp_context_get_interpolation:
  *
  * Get the interpolation type.
@@ -3398,68 +3657,3 @@ gimp_context_set_ink_blob_angle (gdouble angle)
 
   return success;
 }
-
-/**
- * gimp_context_get_distance_metric:
- *
- * Get the distance metric used in some computations.
- *
- * This procedure returns the distance metric in the current context.
- * See gimp_context_set_distance_metric() to know more about its usage.
- *
- * Returns: The distance metric.
- *
- * Since: 2.10
- **/
-GeglDistanceMetric
-gimp_context_get_distance_metric (void)
-{
-  GimpParam *return_vals;
-  gint nreturn_vals;
-  GeglDistanceMetric metric = 0;
-
-  return_vals = gimp_run_procedure ("gimp-context-get-distance-metric",
-                                    &nreturn_vals,
-                                    GIMP_PDB_END);
-
-  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
-    metric = return_vals[1].data.d_int32;
-
-  gimp_destroy_params (return_vals, nreturn_vals);
-
-  return metric;
-}
-
-/**
- * gimp_context_set_distance_metric:
- * @metric: The distance metric.
- *
- * Set the distance metric used in some computations.
- *
- * This procedure modifies the distance metric used in some
- * computations, such as gimp_edit_blend(). In particular, it does not
- * change the metric used in generic distance computation on canvas, as
- * in the Measure tool.
- *
- * Returns: TRUE on success.
- *
- * Since: 2.10
- **/
-gboolean
-gimp_context_set_distance_metric (GeglDistanceMetric metric)
-{
-  GimpParam *return_vals;
-  gint nreturn_vals;
-  gboolean success = TRUE;
-
-  return_vals = gimp_run_procedure ("gimp-context-set-distance-metric",
-                                    &nreturn_vals,
-                                    GIMP_PDB_INT32, metric,
-                                    GIMP_PDB_END);
-
-  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
-
-  gimp_destroy_params (return_vals, nreturn_vals);
-
-  return success;
-}
diff --git a/libgimp/gimpcontext_pdb.h b/libgimp/gimpcontext_pdb.h
index cc09532..4869b53 100644
--- a/libgimp/gimpcontext_pdb.h
+++ b/libgimp/gimpcontext_pdb.h
@@ -32,118 +32,124 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-gboolean               gimp_context_push                       (void);
-gboolean               gimp_context_pop                        (void);
-gboolean               gimp_context_set_defaults               (void);
-gboolean               gimp_context_list_paint_methods         (gint                     *num_paint_methods,
-                                                                gchar                  ***paint_methods);
-gchar*                 gimp_context_get_paint_method           (void);
-gboolean               gimp_context_set_paint_method           (const gchar              *name);
-GimpStrokeMethod       gimp_context_get_stroke_method          (void);
-gboolean               gimp_context_set_stroke_method          (GimpStrokeMethod          stroke_method);
-gboolean               gimp_context_get_foreground             (GimpRGB                  *foreground);
-gboolean               gimp_context_set_foreground             (const GimpRGB            *foreground);
-gboolean               gimp_context_get_background             (GimpRGB                  *background);
-gboolean               gimp_context_set_background             (const GimpRGB            *background);
-gboolean               gimp_context_set_default_colors         (void);
-gboolean               gimp_context_swap_colors                (void);
-gdouble                gimp_context_get_opacity                (void);
-gboolean               gimp_context_set_opacity                (gdouble                   opacity);
-GimpLayerMode          gimp_context_get_paint_mode             (void);
-gboolean               gimp_context_set_paint_mode             (GimpLayerMode             paint_mode);
-gdouble                gimp_context_get_line_width             (void);
-gboolean               gimp_context_set_line_width             (gdouble                   line_width);
-GimpUnit               gimp_context_get_line_width_unit        (void);
-gboolean               gimp_context_set_line_width_unit        (GimpUnit                  line_width_unit);
-GimpCapStyle           gimp_context_get_line_cap_style         (void);
-gboolean               gimp_context_set_line_cap_style         (GimpCapStyle              cap_style);
-GimpJoinStyle          gimp_context_get_line_join_style        (void);
-gboolean               gimp_context_set_line_join_style        (GimpJoinStyle             join_style);
-gdouble                gimp_context_get_line_miter_limit       (void);
-gboolean               gimp_context_set_line_miter_limit       (gdouble                   miter_limit);
-gdouble                gimp_context_get_line_dash_offset       (void);
-gboolean               gimp_context_set_line_dash_offset       (gdouble                   dash_offset);
-gboolean               gimp_context_get_line_dash_pattern      (gint                     *num_dashes,
-                                                                gdouble                 **dashes);
-gboolean               gimp_context_set_line_dash_pattern      (gint                      num_dashes,
-                                                                const gdouble            *dashes);
-gchar*                 gimp_context_get_brush                  (void);
-gboolean               gimp_context_set_brush                  (const gchar              *name);
-gdouble                gimp_context_get_brush_size             (void);
-gboolean               gimp_context_set_brush_size             (gdouble                   size);
-gboolean               gimp_context_set_brush_default_size     (void);
-gdouble                gimp_context_get_brush_aspect_ratio     (void);
-gboolean               gimp_context_set_brush_aspect_ratio     (gdouble                   aspect);
-gdouble                gimp_context_get_brush_angle            (void);
-gboolean               gimp_context_set_brush_angle            (gdouble                   angle);
-gdouble                gimp_context_get_brush_spacing          (void);
-gboolean               gimp_context_set_brush_spacing          (gdouble                   spacing);
-gboolean               gimp_context_set_brush_default_spacing  (void);
-gdouble                gimp_context_get_brush_hardness         (void);
-gboolean               gimp_context_set_brush_hardness         (gdouble                   hardness);
-gboolean               gimp_context_set_brush_default_hardness (void);
-gdouble                gimp_context_get_brush_force            (void);
-gboolean               gimp_context_set_brush_force            (gdouble                   force);
-gchar*                 gimp_context_get_dynamics               (void);
-gboolean               gimp_context_set_dynamics               (const gchar              *name);
-gchar*                 gimp_context_get_mypaint_brush          (void);
-gboolean               gimp_context_set_mypaint_brush          (const gchar              *name);
-gchar*                 gimp_context_get_pattern                (void);
-gboolean               gimp_context_set_pattern                (const gchar              *name);
-gchar*                 gimp_context_get_gradient               (void);
-gboolean               gimp_context_set_gradient               (const gchar              *name);
-gchar*                 gimp_context_get_palette                (void);
-gboolean               gimp_context_set_palette                (const gchar              *name);
-gchar*                 gimp_context_get_font                   (void);
-gboolean               gimp_context_set_font                   (const gchar              *name);
-gboolean               gimp_context_get_antialias              (void);
-gboolean               gimp_context_set_antialias              (gboolean                  antialias);
-gboolean               gimp_context_get_feather                (void);
-gboolean               gimp_context_set_feather                (gboolean                  feather);
-gboolean               gimp_context_get_feather_radius         (gdouble                  *feather_radius_x,
-                                                                gdouble                  *feather_radius_y);
-gboolean               gimp_context_set_feather_radius         (gdouble                   feather_radius_x,
-                                                                gdouble                   feather_radius_y);
-gboolean               gimp_context_get_sample_merged          (void);
-gboolean               gimp_context_set_sample_merged          (gboolean                  sample_merged);
-GimpSelectCriterion    gimp_context_get_sample_criterion       (void);
-gboolean               gimp_context_set_sample_criterion       (GimpSelectCriterion       sample_criterion);
-gdouble                gimp_context_get_sample_threshold       (void);
-gboolean               gimp_context_set_sample_threshold       (gdouble                   sample_threshold);
-gint                   gimp_context_get_sample_threshold_int   (void);
-gboolean               gimp_context_set_sample_threshold_int   (gint                      sample_threshold);
-gboolean               gimp_context_get_sample_transparent     (void);
-gboolean               gimp_context_set_sample_transparent     (gboolean                  
sample_transparent);
-gboolean               gimp_context_get_diagonal_neighbors     (void);
-gboolean               gimp_context_set_diagonal_neighbors     (gboolean                  
diagonal_neighbors);
-GimpInterpolationType  gimp_context_get_interpolation          (void);
-gboolean               gimp_context_set_interpolation          (GimpInterpolationType     interpolation);
-GimpTransformDirection gimp_context_get_transform_direction    (void);
-gboolean               gimp_context_set_transform_direction    (GimpTransformDirection    
transform_direction);
-GimpTransformResize    gimp_context_get_transform_resize       (void);
-gboolean               gimp_context_set_transform_resize       (GimpTransformResize       transform_resize);
+gboolean                    gimp_context_push                           (void);
+gboolean                    gimp_context_pop                            (void);
+gboolean                    gimp_context_set_defaults                   (void);
+gboolean                    gimp_context_list_paint_methods             (gint                          
*num_paint_methods,
+                                                                         gchar                       
***paint_methods);
+gchar*                      gimp_context_get_paint_method               (void);
+gboolean                    gimp_context_set_paint_method               (const gchar                   
*name);
+GimpStrokeMethod            gimp_context_get_stroke_method              (void);
+gboolean                    gimp_context_set_stroke_method              (GimpStrokeMethod               
stroke_method);
+gboolean                    gimp_context_get_foreground                 (GimpRGB                       
*foreground);
+gboolean                    gimp_context_set_foreground                 (const GimpRGB                 
*foreground);
+gboolean                    gimp_context_get_background                 (GimpRGB                       
*background);
+gboolean                    gimp_context_set_background                 (const GimpRGB                 
*background);
+gboolean                    gimp_context_set_default_colors             (void);
+gboolean                    gimp_context_swap_colors                    (void);
+gdouble                     gimp_context_get_opacity                    (void);
+gboolean                    gimp_context_set_opacity                    (gdouble                        
opacity);
+GimpLayerMode               gimp_context_get_paint_mode                 (void);
+gboolean                    gimp_context_set_paint_mode                 (GimpLayerMode                  
paint_mode);
+gdouble                     gimp_context_get_line_width                 (void);
+gboolean                    gimp_context_set_line_width                 (gdouble                        
line_width);
+GimpUnit                    gimp_context_get_line_width_unit            (void);
+gboolean                    gimp_context_set_line_width_unit            (GimpUnit                       
line_width_unit);
+GimpCapStyle                gimp_context_get_line_cap_style             (void);
+gboolean                    gimp_context_set_line_cap_style             (GimpCapStyle                   
cap_style);
+GimpJoinStyle               gimp_context_get_line_join_style            (void);
+gboolean                    gimp_context_set_line_join_style            (GimpJoinStyle                  
join_style);
+gdouble                     gimp_context_get_line_miter_limit           (void);
+gboolean                    gimp_context_set_line_miter_limit           (gdouble                        
miter_limit);
+gdouble                     gimp_context_get_line_dash_offset           (void);
+gboolean                    gimp_context_set_line_dash_offset           (gdouble                        
dash_offset);
+gboolean                    gimp_context_get_line_dash_pattern          (gint                          
*num_dashes,
+                                                                         gdouble                      
**dashes);
+gboolean                    gimp_context_set_line_dash_pattern          (gint                           
num_dashes,
+                                                                         const gdouble                 
*dashes);
+gchar*                      gimp_context_get_brush                      (void);
+gboolean                    gimp_context_set_brush                      (const gchar                   
*name);
+gdouble                     gimp_context_get_brush_size                 (void);
+gboolean                    gimp_context_set_brush_size                 (gdouble                        
size);
+gboolean                    gimp_context_set_brush_default_size         (void);
+gdouble                     gimp_context_get_brush_aspect_ratio         (void);
+gboolean                    gimp_context_set_brush_aspect_ratio         (gdouble                        
aspect);
+gdouble                     gimp_context_get_brush_angle                (void);
+gboolean                    gimp_context_set_brush_angle                (gdouble                        
angle);
+gdouble                     gimp_context_get_brush_spacing              (void);
+gboolean                    gimp_context_set_brush_spacing              (gdouble                        
spacing);
+gboolean                    gimp_context_set_brush_default_spacing      (void);
+gdouble                     gimp_context_get_brush_hardness             (void);
+gboolean                    gimp_context_set_brush_hardness             (gdouble                        
hardness);
+gboolean                    gimp_context_set_brush_default_hardness     (void);
+gdouble                     gimp_context_get_brush_force                (void);
+gboolean                    gimp_context_set_brush_force                (gdouble                        
force);
+gchar*                      gimp_context_get_dynamics                   (void);
+gboolean                    gimp_context_set_dynamics                   (const gchar                   
*name);
+gchar*                      gimp_context_get_mypaint_brush              (void);
+gboolean                    gimp_context_set_mypaint_brush              (const gchar                   
*name);
+gchar*                      gimp_context_get_pattern                    (void);
+gboolean                    gimp_context_set_pattern                    (const gchar                   
*name);
+gchar*                      gimp_context_get_gradient                   (void);
+gboolean                    gimp_context_set_gradient                   (const gchar                   
*name);
+GimpGradientBlendColorSpace gimp_context_get_gradient_blend_color_space (void);
+gboolean                    gimp_context_set_gradient_blend_color_space (GimpGradientBlendColorSpace    
blend_color_space);
+GimpRepeatMode              gimp_context_get_gradient_repeat_mode       (void);
+gboolean                    gimp_context_set_gradient_repeat_mode       (GimpRepeatMode                 
repeat_mode);
+gboolean                    gimp_context_get_gradient_reverse           (void);
+gboolean                    gimp_context_set_gradient_reverse           (gboolean                       
reverse);
+gchar*                      gimp_context_get_palette                    (void);
+gboolean                    gimp_context_set_palette                    (const gchar                   
*name);
+gchar*                      gimp_context_get_font                       (void);
+gboolean                    gimp_context_set_font                       (const gchar                   
*name);
+gboolean                    gimp_context_get_antialias                  (void);
+gboolean                    gimp_context_set_antialias                  (gboolean                       
antialias);
+gboolean                    gimp_context_get_feather                    (void);
+gboolean                    gimp_context_set_feather                    (gboolean                       
feather);
+gboolean                    gimp_context_get_feather_radius             (gdouble                       
*feather_radius_x,
+                                                                         gdouble                       
*feather_radius_y);
+gboolean                    gimp_context_set_feather_radius             (gdouble                        
feather_radius_x,
+                                                                         gdouble                        
feather_radius_y);
+gboolean                    gimp_context_get_sample_merged              (void);
+gboolean                    gimp_context_set_sample_merged              (gboolean                       
sample_merged);
+GimpSelectCriterion         gimp_context_get_sample_criterion           (void);
+gboolean                    gimp_context_set_sample_criterion           (GimpSelectCriterion            
sample_criterion);
+gdouble                     gimp_context_get_sample_threshold           (void);
+gboolean                    gimp_context_set_sample_threshold           (gdouble                        
sample_threshold);
+gint                        gimp_context_get_sample_threshold_int       (void);
+gboolean                    gimp_context_set_sample_threshold_int       (gint                           
sample_threshold);
+gboolean                    gimp_context_get_sample_transparent         (void);
+gboolean                    gimp_context_set_sample_transparent         (gboolean                       
sample_transparent);
+gboolean                    gimp_context_get_diagonal_neighbors         (void);
+gboolean                    gimp_context_set_diagonal_neighbors         (gboolean                       
diagonal_neighbors);
+GeglDistanceMetric          gimp_context_get_distance_metric            (void);
+gboolean                    gimp_context_set_distance_metric            (GeglDistanceMetric             
metric);
+GimpInterpolationType       gimp_context_get_interpolation              (void);
+gboolean                    gimp_context_set_interpolation              (GimpInterpolationType          
interpolation);
+GimpTransformDirection      gimp_context_get_transform_direction        (void);
+gboolean                    gimp_context_set_transform_direction        (GimpTransformDirection         
transform_direction);
+GimpTransformResize         gimp_context_get_transform_resize           (void);
+gboolean                    gimp_context_set_transform_resize           (GimpTransformResize            
transform_resize);
 GIMP_DEPRECATED
-gint                   gimp_context_get_transform_recursion    (void);
+gint                        gimp_context_get_transform_recursion        (void);
 GIMP_DEPRECATED
-gboolean               gimp_context_set_transform_recursion    (gint                      
transform_recursion);
-gdouble                gimp_context_get_ink_size               (void);
-gboolean               gimp_context_set_ink_size               (gdouble                   size);
-gdouble                gimp_context_get_ink_angle              (void);
-gboolean               gimp_context_set_ink_angle              (gdouble                   angle);
-gdouble                gimp_context_get_ink_size_sensitivity   (void);
-gboolean               gimp_context_set_ink_size_sensitivity   (gdouble                   size);
-gdouble                gimp_context_get_ink_tilt_sensitivity   (void);
-gboolean               gimp_context_set_ink_tilt_sensitivity   (gdouble                   tilt);
-gdouble                gimp_context_get_ink_speed_sensitivity  (void);
-gboolean               gimp_context_set_ink_speed_sensitivity  (gdouble                   speed);
-GimpInkBlobType        gimp_context_get_ink_blob_type          (void);
-gboolean               gimp_context_set_ink_blob_type          (GimpInkBlobType           type);
-gdouble                gimp_context_get_ink_blob_aspect_ratio  (void);
-gboolean               gimp_context_set_ink_blob_aspect_ratio  (gdouble                   aspect);
-gdouble                gimp_context_get_ink_blob_angle         (void);
-gboolean               gimp_context_set_ink_blob_angle         (gdouble                   angle);
-GeglDistanceMetric     gimp_context_get_distance_metric        (void);
-gboolean               gimp_context_set_distance_metric        (GeglDistanceMetric        metric);
+gboolean                    gimp_context_set_transform_recursion        (gint                           
transform_recursion);
+gdouble                     gimp_context_get_ink_size                   (void);
+gboolean                    gimp_context_set_ink_size                   (gdouble                        
size);
+gdouble                     gimp_context_get_ink_angle                  (void);
+gboolean                    gimp_context_set_ink_angle                  (gdouble                        
angle);
+gdouble                     gimp_context_get_ink_size_sensitivity       (void);
+gboolean                    gimp_context_set_ink_size_sensitivity       (gdouble                        
size);
+gdouble                     gimp_context_get_ink_tilt_sensitivity       (void);
+gboolean                    gimp_context_set_ink_tilt_sensitivity       (gdouble                        
tilt);
+gdouble                     gimp_context_get_ink_speed_sensitivity      (void);
+gboolean                    gimp_context_set_ink_speed_sensitivity      (gdouble                        
speed);
+GimpInkBlobType             gimp_context_get_ink_blob_type              (void);
+gboolean                    gimp_context_set_ink_blob_type              (GimpInkBlobType                
type);
+gdouble                     gimp_context_get_ink_blob_aspect_ratio      (void);
+gboolean                    gimp_context_set_ink_blob_aspect_ratio      (gdouble                        
aspect);
+gdouble                     gimp_context_get_ink_blob_angle             (void);
+gboolean                    gimp_context_set_ink_blob_angle             (gdouble                        
angle);
 
 
 G_END_DECLS
diff --git a/libgimp/gimpdrawableedit_pdb.c b/libgimp/gimpdrawableedit_pdb.c
new file mode 100644
index 0000000..7d25756
--- /dev/null
+++ b/libgimp/gimpdrawableedit_pdb.c
@@ -0,0 +1,310 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawableedit_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpdrawableedit
+ * @title: gimpdrawableedit
+ * @short_description: Drawable edit functions (clear, fill, gradient, stroke etc.)
+ *
+ * Drawable edit functions (clear, fill, gradient, stroke etc.)
+ **/
+
+
+/**
+ * gimp_drawable_edit_clear:
+ * @drawable_ID: The drawable to clear from.
+ *
+ * Clear selected area of drawable.
+ *
+ * This procedure clears the specified drawable. If the drawable has an
+ * alpha channel, the cleared pixels will become transparent. If the
+ * drawable does not have an alpha channel, cleared pixels will be set
+ * to the background color. This procedure only affects regions within
+ * a selection if there is a selection active.
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_background().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_clear (gint32 drawable_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-edit-clear",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_drawable_edit_fill:
+ * @drawable_ID: The drawable to fill to.
+ * @fill_type: The type of fill.
+ *
+ * Fill selected area of drawable.
+ *
+ * This procedure fills the specified drawable according to fill mode.
+ * This procedure only affects regions within a selection if there is a
+ * selection active. If you want to fill the whole drawable, regardless
+ * of the selection, use gimp_drawable_fill().
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_pattern().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_fill (gint32       drawable_ID,
+                         GimpFillType fill_type)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-edit-fill",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_INT32, fill_type,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_drawable_edit_bucket_fill:
+ * @drawable_ID: The affected drawable.
+ * @fill_type: The type of fill.
+ * @x: The x coordinate of this bucket fill's application.
+ * @y: The y coordinate of this bucket fill's application.
+ *
+ * Fill the area by a seed fill starting at the specified coordinates.
+ *
+ * This procedure does a seed fill at the specified coordinates, using
+ * various parameters from the current context.
+ * In the case of merged sampling, the x and y coordinates are relative
+ * to the image's origin; otherwise, they are relative to the
+ * drawable's origin.
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_pattern(), gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_diagonal_neighbors(), gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_bucket_fill (gint32       drawable_ID,
+                                GimpFillType fill_type,
+                                gdouble      x,
+                                gdouble      y)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-edit-bucket-fill",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_INT32, fill_type,
+                                    GIMP_PDB_FLOAT, x,
+                                    GIMP_PDB_FLOAT, y,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_drawable_edit_gradient_fill:
+ * @drawable_ID: The affected drawable.
+ * @gradient_type: The type of gradient.
+ * @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is 
mode dependent.
+ * @supersample: Do adaptive supersampling.
+ * @supersample_max_depth: Maximum recursion levels for supersampling.
+ * @supersample_threshold: Supersampling threshold.
+ * @dither: Use dithering to reduce banding.
+ * @x1: The x coordinate of this gradient's starting point.
+ * @y1: The y coordinate of this gradient's starting point.
+ * @x2: The x coordinate of this gradient's ending point.
+ * @y2: The y coordinate of this gradient's ending point.
+ *
+ * Draw a gradient between the starting and ending coordinates with the
+ * specified gradient type.
+ *
+ * This tool requires information on the gradient type. It creates the
+ * specified variety of gradient using the starting and ending
+ * coordinates as defined for each gradient type. For shapeburst
+ * gradient types, the context's distance metric is also relevant and
+ * can be updated with gimp_context_set_distance_metric().
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_gradient() and all gradient property settings,
+ * gimp_context_set_distance_metric().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_gradient_fill (gint32           drawable_ID,
+                                  GimpGradientType gradient_type,
+                                  gdouble          offset,
+                                  gboolean         supersample,
+                                  gint             supersample_max_depth,
+                                  gdouble          supersample_threshold,
+                                  gboolean         dither,
+                                  gdouble          x1,
+                                  gdouble          y1,
+                                  gdouble          x2,
+                                  gdouble          y2)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-edit-gradient-fill",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_INT32, gradient_type,
+                                    GIMP_PDB_FLOAT, offset,
+                                    GIMP_PDB_INT32, supersample,
+                                    GIMP_PDB_INT32, supersample_max_depth,
+                                    GIMP_PDB_FLOAT, supersample_threshold,
+                                    GIMP_PDB_INT32, dither,
+                                    GIMP_PDB_FLOAT, x1,
+                                    GIMP_PDB_FLOAT, y1,
+                                    GIMP_PDB_FLOAT, x2,
+                                    GIMP_PDB_FLOAT, y2,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_drawable_edit_stroke_selection:
+ * @drawable_ID: The drawable to stroke to.
+ *
+ * Stroke the current selection
+ *
+ * This procedure strokes the current selection, painting along the
+ * selection boundary with the active paint method and brush, or using
+ * a plain line with configurable properties. The paint is applied to
+ * the specified drawable regardless of the active selection.
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_brush() and all
+ * brush property settings, gimp_context_set_gradient() and all
+ * gradient property settings
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-edit-stroke-selection",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_drawable_edit_stroke_item:
+ * @drawable_ID: The drawable to stroke to.
+ * @item_ID: The item to stroke.
+ *
+ * Stroke the specified item
+ *
+ * This procedure strokes the specified item, painting along its
+ * outline (e.g. along a path, or along a channel's boundary), with the
+ * active paint method and brush, or using a plain line with
+ * configurable properties.
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_brush() and all
+ * brush property settings, gimp_context_set_gradient() and all
+ * gradient property settings
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_stroke_item (gint32 drawable_ID,
+                                gint32 item_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-drawable-edit-stroke-item",
+                                    &nreturn_vals,
+                                    GIMP_PDB_DRAWABLE, drawable_ID,
+                                    GIMP_PDB_ITEM, item_ID,
+                                    GIMP_PDB_END);
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
diff --git a/libgimp/gimpdrawableedit_pdb.h b/libgimp/gimpdrawableedit_pdb.h
new file mode 100644
index 0000000..16717c0
--- /dev/null
+++ b/libgimp/gimpdrawableedit_pdb.h
@@ -0,0 +1,60 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpdrawableedit_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_DRAWABLE_EDIT_PDB_H__
+#define __GIMP_DRAWABLE_EDIT_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+gboolean gimp_drawable_edit_clear            (gint32           drawable_ID);
+gboolean gimp_drawable_edit_fill             (gint32           drawable_ID,
+                                              GimpFillType     fill_type);
+gboolean gimp_drawable_edit_bucket_fill      (gint32           drawable_ID,
+                                              GimpFillType     fill_type,
+                                              gdouble          x,
+                                              gdouble          y);
+gboolean gimp_drawable_edit_gradient_fill    (gint32           drawable_ID,
+                                              GimpGradientType gradient_type,
+                                              gdouble          offset,
+                                              gboolean         supersample,
+                                              gint             supersample_max_depth,
+                                              gdouble          supersample_threshold,
+                                              gboolean         dither,
+                                              gdouble          x1,
+                                              gdouble          y1,
+                                              gdouble          x2,
+                                              gdouble          y2);
+gboolean gimp_drawable_edit_stroke_selection (gint32           drawable_ID);
+gboolean gimp_drawable_edit_stroke_item      (gint32           drawable_ID,
+                                              gint32           item_ID);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_DRAWABLE_EDIT_PDB_H__ */
diff --git a/pdb/Makefile.am b/pdb/Makefile.am
index 31275da..47d0564 100644
--- a/pdb/Makefile.am
+++ b/pdb/Makefile.am
@@ -13,6 +13,7 @@ pdb_groups = \
        groups/display.pdb              \
        groups/drawable.pdb             \
        groups/drawable_color.pdb       \
+       groups/drawable_edit.pdb        \
        groups/drawable_transform.pdb   \
        groups/dynamics.pdb             \
        groups/edit.pdb                 \
diff --git a/pdb/groups.pl b/pdb/groups.pl
index 504253e..d5f9d16 100644
--- a/pdb/groups.pl
+++ b/pdb/groups.pl
@@ -11,6 +11,7 @@
     display
     drawable
     drawable_color
+    drawable_edit
     drawable_transform
     dynamics
     edit
diff --git a/pdb/groups/context.pdb b/pdb/groups/context.pdb
index 3637c1b..0e834bb 100644
--- a/pdb/groups/context.pdb
+++ b/pdb/groups/context.pdb
@@ -522,7 +522,7 @@ sub context_set_line_width {
 This procedure modifies the line width setting for stroking lines.
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -581,7 +581,7 @@ sub context_set_line_width_unit {
 This procedure modifies the line width unit setting for stroking lines.
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -640,7 +640,7 @@ sub context_set_line_cap_style {
 This procedure modifies the line cap style setting for stroking lines.
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -699,7 +699,7 @@ sub context_set_line_join_style {
 This procedure modifies the line join style setting for stroking lines.
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -762,7 +762,7 @@ extend to a distance of more than (miter-limit * line-width) from the
 actual join point.
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -821,7 +821,7 @@ sub context_set_line_dash_offset {
 This procedure modifies the line dash offset setting for stroking lines.
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -885,7 +885,7 @@ for the stroke operation, in other words a segment length of 1.0
 results in a square segment shape (or gap shape).
 
 This setting affects the following procedures:
-gimp_edit_stroke(), gimp_edit_stroke_vectors().
+gimp_drawable_edit_stroke_selection_(), gimp_drawable_edit_stroke_item().
 HELP
 
     &mitch_pdb_misc('2015', '2.10');
@@ -1692,6 +1692,180 @@ CODE
     );
 }
 
+sub context_set_gradient_blend_color_space {
+    $blurb = 'Set the gradient blend color space.';
+    $help = 'Set the gradient blend color space for paint tools and the gradient tool.';
+
+    &mitch_pdb_misc('2018', '2.10');
+
+    @inargs = (
+       { name => "blend_color_space", type => 'enum GimpGradientBlendColorSpace',
+         desc => "Blend color space" }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpContainer *options;
+  GList         *list;
+
+  options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+  for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+    g_object_set (list->data,
+                  "gradient-blend-color-space", blend_color_space,
+                   NULL);
+}
+CODE
+    );
+}
+
+sub context_get_gradient_blend_color_space {
+    $blurb = 'Get the gradient blend color space.';
+    $help = 'Get the gradient blend color space for paint tools and the gradient tool.';
+
+    &mitch_pdb_misc('2018', '2.10');
+
+    @outargs = (
+       { name => "blend_color_space", type => 'enum GimpGradientBlendColorSpace',
+         desc => "Color blend space" }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  /* all options should have the same value, so pick a random one */
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
+
+  if (options)
+    g_object_get (options,
+                  "gradient-blend-color-space", &blend_color_space,
+                  NULL);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub context_set_gradient_repeat_mode {
+    $blurb = 'Set the gradient repeat mode.';
+    $help = 'Set the gradient repeat mode for paint tools and the gradient tool.';
+
+    &mitch_pdb_misc('2018', '2.10');
+
+    @inargs = (
+       { name => "repeat_mode", type => 'enum GimpRepeatMode',
+         desc => "Repeat mode" }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpContainer *options;
+  GList         *list;
+
+  options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+  for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+    g_object_set (list->data,
+                  "gradient-repeat", repeat_mode,
+                   NULL);
+}
+CODE
+    );
+}
+
+sub context_get_gradient_repeat_mode {
+    $blurb = 'Get the gradient repeat mode.';
+    $help = 'Get the gradient repeat mode for paint tools and the gradient tool.';
+
+    &mitch_pdb_misc('2018', '2.10');
+
+    @outargs = (
+       { name => "repeat_mode", type => 'enum GimpRepeatMode',
+         desc => "Repeat mode" }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  /* all options should have the same value, so pick a random one */
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
+
+  if (options)
+    g_object_get (options,
+                  "gradient-repeat", &repeat_mode,
+                  NULL);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub context_set_gradient_reverse {
+    $blurb = 'Set the gradient reverse setting.';
+    $help = 'Set the gradient reverse setting for paint tools and the gradient tool.';
+
+    &mitch_pdb_misc('2018', '2.10');
+
+    @inargs = (
+       { name => "reverse", type => 'boolean',
+         desc => "Reverse" }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpContainer *options;
+  GList         *list;
+
+  options = gimp_pdb_context_get_paint_options_list (GIMP_PDB_CONTEXT (context));
+
+  for (list = GIMP_LIST (options)->queue->head; list; list = g_list_next (list))
+    g_object_set (list->data,
+                  "gradient-reverse", reverse,
+                   NULL);
+}
+CODE
+    );
+}
+
+sub context_get_gradient_reverse {
+    $blurb = 'Get the gradient reverse setting.';
+    $help = 'Get the gradient reverse setting for paint tools and the gradient tool.';
+
+    &mitch_pdb_misc('2018', '2.10');
+
+    @outargs = (
+       { name => "reverse", type => 'boolean',
+         desc => "Reverse" }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  /* all options should have the same value, so pick a random one */
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
+
+  if (options)
+    g_object_get (options,
+                  "gradient-reverse", &reverse,
+                  NULL);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub context_get_palette {
     $blurb = 'Retrieve the currently active palette.';
 
@@ -2337,6 +2511,60 @@ CODE
     );
 }
 
+sub context_get_distance_metric {
+    $blurb = 'Get the distance metric used in some computations.';
+
+    $help = <<'HELP';
+This procedure returns the distance metric in the current context.
+See gimp_context_set_distance_metric() to know more about its usage.
+HELP
+
+    &jehan_pdb_misc('2018', '2.10');
+
+    @outargs = (
+        { name => 'metric', type => 'enum GeglDistanceMetric',
+          desc => 'The distance metric' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  g_object_get (context,
+                "distance-metric", &metric,
+               NULL);
+}
+CODE
+    );
+}
+
+sub context_set_distance_metric {
+    $blurb = 'Set the distance metric used in some computations.';
+
+    $help = <<'HELP';
+This procedure modifies the distance metric used in some computations,
+such as gimp_drawable_edit_gradient_fill(). In particular, it does not
+change the metric used in generic distance computation on canvas, as
+in the Measure tool.
+HELP
+
+    &jehan_pdb_misc('2018', '2.10');
+
+    @inargs = (
+        { name => 'metric', type => 'enum GeglDistanceMetric',
+          desc => 'The distance metric' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  g_object_set (context,
+                "distance-metric", metric,
+               NULL);
+}
+CODE
+    );
+}
+
 sub context_get_interpolation {
     $blurb = 'Get the interpolation type.';
 
@@ -3032,63 +3260,11 @@ CODE
     );
 }
 
-sub context_get_distance_metric {
-    $blurb = 'Get the distance metric used in some computations.';
-
-    $help = <<'HELP';
-This procedure returns the distance metric in the current context.
-See gimp_context_set_distance_metric() to know more about its usage.
-HELP
-
-    &jehan_pdb_misc('2018', '2.10');
-
-    @outargs = (
-        { name => 'metric', type => 'enum GeglDistanceMetric',
-          desc => 'The distance metric' }
-    );
-
-    %invoke = (
-       code => <<'CODE'
-{
-  g_object_get (context,
-                "distance-metric", &metric,
-               NULL);
-}
-CODE
-    );
-}
-
-sub context_set_distance_metric {
-    $blurb = 'Set the distance metric used in some computations.';
-
-    $help = <<'HELP';
-This procedure modifies the distance metric used in some computations,
-such as gimp_edit_blend(). In particular, it does not change the metric used
-in generic distance computation on canvas, as in the Measure tool.
-HELP
-
-    &jehan_pdb_misc('2018', '2.10');
-
-    @inargs = (
-        { name => 'metric', type => 'enum GeglDistanceMetric',
-          desc => 'The distance metric' }
-    );
-
-    %invoke = (
-       code => <<'CODE'
-{
-  g_object_set (context,
-                "distance-metric", metric,
-               NULL);
-}
-CODE
-    );
-}
-
 @headers = qw("core/gimp.h"
               "core/gimpcontainer.h"
               "core/gimpdashpattern.h"
               "core/gimpdatafactory.h"
+              "core/gimplist.h"
               "core/gimpstrokeoptions.h"
               "paint/gimppaintoptions.h"
               "libgimpconfig/gimpconfig.h"
@@ -3130,6 +3306,9 @@ CODE
             context_get_mypaint_brush context_set_mypaint_brush
             context_get_pattern context_set_pattern
             context_get_gradient context_set_gradient
+            context_get_gradient_blend_color_space context_set_gradient_blend_color_space
+            context_get_gradient_repeat_mode context_set_gradient_repeat_mode
+            context_get_gradient_reverse context_set_gradient_reverse
             context_get_palette context_set_palette
             context_get_font context_set_font
             context_get_antialias context_set_antialias
@@ -3141,6 +3320,7 @@ CODE
             context_get_sample_threshold_int context_set_sample_threshold_int
             context_get_sample_transparent context_set_sample_transparent
             context_get_diagonal_neighbors context_set_diagonal_neighbors
+            context_get_distance_metric context_set_distance_metric
             context_get_interpolation context_set_interpolation
             context_get_transform_direction context_set_transform_direction
             context_get_transform_resize context_set_transform_resize
@@ -3152,8 +3332,7 @@ CODE
             context_get_ink_speed_sensitivity context_set_ink_speed_sensitivity
             context_get_ink_blob_type context_set_ink_blob_type
             context_get_ink_blob_aspect_ratio context_set_ink_blob_aspect_ratio
-            context_get_ink_blob_angle context_set_ink_blob_angle
-            context_get_distance_metric context_set_distance_metric);
+            context_get_ink_blob_angle context_set_ink_blob_angle);
 
 %exports = (app => [@procs], lib => [@procs]);
 
diff --git a/pdb/groups/edit.pdb b/pdb/groups/edit.pdb
index c180329..e907e15 100644
--- a/pdb/groups/edit.pdb
+++ b/pdb/groups/edit.pdb
@@ -517,8 +517,6 @@ the background color. This procedure only affects regions within a
 selection if there is a selection active.
 HELP
 
-    &std_pdb_misc;
-
     @inargs = (
        { name => 'drawable', type => 'drawable',
          desc => 'The drawable to clear from' }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ac749e9..e1d300e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -336,6 +336,7 @@ app/pdb/channel-cmds.c
 app/pdb/color-cmds.c
 app/pdb/drawable-cmds.c
 app/pdb/drawable-color-cmds.c
+app/pdb/drawable-edit-cmds.c
 app/pdb/drawable-transform-cmds.c
 app/pdb/edit-cmds.c
 app/pdb/floating-sel-cmds.c


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