[gimp] Bug 314379 - Allow stroking as outline (not with a paint tool) via the PDB



commit 7d1a47a5540629b94737388c27abd4bf99a1e0f7
Author: Michael Natterer <mitch gimp org>
Date:   Wed Nov 11 00:47:31 2015 +0100

    Bug 314379 - Allow stroking as outline (not with a paint tool) via the PDB
    
    Add PDB API to configure/query all aspects of line stroking.

 app/pdb/context-cmds.c       |  724 +++++++++++++++++++++++++++++++++++++++++-
 app/pdb/internal-procs.c     |    2 +-
 libgimp/gimp.def             |   14 +
 libgimp/gimpcontext_pdb.c    |  474 +++++++++++++++++++++++++++-
 libgimp/gimpcontext_pdb.h    |   16 +
 tools/pdbgen/pdb/context.pdb |  495 +++++++++++++++++++++++++++--
 6 files changed, 1695 insertions(+), 30 deletions(-)
---
diff --git a/app/pdb/context-cmds.c b/app/pdb/context-cmds.c
index 17245cc..e8af63e 100644
--- a/app/pdb/context-cmds.c
+++ b/app/pdb/context-cmds.c
@@ -34,8 +34,10 @@
 
 #include "core/gimp.h"
 #include "core/gimpcontainer.h"
+#include "core/gimpdashpattern.h"
 #include "core/gimpdatafactory.h"
 #include "core/gimpparamspecs.h"
+#include "core/gimpstrokeoptions.h"
 #include "paint/gimppaintoptions.h"
 #include "plug-in/gimpplugin-context.h"
 #include "plug-in/gimpplugin.h"
@@ -428,6 +430,377 @@ context_set_paint_mode_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
+context_get_line_width_invoker (GimpProcedure         *procedure,
+                                Gimp                  *gimp,
+                                GimpContext           *context,
+                                GimpProgress          *progress,
+                                const GimpValueArray  *args,
+                                GError               **error)
+{
+  GimpValueArray *return_vals;
+  gdouble line_width = 0.0;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "width", &line_width,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_double (gimp_value_array_index (return_vals, 1), line_width);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_width_invoker (GimpProcedure         *procedure,
+                                Gimp                  *gimp,
+                                GimpContext           *context,
+                                GimpProgress          *progress,
+                                const GimpValueArray  *args,
+                                GError               **error)
+{
+  gboolean success = TRUE;
+  gdouble line_width;
+
+  line_width = g_value_get_double (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      g_object_set (options,
+                    "width", line_width,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_width_unit_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  GimpValueArray *return_vals;
+  GimpUnit line_width_unit = 0;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "unit", &line_width_unit,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_int (gimp_value_array_index (return_vals, 1), line_width_unit);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_width_unit_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  gboolean success = TRUE;
+  GimpUnit line_width_unit;
+
+  line_width_unit = g_value_get_int (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      g_object_set (options,
+                    "unit", line_width_unit,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_cap_style_invoker (GimpProcedure         *procedure,
+                                    Gimp                  *gimp,
+                                    GimpContext           *context,
+                                    GimpProgress          *progress,
+                                    const GimpValueArray  *args,
+                                    GError               **error)
+{
+  GimpValueArray *return_vals;
+  gint32 cap_style = 0;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "cap-style", &cap_style,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_enum (gimp_value_array_index (return_vals, 1), cap_style);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_cap_style_invoker (GimpProcedure         *procedure,
+                                    Gimp                  *gimp,
+                                    GimpContext           *context,
+                                    GimpProgress          *progress,
+                                    const GimpValueArray  *args,
+                                    GError               **error)
+{
+  gboolean success = TRUE;
+  gint32 cap_style;
+
+  cap_style = g_value_get_enum (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      g_object_set (options,
+                    "cap-style", cap_style,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_join_style_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  GimpValueArray *return_vals;
+  gint32 join_style = 0;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "join-style", &join_style,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_enum (gimp_value_array_index (return_vals, 1), join_style);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_join_style_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
+{
+  gboolean success = TRUE;
+  gint32 join_style;
+
+  join_style = g_value_get_enum (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      g_object_set (options,
+                    "join-style", join_style,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_miter_limit_invoker (GimpProcedure         *procedure,
+                                      Gimp                  *gimp,
+                                      GimpContext           *context,
+                                      GimpProgress          *progress,
+                                      const GimpValueArray  *args,
+                                      GError               **error)
+{
+  GimpValueArray *return_vals;
+  gdouble miter_limit = 0.0;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "miter-limit", &miter_limit,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_double (gimp_value_array_index (return_vals, 1), miter_limit);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_miter_limit_invoker (GimpProcedure         *procedure,
+                                      Gimp                  *gimp,
+                                      GimpContext           *context,
+                                      GimpProgress          *progress,
+                                      const GimpValueArray  *args,
+                                      GError               **error)
+{
+  gboolean success = TRUE;
+  gdouble miter_limit;
+
+  miter_limit = g_value_get_double (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      g_object_set (options,
+                    "miter-limit", miter_limit,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_dash_offset_invoker (GimpProcedure         *procedure,
+                                      Gimp                  *gimp,
+                                      GimpContext           *context,
+                                      GimpProgress          *progress,
+                                      const GimpValueArray  *args,
+                                      GError               **error)
+{
+  GimpValueArray *return_vals;
+  gdouble dash_offset = 0.0;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "dash-offset", &dash_offset,
+                NULL);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+  g_value_set_double (gimp_value_array_index (return_vals, 1), dash_offset);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_dash_offset_invoker (GimpProcedure         *procedure,
+                                      Gimp                  *gimp,
+                                      GimpContext           *context,
+                                      GimpProgress          *progress,
+                                      const GimpValueArray  *args,
+                                      GError               **error)
+{
+  gboolean success = TRUE;
+  gdouble dash_offset;
+
+  dash_offset = g_value_get_double (gimp_value_array_index (args, 0));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      g_object_set (options,
+                    "dash-offset", dash_offset,
+                    NULL);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
+context_get_line_dash_pattern_invoker (GimpProcedure         *procedure,
+                                       Gimp                  *gimp,
+                                       GimpContext           *context,
+                                       GimpProgress          *progress,
+                                       const GimpValueArray  *args,
+                                       GError               **error)
+{
+  GimpValueArray *return_vals;
+  gint32 num_dashes = 0;
+  gdouble *dashes = NULL;
+
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  GArray *pattern = gimp_stroke_options_get_dash_info (options);
+
+  dashes = gimp_dash_pattern_to_double_array (pattern, &num_dashes);
+
+  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
+
+  g_value_set_int (gimp_value_array_index (return_vals, 1), num_dashes);
+  gimp_value_take_floatarray (gimp_value_array_index (return_vals, 2), dashes, num_dashes);
+
+  return return_vals;
+}
+
+static GimpValueArray *
+context_set_line_dash_pattern_invoker (GimpProcedure         *procedure,
+                                       Gimp                  *gimp,
+                                       GimpContext           *context,
+                                       GimpProgress          *progress,
+                                       const GimpValueArray  *args,
+                                       GError               **error)
+{
+  gboolean success = TRUE;
+  gint32 num_dashes;
+  const gdouble *dashes;
+
+  num_dashes = g_value_get_int (gimp_value_array_index (args, 0));
+  dashes = gimp_value_get_floatarray (gimp_value_array_index (args, 1));
+
+  if (success)
+    {
+      GimpStrokeOptions *options =
+        gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+      GArray *pattern = NULL;
+
+      if (num_dashes > 0)
+        {
+          pattern = gimp_dash_pattern_from_double_array (num_dashes, dashes);
+
+          if (! pattern)
+            success = FALSE;
+        }
+
+      if (success)
+        gimp_stroke_options_take_dash_pattern (options, GIMP_DASH_CUSTOM, pattern);
+    }
+
+  return gimp_procedure_get_return_values (procedure, success,
+                                           error ? *error : NULL);
+}
+
+static GimpValueArray *
 context_get_brush_invoker (GimpProcedure         *procedure,
                            Gimp                  *gimp,
                            GimpContext           *context,
@@ -2696,6 +3069,355 @@ register_context_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
+   * gimp-context-get-line-width
+   */
+  procedure = gimp_procedure_new (context_get_line_width_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-width");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-width",
+                                     "Get the line width setting.",
+                                     "This procedure returns the line width setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_double ("line-width",
+                                                        "line width",
+                                                        "The line width setting",
+                                                        0.0, 2000.0, 0.0,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-width
+   */
+  procedure = gimp_procedure_new (context_set_line_width_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-width");
+  gimp_procedure_set_static_strings (procedure,
+                                     "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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("line-width",
+                                                    "line width",
+                                                    "The line width setting",
+                                                    0.0, 2000.0, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-line-width-unit
+   */
+  procedure = gimp_procedure_new (context_get_line_width_unit_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-width-unit");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-width-unit",
+                                     "Get the line width unit setting.",
+                                     "This procedure returns the line width unit setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_unit ("line-width-unit",
+                                                         "line width unit",
+                                                         "The line width unit setting",
+                                                         TRUE,
+                                                         FALSE,
+                                                         GIMP_UNIT_PIXEL,
+                                                         GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-width-unit
+   */
+  procedure = gimp_procedure_new (context_set_line_width_unit_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-width-unit");
+  gimp_procedure_set_static_strings (procedure,
+                                     "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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_unit ("line-width-unit",
+                                                     "line width unit",
+                                                     "The line width setting unit",
+                                                     TRUE,
+                                                     FALSE,
+                                                     GIMP_UNIT_PIXEL,
+                                                     GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-line-cap-style
+   */
+  procedure = gimp_procedure_new (context_get_line_cap_style_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-cap-style");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-cap-style",
+                                     "Get the line cap style setting.",
+                                     "This procedure returns the line cap style setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_enum ("cap-style",
+                                                      "cap style",
+                                                      "The line cap style setting",
+                                                      GIMP_TYPE_CAP_STYLE,
+                                                      GIMP_CAP_BUTT,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-cap-style
+   */
+  procedure = gimp_procedure_new (context_set_line_cap_style_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-cap-style");
+  gimp_procedure_set_static_strings (procedure,
+                                     "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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("cap-style",
+                                                  "cap style",
+                                                  "The line cap style setting",
+                                                  GIMP_TYPE_CAP_STYLE,
+                                                  GIMP_CAP_BUTT,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-line-join-style
+   */
+  procedure = gimp_procedure_new (context_get_line_join_style_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-join-style");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-join-style",
+                                     "Get the line join style setting.",
+                                     "This procedure returns the line join style setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_enum ("join-style",
+                                                      "join style",
+                                                      "The line join style setting",
+                                                      GIMP_TYPE_JOIN_STYLE,
+                                                      GIMP_JOIN_MITER,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-join-style
+   */
+  procedure = gimp_procedure_new (context_set_line_join_style_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-join-style");
+  gimp_procedure_set_static_strings (procedure,
+                                     "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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_enum ("join-style",
+                                                  "join style",
+                                                  "The line join style setting",
+                                                  GIMP_TYPE_JOIN_STYLE,
+                                                  GIMP_JOIN_MITER,
+                                                  GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-line-miter-limit
+   */
+  procedure = gimp_procedure_new (context_get_line_miter_limit_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-miter-limit");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-miter-limit",
+                                     "Get the line miter limit setting.",
+                                     "This procedure returns the line miter limit setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_double ("miter-limit",
+                                                        "miter limit",
+                                                        "The line miter limit setting",
+                                                        0.0, 100.0, 0.0,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-miter-limit
+   */
+  procedure = gimp_procedure_new (context_set_line_miter_limit_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-miter-limit");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-line-miter-limit",
+                                     "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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("miter-limit",
+                                                    "miter limit",
+                                                    "The line miter limit setting",
+                                                    0.0, 100.0, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-line-dash-offset
+   */
+  procedure = gimp_procedure_new (context_get_line_dash_offset_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-dash-offset");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-dash-offset",
+                                     "Get the line dash offset setting.",
+                                     "This procedure returns the line dash offset setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   g_param_spec_double ("dash-offset",
+                                                        "dash offset",
+                                                        "The line dash offset setting",
+                                                        0.0, 2000.0, 0.0,
+                                                        GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-dash-offset
+   */
+  procedure = gimp_procedure_new (context_set_line_dash_offset_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-dash-offset");
+  gimp_procedure_set_static_strings (procedure,
+                                     "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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               g_param_spec_double ("dash-offset",
+                                                    "dash offset",
+                                                    "The line dash offset setting",
+                                                    0.0, 100.0, 0.0,
+                                                    GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-get-line-dash-pattern
+   */
+  procedure = gimp_procedure_new (context_get_line_dash_pattern_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-get-line-dash-pattern");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-get-line-dash-pattern",
+                                     "Get the line dash pattern setting.",
+                                     "This procedure returns the line dash pattern setting.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_int32 ("num-dashes",
+                                                          "num dashes",
+                                                          "The number of dashes in the dash_pattern array",
+                                                          0, G_MAXINT32, 0,
+                                                          GIMP_PARAM_READWRITE));
+  gimp_procedure_add_return_value (procedure,
+                                   gimp_param_spec_float_array ("dashes",
+                                                                "dashes",
+                                                                "The line dash pattern setting",
+                                                                GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
+   * gimp-context-set-line-dash-pattern
+   */
+  procedure = gimp_procedure_new (context_set_line_dash_pattern_invoker);
+  gimp_object_set_static_name (GIMP_OBJECT (procedure),
+                               "gimp-context-set-line-dash-pattern");
+  gimp_procedure_set_static_strings (procedure,
+                                     "gimp-context-set-line-dash-pattern",
+                                     "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 opertation, 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'.",
+                                     "Michael Natterer <mitch gimp org>",
+                                     "Michael Natterer",
+                                     "2015",
+                                     NULL);
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_int32 ("num-dashes",
+                                                      "num dashes",
+                                                      "The number of dashes in the dash_pattern array",
+                                                      0, G_MAXINT32, 0,
+                                                      GIMP_PARAM_READWRITE));
+  gimp_procedure_add_argument (procedure,
+                               gimp_param_spec_float_array ("dashes",
+                                                            "dashes",
+                                                            "The line dash pattern setting",
+                                                            GIMP_PARAM_READWRITE));
+  gimp_pdb_register_procedure (pdb, procedure);
+  g_object_unref (procedure);
+
+  /*
    * gimp-context-get-brush
    */
   procedure = gimp_procedure_new (context_get_brush_invoker);
@@ -3343,7 +4065,7 @@ register_context_procs (GimpPDB *pdb)
                                      "gimp-context-set-antialias",
                                      "Set the antialias setting.",
                                      "This procedure modifies the antialias setting. If antialiasing is 
turned on, the edges of selected region will contain intermediate values which give the appearance of a 
sharper, less pixelized edge. This should be set as TRUE most of the time unless a binary-only selection is 
wanted.\n"
-                                     "This settings affects the following procedures: 
'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-image-select-round-rectangle', 
'gimp-image-select-ellipse', 'gimp-image-select-polygon', 'gimp-image-select-item'.",
+                                     "This setting affects the following procedures: 
'gimp-image-select-color', 'gimp-image-select-contiguous-color', 'gimp-image-select-round-rectangle', 
'gimp-image-select-ellipse', 'gimp-image-select-polygon', 'gimp-image-select-item'.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
                                      "2010",
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 0989bdc..3d24d91 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
 #include "internal-procs.h"
 
 
-/* 775 procedures registered total */
+/* 789 procedures registered total */
 
 void
 internal_procs_init (GimpPDB *pdb)
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 470acbb..9d3c805 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -92,6 +92,13 @@ EXPORTS
        gimp_context_get_ink_speed_sensitivity
        gimp_context_get_ink_tilt_sensitivity
        gimp_context_get_interpolation
+       gimp_context_get_line_cap_style
+       gimp_context_get_line_dash_offset
+       gimp_context_get_line_dash_pattern
+       gimp_context_get_line_join_style
+       gimp_context_get_line_miter_limit
+       gimp_context_get_line_width
+       gimp_context_get_line_width_unit
        gimp_context_get_opacity
        gimp_context_get_paint_method
        gimp_context_get_paint_mode
@@ -138,6 +145,13 @@ EXPORTS
        gimp_context_set_ink_speed_sensitivity
        gimp_context_set_ink_tilt_sensitivity
        gimp_context_set_interpolation
+       gimp_context_set_line_cap_style
+       gimp_context_set_line_dash_offset
+       gimp_context_set_line_dash_pattern
+       gimp_context_set_line_join_style
+       gimp_context_set_line_miter_limit
+       gimp_context_set_line_width
+       gimp_context_set_line_width_unit
        gimp_context_set_opacity
        gimp_context_set_paint_method
        gimp_context_set_paint_mode
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index e437b0d..51f1659 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -22,6 +22,8 @@
 
 #include "config.h"
 
+#include <string.h>
+
 #include "gimp.h"
 
 
@@ -634,6 +636,476 @@ gimp_context_set_paint_mode (GimpLayerModeEffects paint_mode)
 }
 
 /**
+ * gimp_context_get_line_width:
+ *
+ * Get the line width setting.
+ *
+ * This procedure returns the line width setting.
+ *
+ * Returns: The line width setting.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_line_width (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gdouble line_width = 0.0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-width",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    line_width = return_vals[1].data.d_float;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return line_width;
+}
+
+/**
+ * gimp_context_set_line_width:
+ * @line_width: The line width setting.
+ *
+ * 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().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_width (gdouble line_width)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-width",
+                                    &nreturn_vals,
+                                    GIMP_PDB_FLOAT, line_width,
+                                    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_line_width_unit:
+ *
+ * Get the line width unit setting.
+ *
+ * This procedure returns the line width unit setting.
+ *
+ * Returns: The line width unit setting.
+ *
+ * Since: 2.10
+ **/
+GimpUnit
+gimp_context_get_line_width_unit (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpUnit line_width_unit = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-width-unit",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    line_width_unit = return_vals[1].data.d_unit;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return line_width_unit;
+}
+
+/**
+ * gimp_context_set_line_width_unit:
+ * @line_width_unit: The line width setting unit.
+ *
+ * Set the line width unit setting.
+ *
+ * This procedure modifies the line width unit setting for stroking
+ * lines.
+ * This setting affects the following procedures: gimp_edit_stroke(),
+ * gimp_edit_stroke_vectors().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_width_unit (GimpUnit line_width_unit)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-width-unit",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, line_width_unit,
+                                    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_line_cap_style:
+ *
+ * Get the line cap style setting.
+ *
+ * This procedure returns the line cap style setting.
+ *
+ * Returns: The line cap style setting.
+ *
+ * Since: 2.10
+ **/
+GimpCapStyle
+gimp_context_get_line_cap_style (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpCapStyle cap_style = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-cap-style",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    cap_style = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return cap_style;
+}
+
+/**
+ * gimp_context_set_line_cap_style:
+ * @cap_style: The line cap style setting.
+ *
+ * Set the line cap style setting.
+ *
+ * This procedure modifies the line cap style setting for stroking
+ * lines.
+ * This setting affects the following procedures: gimp_edit_stroke(),
+ * gimp_edit_stroke_vectors().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_cap_style (GimpCapStyle cap_style)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-cap-style",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, cap_style,
+                                    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_line_join_style:
+ *
+ * Get the line join style setting.
+ *
+ * This procedure returns the line join style setting.
+ *
+ * Returns: The line join style setting.
+ *
+ * Since: 2.10
+ **/
+GimpJoinStyle
+gimp_context_get_line_join_style (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  GimpJoinStyle join_style = 0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-join-style",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    join_style = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return join_style;
+}
+
+/**
+ * gimp_context_set_line_join_style:
+ * @join_style: The line join style setting.
+ *
+ * Set the line join style setting.
+ *
+ * This procedure modifies the line join style setting for stroking
+ * lines.
+ * This setting affects the following procedures: gimp_edit_stroke(),
+ * gimp_edit_stroke_vectors().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_join_style (GimpJoinStyle join_style)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-join-style",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, join_style,
+                                    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_line_miter_limit:
+ *
+ * Get the line miter limit setting.
+ *
+ * This procedure returns the line miter limit setting.
+ *
+ * Returns: The line miter limit setting.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_line_miter_limit (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gdouble miter_limit = 0.0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-miter-limit",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    miter_limit = return_vals[1].data.d_float;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return miter_limit;
+}
+
+/**
+ * gimp_context_set_line_miter_limit:
+ * @miter_limit: The line miter limit setting.
+ *
+ * Set the line miter limit setting.
+ *
+ * This procedure modifies the line miter limit setting for stroking
+ * lines.
+ * 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().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_miter_limit (gdouble miter_limit)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-miter-limit",
+                                    &nreturn_vals,
+                                    GIMP_PDB_FLOAT, miter_limit,
+                                    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_line_dash_offset:
+ *
+ * Get the line dash offset setting.
+ *
+ * This procedure returns the line dash offset setting.
+ *
+ * Returns: The line dash offset setting.
+ *
+ * Since: 2.10
+ **/
+gdouble
+gimp_context_get_line_dash_offset (void)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gdouble dash_offset = 0.0;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-dash-offset",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    dash_offset = return_vals[1].data.d_float;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return dash_offset;
+}
+
+/**
+ * gimp_context_set_line_dash_offset:
+ * @dash_offset: The line dash offset setting.
+ *
+ * Set the line dash offset setting.
+ *
+ * This procedure modifies the line dash offset setting for stroking
+ * lines.
+ * This setting affects the following procedures: gimp_edit_stroke(),
+ * gimp_edit_stroke_vectors().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_dash_offset (gdouble dash_offset)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-dash-offset",
+                                    &nreturn_vals,
+                                    GIMP_PDB_FLOAT, dash_offset,
+                                    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_line_dash_pattern:
+ * @num_dashes: The number of dashes in the dash_pattern array.
+ * @dashes: The line dash pattern setting.
+ *
+ * Get the line dash pattern setting.
+ *
+ * This procedure returns the line dash pattern setting.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_get_line_dash_pattern (gint     *num_dashes,
+                                    gdouble **dashes)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-get-line-dash-pattern",
+                                    &nreturn_vals,
+                                    GIMP_PDB_END);
+
+  *num_dashes = 0;
+  *dashes = NULL;
+
+  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+  if (success)
+    {
+      *num_dashes = return_vals[1].data.d_int32;
+      *dashes = g_new (gdouble, *num_dashes);
+      memcpy (*dashes,
+              return_vals[2].data.d_floatarray,
+              *num_dashes * sizeof (gdouble));
+    }
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return success;
+}
+
+/**
+ * gimp_context_set_line_dash_pattern:
+ * @num_dashes: The number of dashes in the dash_pattern array.
+ * @dashes: The line dash pattern setting.
+ *
+ * Set the line dash pattern setting.
+ *
+ * This procedure modifies the line dash pattern setting for stroking
+ * lines.
+ * The unit of the dash pattern segments is the actual line width used
+ * for the stroke opertation, 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().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_context_set_line_dash_pattern (gint           num_dashes,
+                                    const gdouble *dashes)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gboolean success = TRUE;
+
+  return_vals = gimp_run_procedure ("gimp-context-set-line-dash-pattern",
+                                    &nreturn_vals,
+                                    GIMP_PDB_INT32, num_dashes,
+                                    GIMP_PDB_FLOATARRAY, dashes,
+                                    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_brush:
  *
  * Retrieve the currently active brush.
@@ -1532,7 +2004,7 @@ gimp_context_get_antialias (void)
  * values which give the appearance of a sharper, less pixelized edge.
  * This should be set as TRUE most of the time unless a binary-only
  * selection is wanted.
- * This settings affects the following procedures:
+ * This setting affects the following procedures:
  * gimp_image_select_color(), gimp_image_select_contiguous_color(),
  * gimp_image_select_round_rectangle(), gimp_image_select_ellipse(),
  * gimp_image_select_polygon(), gimp_image_select_item().
diff --git a/libgimp/gimpcontext_pdb.h b/libgimp/gimpcontext_pdb.h
index 6525214..361379c 100644
--- a/libgimp/gimpcontext_pdb.h
+++ b/libgimp/gimpcontext_pdb.h
@@ -51,6 +51,22 @@ gdouble                gimp_context_get_opacity                (void);
 gboolean               gimp_context_set_opacity                (gdouble                   opacity);
 GimpLayerModeEffects   gimp_context_get_paint_mode             (void);
 gboolean               gimp_context_set_paint_mode             (GimpLayerModeEffects      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);
diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb
index 29b4e09..31d4b7b 100644
--- a/tools/pdbgen/pdb/context.pdb
+++ b/tools/pdbgen/pdb/context.pdb
@@ -97,6 +97,32 @@ CODE
     );
 }
 
+sub context_list_paint_methods {
+    $blurb = 'Lists the available paint methods.';
+
+    $help = <<'HELP';
+This procedure lists the names of the available paint methods. Any
+of the results can be used for gimp_context_set_paint_method().
+HELP
+
+    &simon_pdb_misc('2007', '2.4');
+
+    @outargs = (
+        { name => 'paint_methods', type => 'stringarray', void_ret => 1,
+          desc => 'The names of the available paint methods',
+          array => { desc => 'The number of the available paint methods' } }
+    );
+
+    %invoke = (
+        code => <<'CODE'
+{
+  paint_methods = gimp_container_get_name_array (gimp->paint_info_list,
+                                                 &num_paint_methods);
+}
+CODE
+    );
+}
+
 sub context_get_paint_method {
     $blurb = 'Retrieve the currently active paint method.';
 
@@ -158,32 +184,6 @@ CODE
     );
 }
 
-sub context_list_paint_methods {
-    $blurb = 'Lists the available paint methods.';
-
-    $help = <<'HELP';
-This procedure lists the names of the available paint methods. Any
-of the results can be used for gimp_context_set_paint_method().
-HELP
-
-    &simon_pdb_misc('2007', '2.4');
-
-    @outargs = (
-        { name => 'paint_methods', type => 'stringarray', void_ret => 1,
-          desc => 'The names of the available paint methods',
-          array => { desc => 'The number of the available paint methods' } }
-    );
-
-    %invoke = (
-        code => <<'CODE'
-{
-  paint_methods = gimp_container_get_name_array (gimp->paint_info_list,
-                                                 &num_paint_methods);
-}
-CODE
-    );
-}
-
 sub context_get_stroke_method {
     $blurb = 'Retrieve the currently active stroke method.';
 
@@ -485,6 +485,438 @@ CODE
     );
 }
 
+sub context_get_line_width {
+    $blurb = 'Get the line width setting.';
+
+    $help = <<'HELP';
+This procedure returns the line width setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'line_width', type => '0.0 <= float <= 2000.0',
+          desc => 'The line width setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "width", &line_width,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_line_width {
+    $blurb = 'Set the line width setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line width setting for stroking lines.
+
+This setting affects the following procedures:
+gimp_edit_stroke(), gimp_edit_stroke_vectors().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'line_width', type => '0.0 <= float <= 2000.0',
+          desc => 'The line width setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_set (options,
+                "width", line_width,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_get_line_width_unit {
+    $blurb = 'Get the line width unit setting.';
+
+    $help = <<'HELP';
+This procedure returns the line width unit setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'line_width_unit', type => 'unit',
+          desc => 'The line width unit setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "unit", &line_width_unit,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_line_width_unit {
+    $blurb = 'Set the line width unit setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line width unit setting for stroking lines.
+
+This setting affects the following procedures:
+gimp_edit_stroke(), gimp_edit_stroke_vectors().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'line_width_unit', type => 'unit',
+          desc => 'The line width setting unit' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_set (options,
+                "unit", line_width_unit,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_get_line_cap_style {
+    $blurb = 'Get the line cap style setting.';
+
+    $help = <<'HELP';
+This procedure returns the line cap style setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'cap_style', type => 'enum GimpCapStyle',
+          desc => 'The line cap style setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "cap-style", &cap_style,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_line_cap_style {
+    $blurb = 'Set the line cap style setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line cap style setting for stroking lines.
+
+This setting affects the following procedures:
+gimp_edit_stroke(), gimp_edit_stroke_vectors().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'cap_style', type => 'enum GimpCapStyle',
+          desc => 'The line cap style setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_set (options,
+                "cap-style", cap_style,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_get_line_join_style {
+    $blurb = 'Get the line join style setting.';
+
+    $help = <<'HELP';
+This procedure returns the line join style setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'join_style', type => 'enum GimpJoinStyle',
+          desc => 'The line join style setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "join-style", &join_style,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_line_join_style {
+    $blurb = 'Set the line join style setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line join style setting for stroking lines.
+
+This setting affects the following procedures:
+gimp_edit_stroke(), gimp_edit_stroke_vectors().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'join_style', type => 'enum GimpJoinStyle',
+          desc => 'The line join style setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_set (options,
+                "join-style", join_style,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_get_line_miter_limit {
+    $blurb = 'Get the line miter limit setting.';
+
+    $help = <<'HELP';
+This procedure returns the line miter limit setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'miter_limit', type => '0.0 <= float <= 100.0',
+          desc => 'The line miter limit setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "miter-limit", &miter_limit,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_line_miter_limit {
+    $blurb = 'Set the line miter limit setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line miter limit setting for stroking lines.
+
+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().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'miter_limit', type => '0.0 <= float <= 100.0',
+          desc => 'The line miter limit setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_set (options,
+                "miter-limit", miter_limit,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_get_line_dash_offset {
+    $blurb = 'Get the line dash offset setting.';
+
+    $help = <<'HELP';
+This procedure returns the line dash offset setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'dash_offset', type => '0.0 <= float <= 2000.0',
+          desc => 'The line dash offset setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_get (options,
+                "dash-offset", &dash_offset,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_set_line_dash_offset {
+    $blurb = 'Set the line dash offset setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line dash offset setting for stroking lines.
+
+This setting affects the following procedures:
+gimp_edit_stroke(), gimp_edit_stroke_vectors().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'dash_offset', type => '0.0 <= float <= 100.0',
+          desc => 'The line dash offset setting' }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  g_object_set (options,
+                "dash-offset", dash_offset,
+                NULL);
+}
+CODE
+    );
+}
+
+sub context_get_line_dash_pattern {
+    $blurb = 'Get the line dash pattern setting.';
+
+    $help = <<'HELP';
+This procedure returns the line dash pattern setting.
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @outargs = (
+        { name => 'dashes', type => 'floatarray', void_ret => 1,
+          desc => 'The line dash pattern setting',
+          array => { desc => 'The number of dashes in the dash_pattern array' } }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  GArray *pattern = gimp_stroke_options_get_dash_info (options);
+
+  dashes = gimp_dash_pattern_to_double_array (pattern, &num_dashes);
+}
+CODE
+    );
+}
+
+sub context_set_line_dash_pattern {
+    $blurb = 'Set the line dash pattern setting.';
+
+    $help = <<'HELP';
+This procedure modifies the line dash pattern setting for stroking lines.
+
+The unit of the dash pattern segments is the actual line width used
+for the stroke opertation, 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().
+HELP
+
+    &mitch_pdb_misc('2015', '2.10');
+
+    @inargs = (
+        { name => 'dashes', type => 'floatarray',
+          desc => 'The line dash pattern setting',
+          array => { desc => 'The number of dashes in the dash_pattern array' } }
+    );
+
+    %invoke = (
+       code => <<'CODE'
+{
+  GimpStrokeOptions *options =
+    gimp_pdb_context_get_stroke_options (GIMP_PDB_CONTEXT (context));
+
+  GArray *pattern = NULL;
+
+  if (num_dashes > 0)
+    {
+      pattern = gimp_dash_pattern_from_double_array (num_dashes, dashes);
+
+      if (! pattern)
+        success = FALSE;
+    }
+
+  if (success)
+    gimp_stroke_options_take_dash_pattern (options, GIMP_DASH_CUSTOM, pattern);
+}
+CODE
+    );
+}
+
 sub context_get_brush {
     $blurb = 'Retrieve the currently active brush.';
 
@@ -1352,7 +1784,7 @@ values which give the appearance of a sharper, less pixelized edge.
 This should be set as TRUE most of the time unless a binary-only
 selection is wanted.
 
-This settings affects the following procedures:
+This setting affects the following procedures:
 gimp_image_select_color(), gimp_image_select_contiguous_color(),
 gimp_image_select_round_rectangle(), gimp_image_select_ellipse(),
 gimp_image_select_polygon(), gimp_image_select_item().
@@ -2475,7 +2907,9 @@ CODE
 
 @headers = qw("core/gimp.h"
               "core/gimpcontainer.h"
+              "core/gimpdashpattern.h"
               "core/gimpdatafactory.h"
+              "core/gimpstrokeoptions.h"
               "paint/gimppaintoptions.h"
               "libgimpconfig/gimpconfig.h"
               "plug-in/gimpplugin.h"
@@ -2494,6 +2928,13 @@ CODE
             context_swap_colors
             context_get_opacity context_set_opacity
             context_get_paint_mode context_set_paint_mode
+            context_get_line_width context_set_line_width
+            context_get_line_width_unit context_set_line_width_unit
+            context_get_line_cap_style context_set_line_cap_style
+            context_get_line_join_style context_set_line_join_style
+            context_get_line_miter_limit context_set_line_miter_limit
+            context_get_line_dash_offset context_set_line_dash_offset
+            context_get_line_dash_pattern context_set_line_dash_pattern
             context_get_brush context_set_brush
             context_get_brush_size
             context_set_brush_size context_set_brush_default_size


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