/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * 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 <https://www.gnu.org/licenses/>.
 */

/* NOTE: This file is auto-generated by pdbgen.pl. */

#include "config.h"

#include "stamp-pdbgen.h"

#include <cairo.h>

#include <gegl.h>

#include <gdk-pixbuf/gdk-pixbuf.h>

#include "libpikacolor/pikacolor.h"
#include "libpikaconfig/pikaconfig.h"

#include "libpikabase/pikabase.h"

#include "pdb-types.h"

#include "core/pika-gradients.h"
#include "core/pika.h"
#include "core/pikabrush.h"
#include "core/pikacontainer.h"
#include "core/pikadashpattern.h"
#include "core/pikadatafactory.h"
#include "core/pikadynamics.h"
#include "core/pikagradient.h"
#include "core/pikalist.h"
#include "core/pikamybrush.h"
#include "core/pikapalette.h"
#include "core/pikaparamspecs.h"
#include "core/pikapattern.h"
#include "core/pikaresource.h"
#include "core/pikastrokeoptions.h"
#include "paint/pikapaintoptions.h"
#include "plug-in/pikaplugin-context.h"
#include "plug-in/pikaplugin.h"
#include "plug-in/pikapluginmanager.h"
#include "text/pikafont.h"

#include "pikapdb.h"
#include "pikapdb-utils.h"
#include "pikapdbcontext.h"
#include "pikaprocedure.h"
#include "internal-procs.h"


static PikaValueArray *
context_push_invoker (PikaProcedure         *procedure,
                      Pika                  *pika,
                      PikaContext           *context,
                      PikaProgress          *progress,
                      const PikaValueArray  *args,
                      GError               **error)
{
  gboolean success = TRUE;
  PikaPlugIn *plug_in = pika->plug_in_manager->current_plug_in;

  if (plug_in && plug_in->open)
    success = pika_plug_in_context_push (plug_in);
  else
    success = FALSE;

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_pop_invoker (PikaProcedure         *procedure,
                     Pika                  *pika,
                     PikaContext           *context,
                     PikaProgress          *progress,
                     const PikaValueArray  *args,
                     GError               **error)
{
  gboolean success = TRUE;
  PikaPlugIn *plug_in = pika->plug_in_manager->current_plug_in;

  if (plug_in && plug_in->open)
    success = pika_plug_in_context_pop (plug_in);
  else
    success = FALSE;

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_set_defaults_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
    pika_config_reset (PIKA_CONFIG (context));

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_list_paint_methods_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  PikaValueArray *return_vals;
  gchar **paint_methods = NULL;

  paint_methods = pika_container_get_name_array (pika->paint_info_list);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_take_boxed (pika_value_array_index (return_vals, 1), paint_methods);

  return return_vals;
}

static PikaValueArray *
context_get_paint_method_invoker (PikaProcedure         *procedure,
                                  Pika                  *pika,
                                  PikaContext           *context,
                                  PikaProgress          *progress,
                                  const PikaValueArray  *args,
                                  GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gchar *name = NULL;

  PikaPaintInfo *paint_info = pika_context_get_paint_info (context);

  if (paint_info)
    name = g_strdup (pika_object_get_name (paint_info));
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_take_string (pika_value_array_index (return_vals, 1), name);

  return return_vals;
}

static PikaValueArray *
context_set_paint_method_invoker (PikaProcedure         *procedure,
                                  Pika                  *pika,
                                  PikaContext           *context,
                                  PikaProgress          *progress,
                                  const PikaValueArray  *args,
                                  GError               **error)
{
  gboolean success = TRUE;
  const gchar *name;

  name = g_value_get_string (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintInfo *paint_info = pika_pdb_get_paint_info (pika, name, error);

      if (paint_info)
        pika_context_set_paint_info (context, paint_info);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_stroke_method_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  PikaValueArray *return_vals;
  gint stroke_method = 0;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "method", &stroke_method,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), stroke_method);

  return return_vals;
}

static PikaValueArray *
context_set_stroke_method_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  gint stroke_method;

  stroke_method = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "method", stroke_method,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_foreground_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  PikaValueArray *return_vals;
  PikaRGB foreground = { 0.0, 0.0, 0.0, 1.0 };

  pika_context_get_foreground (context, &foreground);
  pika_rgb_set_alpha (&foreground, 1.0);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  pika_value_set_rgb (pika_value_array_index (return_vals, 1), &foreground);

  return return_vals;
}

static PikaValueArray *
context_set_foreground_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  gboolean success = TRUE;
  PikaRGB foreground;

  pika_value_get_rgb (pika_value_array_index (args, 0), &foreground);

  if (success)
    {
      pika_rgb_set_alpha (&foreground, 1.0);
      pika_context_set_foreground (context, &foreground);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_background_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  PikaValueArray *return_vals;
  PikaRGB background = { 0.0, 0.0, 0.0, 1.0 };

  pika_context_get_background (context, &background);
  pika_rgb_set_alpha (&background, 1.0);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  pika_value_set_rgb (pika_value_array_index (return_vals, 1), &background);

  return return_vals;
}

static PikaValueArray *
context_set_background_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  gboolean success = TRUE;
  PikaRGB background;

  pika_value_get_rgb (pika_value_array_index (args, 0), &background);

  if (success)
    {
      pika_rgb_set_alpha (&background, 1.0);
      pika_context_set_background (context, &background);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_set_default_colors_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  pika_context_set_default_colors (context);

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_swap_colors_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  pika_context_swap_colors (context);

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_get_opacity_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  PikaValueArray *return_vals;
  gdouble opacity = 0.0;

  opacity = pika_context_get_opacity (context) * 100.0;

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_double (pika_value_array_index (return_vals, 1), opacity);

  return return_vals;
}

static PikaValueArray *
context_set_opacity_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  gdouble opacity;

  opacity = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      pika_context_set_opacity (context, opacity / 100.0);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_paint_mode_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  PikaValueArray *return_vals;
  gint paint_mode = 0;

  paint_mode = pika_context_get_paint_mode (context);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), paint_mode);

  return return_vals;
}

static PikaValueArray *
context_set_paint_mode_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  gboolean success = TRUE;
  gint paint_mode;

  paint_mode = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      if (paint_mode == PIKA_LAYER_MODE_OVERLAY_LEGACY)
        paint_mode = PIKA_LAYER_MODE_SOFTLIGHT_LEGACY;

      pika_context_set_paint_mode (context, paint_mode);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_width_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  PikaValueArray *return_vals;
  gdouble line_width = 0.0;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "width", &line_width,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_double (pika_value_array_index (return_vals, 1), line_width);

  return return_vals;
}

static PikaValueArray *
context_set_line_width_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  gboolean success = TRUE;
  gdouble line_width;

  line_width = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "width", line_width,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_width_unit_invoker (PikaProcedure         *procedure,
                                     Pika                  *pika,
                                     PikaContext           *context,
                                     PikaProgress          *progress,
                                     const PikaValueArray  *args,
                                     GError               **error)
{
  PikaValueArray *return_vals;
  PikaUnit line_width_unit = PIKA_UNIT_PIXEL;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "unit", &line_width_unit,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_int (pika_value_array_index (return_vals, 1), line_width_unit);

  return return_vals;
}

static PikaValueArray *
context_set_line_width_unit_invoker (PikaProcedure         *procedure,
                                     Pika                  *pika,
                                     PikaContext           *context,
                                     PikaProgress          *progress,
                                     const PikaValueArray  *args,
                                     GError               **error)
{
  gboolean success = TRUE;
  PikaUnit line_width_unit;

  line_width_unit = g_value_get_int (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "unit", line_width_unit,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_cap_style_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  PikaValueArray *return_vals;
  gint cap_style = 0;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "cap-style", &cap_style,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), cap_style);

  return return_vals;
}

static PikaValueArray *
context_set_line_cap_style_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  gint cap_style;

  cap_style = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "cap-style", cap_style,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_join_style_invoker (PikaProcedure         *procedure,
                                     Pika                  *pika,
                                     PikaContext           *context,
                                     PikaProgress          *progress,
                                     const PikaValueArray  *args,
                                     GError               **error)
{
  PikaValueArray *return_vals;
  gint join_style = 0;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "join-style", &join_style,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), join_style);

  return return_vals;
}

static PikaValueArray *
context_set_line_join_style_invoker (PikaProcedure         *procedure,
                                     Pika                  *pika,
                                     PikaContext           *context,
                                     PikaProgress          *progress,
                                     const PikaValueArray  *args,
                                     GError               **error)
{
  gboolean success = TRUE;
  gint join_style;

  join_style = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "join-style", join_style,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_miter_limit_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  PikaValueArray *return_vals;
  gdouble miter_limit = 0.0;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "miter-limit", &miter_limit,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_double (pika_value_array_index (return_vals, 1), miter_limit);

  return return_vals;
}

static PikaValueArray *
context_set_line_miter_limit_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  gdouble miter_limit;

  miter_limit = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "miter-limit", miter_limit,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_dash_offset_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  PikaValueArray *return_vals;
  gdouble dash_offset = 0.0;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  g_object_get (options,
                "dash-offset", &dash_offset,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_double (pika_value_array_index (return_vals, 1), dash_offset);

  return return_vals;
}

static PikaValueArray *
context_set_line_dash_offset_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  gdouble dash_offset;

  dash_offset = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      g_object_set (options,
                    "dash-offset", dash_offset,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_line_dash_pattern_invoker (PikaProcedure         *procedure,
                                       Pika                  *pika,
                                       PikaContext           *context,
                                       PikaProgress          *progress,
                                       const PikaValueArray  *args,
                                       GError               **error)
{
  PikaValueArray *return_vals;
  gint num_dashes = 0;
  gdouble *dashes = NULL;

  PikaStrokeOptions *options =
    pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

  GArray *pattern = pika_stroke_options_get_dash_info (options);

  dashes = pika_dash_pattern_to_double_array (pattern, &num_dashes);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);

  g_value_set_int (pika_value_array_index (return_vals, 1), num_dashes);
  pika_value_take_float_array (pika_value_array_index (return_vals, 2), dashes, num_dashes);

  return return_vals;
}

static PikaValueArray *
context_set_line_dash_pattern_invoker (PikaProcedure         *procedure,
                                       Pika                  *pika,
                                       PikaContext           *context,
                                       PikaProgress          *progress,
                                       const PikaValueArray  *args,
                                       GError               **error)
{
  gboolean success = TRUE;
  gint num_dashes;
  const gdouble *dashes;

  num_dashes = g_value_get_int (pika_value_array_index (args, 0));
  dashes = pika_value_get_float_array (pika_value_array_index (args, 1));

  if (success)
    {
      PikaStrokeOptions *options =
        pika_pdb_context_get_stroke_options (PIKA_PDB_CONTEXT (context));

      GArray *pattern = NULL;

      if (num_dashes > 0)
        {
          pattern = pika_dash_pattern_from_double_array (num_dashes, dashes);

          if (! pattern)
            success = FALSE;
        }

      if (success)
        pika_stroke_options_take_dash_pattern (options, PIKA_DASH_CUSTOM, pattern);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_brush_invoker (PikaProcedure         *procedure,
                           Pika                  *pika,
                           PikaContext           *context,
                           PikaProgress          *progress,
                           const PikaValueArray  *args,
                           GError               **error)
{
  PikaValueArray *return_vals;
  PikaBrush *brush = NULL;

  brush = pika_context_get_brush (context);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_object (pika_value_array_index (return_vals, 1), brush);

  return return_vals;
}

static PikaValueArray *
context_set_brush_invoker (PikaProcedure         *procedure,
                           Pika                  *pika,
                           PikaContext           *context,
                           PikaProgress          *progress,
                           const PikaValueArray  *args,
                           GError               **error)
{
  PikaBrush *brush;

  brush = g_value_get_object (pika_value_array_index (args, 0));

  pika_context_set_brush (context, brush);


  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_get_brush_size_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble size = 0.0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "brush-size", &size,
                   NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), size);

  return return_vals;
}

static PikaValueArray *
context_set_brush_size_invoker (PikaProcedure         *procedure,
                                Pika                  *pika,
                                PikaContext           *context,
                                PikaProgress          *progress,
                                const PikaValueArray  *args,
                                GError               **error)
{
  gboolean success = TRUE;
  gdouble size;

  size = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        g_object_set (list->data,
                      "brush-size", (gdouble) size,
                       NULL);

      g_list_free (options);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_set_brush_default_size_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  gboolean success = TRUE;
  PikaBrush *brush = pika_context_get_brush (context);

  if (brush)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        pika_paint_options_set_default_brush_size (list->data, brush);

      g_list_free (options);
    }
  else
    {
      success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_brush_aspect_ratio_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble aspect = 0.0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "brush-aspect-ratio", &aspect,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), aspect);

  return return_vals;
}

static PikaValueArray *
context_set_brush_aspect_ratio_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  gboolean success = TRUE;
  gdouble aspect;

  aspect = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        g_object_set (list->data,
                      "brush-aspect-ratio", (gdouble) aspect,
                       NULL);

      g_list_free (options);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_brush_angle_invoker (PikaProcedure         *procedure,
                                 Pika                  *pika,
                                 PikaContext           *context,
                                 PikaProgress          *progress,
                                 const PikaValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble angle = 0.0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "brush-angle", &angle,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), angle);

  return return_vals;
}

static PikaValueArray *
context_set_brush_angle_invoker (PikaProcedure         *procedure,
                                 Pika                  *pika,
                                 PikaContext           *context,
                                 PikaProgress          *progress,
                                 const PikaValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  gdouble angle;

  angle = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        g_object_set (list->data,
                      "brush-angle", (gdouble) angle,
                       NULL);

      g_list_free (options);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_brush_spacing_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble spacing = 0.0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "brush-spacing", &spacing,
                   NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), spacing);

  return return_vals;
}

static PikaValueArray *
context_set_brush_spacing_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  gdouble spacing;

  spacing = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        g_object_set (list->data,
                      "brush-spacing", (gdouble) spacing,
                       NULL);

      g_list_free (options);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_set_brush_default_spacing_invoker (PikaProcedure         *procedure,
                                           Pika                  *pika,
                                           PikaContext           *context,
                                           PikaProgress          *progress,
                                           const PikaValueArray  *args,
                                           GError               **error)
{
  gboolean success = TRUE;
  PikaBrush *brush = pika_context_get_brush (context);

  if (brush)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        pika_paint_options_set_default_brush_spacing (list->data, brush);

      g_list_free (options);
    }
  else
    {
      success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_brush_hardness_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble hardness = 0.0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "brush-hardness", &hardness,
                   NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), hardness);

  return return_vals;
}

static PikaValueArray *
context_set_brush_hardness_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  gdouble hardness;

  hardness = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        g_object_set (list->data,
                      "brush-hardness", (gdouble) hardness,
                       NULL);

      g_list_free (options);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_set_brush_default_hardness_invoker (PikaProcedure         *procedure,
                                            Pika                  *pika,
                                            PikaContext           *context,
                                            PikaProgress          *progress,
                                            const PikaValueArray  *args,
                                            GError               **error)
{
  gboolean success = TRUE;
  PikaBrush *brush = pika_context_get_brush (context);

  if (brush)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        pika_paint_options_set_default_brush_hardness (list->data, brush);

      g_list_free (options);
    }
  else
    {
      success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_brush_force_invoker (PikaProcedure         *procedure,
                                 Pika                  *pika,
                                 PikaContext           *context,
                                 PikaProgress          *progress,
                                 const PikaValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble force = 0.0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "brush-force", &force,
                   NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), force);

  return return_vals;
}

static PikaValueArray *
context_set_brush_force_invoker (PikaProcedure         *procedure,
                                 Pika                  *pika,
                                 PikaContext           *context,
                                 PikaProgress          *progress,
                                 const PikaValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  gdouble force;

  force = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      GList *options;
      GList *list;

      options = pika_pdb_context_get_brush_options (PIKA_PDB_CONTEXT (context));

      for (list = options; list; list = g_list_next (list))
        g_object_set (list->data,
                      "brush-force", (gdouble) force,
                       NULL);

      g_list_free (options);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_dynamics_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gchar *name = NULL;

  PikaDynamics *dynamics = pika_context_get_dynamics (context);

  if (dynamics)
    name = g_strdup (pika_object_get_name (dynamics));
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_take_string (pika_value_array_index (return_vals, 1), name);

  return return_vals;
}

static PikaValueArray *
context_set_dynamics_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  gboolean success = TRUE;
  const gchar *name;

  name = g_value_get_string (pika_value_array_index (args, 0));

  if (success)
    {
      PikaDynamics *dynamics = PIKA_DYNAMICS (pika_pdb_get_resource (pika, PIKA_TYPE_DYNAMICS, name, PIKA_PDB_DATA_ACCESS_READ, error));

      if (dynamics)
        pika_context_set_dynamics (context, dynamics);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_are_dynamics_enabled_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gboolean enabled = FALSE;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    enabled = pika_paint_options_are_dynamics_enabled (options);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_boolean (pika_value_array_index (return_vals, 1), enabled);

  return return_vals;
}

static PikaValueArray *
context_enable_dynamics_invoker (PikaProcedure         *procedure,
                                 Pika                  *pika,
                                 PikaContext           *context,
                                 PikaProgress          *progress,
                                 const PikaValueArray  *args,
                                 GError               **error)
{
  gboolean success = TRUE;
  gboolean enable;

  enable = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-paintbrush");

      if (options)
        pika_paint_options_enable_dynamics (options, enable);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_mypaint_brush_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gchar *name = NULL;

  PikaMybrush *brush = pika_context_get_mybrush (context);

  if (brush)
    name = g_strdup (pika_object_get_name (brush));
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_take_string (pika_value_array_index (return_vals, 1), name);

  return return_vals;
}

static PikaValueArray *
context_set_mypaint_brush_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  const gchar *name;

  name = g_value_get_string (pika_value_array_index (args, 0));

  if (success)
    {
      PikaMybrush *brush = PIKA_MYBRUSH (pika_pdb_get_resource (pika, PIKA_TYPE_MYBRUSH, name,
                                                                PIKA_PDB_DATA_ACCESS_READ, error));

      if (brush)
        pika_context_set_mybrush (context, brush);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_pattern_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaPattern *pattern = NULL;

  pattern = pika_context_get_pattern (context);

  if (!pattern)
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_object (pika_value_array_index (return_vals, 1), pattern);

  return return_vals;
}

static PikaValueArray *
context_set_pattern_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  PikaPattern *pattern;

  pattern = g_value_get_object (pika_value_array_index (args, 0));

  pika_context_set_pattern (context, pattern);


  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_get_gradient_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaGradient *gradient = NULL;

  gradient = pika_context_get_gradient (context);

  if (!gradient)
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_object (pika_value_array_index (return_vals, 1), gradient);

  return return_vals;
}

static PikaValueArray *
context_set_gradient_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  PikaGradient *gradient;

  gradient = g_value_get_object (pika_value_array_index (args, 0));

  pika_context_set_gradient (context, gradient);


  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_set_gradient_fg_bg_rgb_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  pika_context_set_gradient (context,
                             pika_gradients_get_fg_bg_rgb (pika));

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_set_gradient_fg_bg_hsv_cw_invoker (PikaProcedure         *procedure,
                                           Pika                  *pika,
                                           PikaContext           *context,
                                           PikaProgress          *progress,
                                           const PikaValueArray  *args,
                                           GError               **error)
{
  pika_context_set_gradient (context,
                             pika_gradients_get_fg_bg_hsv_cw (pika));

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_set_gradient_fg_bg_hsv_ccw_invoker (PikaProcedure         *procedure,
                                            Pika                  *pika,
                                            PikaContext           *context,
                                            PikaProgress          *progress,
                                            const PikaValueArray  *args,
                                            GError               **error)
{
  pika_context_set_gradient (context,
                             pika_gradients_get_fg_bg_hsv_ccw (pika));

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_set_gradient_fg_transparent_invoker (PikaProcedure         *procedure,
                                             Pika                  *pika,
                                             PikaContext           *context,
                                             PikaProgress          *progress,
                                             const PikaValueArray  *args,
                                             GError               **error)
{
  pika_context_set_gradient (context,
                             pika_gradients_get_fg_transparent (pika));

  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_get_gradient_blend_color_space_invoker (PikaProcedure         *procedure,
                                                Pika                  *pika,
                                                PikaContext           *context,
                                                PikaProgress          *progress,
                                                const PikaValueArray  *args,
                                                GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gint blend_color_space = 0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "gradient-blend-color-space", &blend_color_space,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_enum (pika_value_array_index (return_vals, 1), blend_color_space);

  return return_vals;
}

static PikaValueArray *
context_set_gradient_blend_color_space_invoker (PikaProcedure         *procedure,
                                                Pika                  *pika,
                                                PikaContext           *context,
                                                PikaProgress          *progress,
                                                const PikaValueArray  *args,
                                                GError               **error)
{
  gboolean success = TRUE;
  gint blend_color_space;

  blend_color_space = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      PikaContainer *options;
      GList         *list;

      options = pika_pdb_context_get_paint_options_list (PIKA_PDB_CONTEXT (context));

      for (list = PIKA_LIST (options)->queue->head; list; list = g_list_next (list))
        g_object_set (list->data,
                      "gradient-blend-color-space", blend_color_space,
                       NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_gradient_repeat_mode_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gint repeat_mode = 0;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "gradient-repeat", &repeat_mode,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_enum (pika_value_array_index (return_vals, 1), repeat_mode);

  return return_vals;
}

static PikaValueArray *
context_set_gradient_repeat_mode_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  gint repeat_mode;

  repeat_mode = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      PikaContainer *options;
      GList         *list;

      options = pika_pdb_context_get_paint_options_list (PIKA_PDB_CONTEXT (context));

      for (list = PIKA_LIST (options)->queue->head; list; list = g_list_next (list))
        g_object_set (list->data,
                      "gradient-repeat", repeat_mode,
                       NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_gradient_reverse_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gboolean reverse = FALSE;

  /* all options should have the same value, so pick a random one */
  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-paintbrush");

  if (options)
    g_object_get (options,
                  "gradient-reverse", &reverse,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_boolean (pika_value_array_index (return_vals, 1), reverse);

  return return_vals;
}

static PikaValueArray *
context_set_gradient_reverse_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  gboolean reverse;

  reverse = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      PikaContainer *options;
      GList         *list;

      options = pika_pdb_context_get_paint_options_list (PIKA_PDB_CONTEXT (context));

      for (list = PIKA_LIST (options)->queue->head; list; list = g_list_next (list))
        g_object_set (list->data,
                      "gradient-reverse", reverse,
                       NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_palette_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaPalette *palette = NULL;

  palette = pika_context_get_palette (context);

  if (!palette)
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_object (pika_value_array_index (return_vals, 1), palette);

  return return_vals;
}

static PikaValueArray *
context_set_palette_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  PikaPalette *palette;

  palette = g_value_get_object (pika_value_array_index (args, 0));

  pika_context_set_palette (context, palette);


  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_get_font_invoker (PikaProcedure         *procedure,
                          Pika                  *pika,
                          PikaContext           *context,
                          PikaProgress          *progress,
                          const PikaValueArray  *args,
                          GError               **error)
{
  PikaValueArray *return_vals;
  PikaFont *font = NULL;

  font = pika_context_get_font (context);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_object (pika_value_array_index (return_vals, 1), font);

  return return_vals;
}

static PikaValueArray *
context_set_font_invoker (PikaProcedure         *procedure,
                          Pika                  *pika,
                          PikaContext           *context,
                          PikaProgress          *progress,
                          const PikaValueArray  *args,
                          GError               **error)
{
  PikaFont *font;

  font = g_value_get_object (pika_value_array_index (args, 0));

  pika_context_set_font (context, font);


  return pika_procedure_get_return_values (procedure, TRUE, NULL);
}

static PikaValueArray *
context_get_antialias_invoker (PikaProcedure         *procedure,
                               Pika                  *pika,
                               PikaContext           *context,
                               PikaProgress          *progress,
                               const PikaValueArray  *args,
                               GError               **error)
{
  PikaValueArray *return_vals;
  gboolean antialias = FALSE;

  g_object_get (context,
                "antialias", &antialias,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_boolean (pika_value_array_index (return_vals, 1), antialias);

  return return_vals;
}

static PikaValueArray *
context_set_antialias_invoker (PikaProcedure         *procedure,
                               Pika                  *pika,
                               PikaContext           *context,
                               PikaProgress          *progress,
                               const PikaValueArray  *args,
                               GError               **error)
{
  gboolean success = TRUE;
  gboolean antialias;

  antialias = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "antialias", antialias,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_feather_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  PikaValueArray *return_vals;
  gboolean feather = FALSE;

  g_object_get (context,
                "feather", &feather,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_boolean (pika_value_array_index (return_vals, 1), feather);

  return return_vals;
}

static PikaValueArray *
context_set_feather_invoker (PikaProcedure         *procedure,
                             Pika                  *pika,
                             PikaContext           *context,
                             PikaProgress          *progress,
                             const PikaValueArray  *args,
                             GError               **error)
{
  gboolean success = TRUE;
  gboolean feather;

  feather = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "feather", feather,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_feather_radius_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  PikaValueArray *return_vals;
  gdouble feather_radius_x = 0.0;
  gdouble feather_radius_y = 0.0;

  g_object_get (context,
                "feather-radius-x", &feather_radius_x,
                "feather-radius-y", &feather_radius_y,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);

  g_value_set_double (pika_value_array_index (return_vals, 1), feather_radius_x);
  g_value_set_double (pika_value_array_index (return_vals, 2), feather_radius_y);

  return return_vals;
}

static PikaValueArray *
context_set_feather_radius_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  gdouble feather_radius_x;
  gdouble feather_radius_y;

  feather_radius_x = g_value_get_double (pika_value_array_index (args, 0));
  feather_radius_y = g_value_get_double (pika_value_array_index (args, 1));

  if (success)
    {
      g_object_set (context,
                    "feather-radius-x", feather_radius_x,
                    "feather-radius-y", feather_radius_y,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_sample_merged_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  PikaValueArray *return_vals;
  gboolean sample_merged = FALSE;

  g_object_get (context,
                "sample-merged", &sample_merged,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_boolean (pika_value_array_index (return_vals, 1), sample_merged);

  return return_vals;
}

static PikaValueArray *
context_set_sample_merged_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  gboolean sample_merged;

  sample_merged = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "sample-merged", sample_merged,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_sample_criterion_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  PikaValueArray *return_vals;
  gint sample_criterion = 0;

  g_object_get (context,
                "sample-criterion", &sample_criterion,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), sample_criterion);

  return return_vals;
}

static PikaValueArray *
context_set_sample_criterion_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  gint sample_criterion;

  sample_criterion = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "sample-criterion", sample_criterion,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_sample_threshold_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  PikaValueArray *return_vals;
  gdouble sample_threshold = 0.0;

  g_object_get (context,
                "sample-threshold", &sample_threshold,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_double (pika_value_array_index (return_vals, 1), sample_threshold);

  return return_vals;
}

static PikaValueArray *
context_set_sample_threshold_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  gdouble sample_threshold;

  sample_threshold = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "sample-threshold", sample_threshold,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_sample_threshold_int_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  PikaValueArray *return_vals;
  gint sample_threshold = 0;

  gdouble threshold;

  g_object_get (context,
                "sample-threshold", &threshold,
                NULL);

  sample_threshold = (gint) (threshold * 255.99);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_int (pika_value_array_index (return_vals, 1), sample_threshold);

  return return_vals;
}

static PikaValueArray *
context_set_sample_threshold_int_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  gint sample_threshold;

  sample_threshold = g_value_get_int (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "sample-threshold", (gdouble) sample_threshold / 255.0,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_sample_transparent_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  PikaValueArray *return_vals;
  gboolean sample_transparent = FALSE;

  g_object_get (context,
                "sample-transparent", &sample_transparent,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_boolean (pika_value_array_index (return_vals, 1), sample_transparent);

  return return_vals;
}

static PikaValueArray *
context_set_sample_transparent_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  gboolean success = TRUE;
  gboolean sample_transparent;

  sample_transparent = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "sample-transparent", sample_transparent,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_diagonal_neighbors_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  PikaValueArray *return_vals;
  gboolean diagonal_neighbors = FALSE;

  g_object_get (context,
                "diagonal-neighbors", &diagonal_neighbors,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_boolean (pika_value_array_index (return_vals, 1), diagonal_neighbors);

  return return_vals;
}

static PikaValueArray *
context_set_diagonal_neighbors_invoker (PikaProcedure         *procedure,
                                        Pika                  *pika,
                                        PikaContext           *context,
                                        PikaProgress          *progress,
                                        const PikaValueArray  *args,
                                        GError               **error)
{
  gboolean success = TRUE;
  gboolean diagonal_neighbors;

  diagonal_neighbors = g_value_get_boolean (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "diagonal-neighbors", diagonal_neighbors,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_distance_metric_invoker (PikaProcedure         *procedure,
                                     Pika                  *pika,
                                     PikaContext           *context,
                                     PikaProgress          *progress,
                                     const PikaValueArray  *args,
                                     GError               **error)
{
  PikaValueArray *return_vals;
  gint metric = 0;

  g_object_get (context,
                "distance-metric", &metric,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), metric);

  return return_vals;
}

static PikaValueArray *
context_set_distance_metric_invoker (PikaProcedure         *procedure,
                                     Pika                  *pika,
                                     PikaContext           *context,
                                     PikaProgress          *progress,
                                     const PikaValueArray  *args,
                                     GError               **error)
{
  gboolean success = TRUE;
  gint metric;

  metric = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "distance-metric", metric,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_interpolation_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  PikaValueArray *return_vals;
  gint interpolation = 0;

  g_object_get (context,
                "interpolation", &interpolation,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), interpolation);

  return return_vals;
}

static PikaValueArray *
context_set_interpolation_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  gint interpolation;

  interpolation = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "interpolation", interpolation,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_transform_direction_invoker (PikaProcedure         *procedure,
                                         Pika                  *pika,
                                         PikaContext           *context,
                                         PikaProgress          *progress,
                                         const PikaValueArray  *args,
                                         GError               **error)
{
  PikaValueArray *return_vals;
  gint transform_direction = 0;

  g_object_get (context,
                "transform-direction", &transform_direction,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), transform_direction);

  return return_vals;
}

static PikaValueArray *
context_set_transform_direction_invoker (PikaProcedure         *procedure,
                                         Pika                  *pika,
                                         PikaContext           *context,
                                         PikaProgress          *progress,
                                         const PikaValueArray  *args,
                                         GError               **error)
{
  gboolean success = TRUE;
  gint transform_direction;

  transform_direction = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "transform-direction", transform_direction,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_transform_resize_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  PikaValueArray *return_vals;
  gint transform_resize = 0;

  g_object_get (context,
                "transform-resize", &transform_resize,
                NULL);

  return_vals = pika_procedure_get_return_values (procedure, TRUE, NULL);
  g_value_set_enum (pika_value_array_index (return_vals, 1), transform_resize);

  return return_vals;
}

static PikaValueArray *
context_set_transform_resize_invoker (PikaProcedure         *procedure,
                                      Pika                  *pika,
                                      PikaContext           *context,
                                      PikaProgress          *progress,
                                      const PikaValueArray  *args,
                                      GError               **error)
{
  gboolean success = TRUE;
  gint transform_resize;

  transform_resize = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      g_object_set (context,
                    "transform-resize", transform_resize,
                    NULL);
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_size_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble size = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "size", &size,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), size);

  return return_vals;
}

static PikaValueArray *
context_set_ink_size_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  gboolean success = TRUE;
  gdouble size;

  size = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "size", size,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_angle_invoker (PikaProcedure         *procedure,
                               Pika                  *pika,
                               PikaContext           *context,
                               PikaProgress          *progress,
                               const PikaValueArray  *args,
                               GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble angle = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "tilt-angle", &angle,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), angle);

  return return_vals;
}

static PikaValueArray *
context_set_ink_angle_invoker (PikaProcedure         *procedure,
                               Pika                  *pika,
                               PikaContext           *context,
                               PikaProgress          *progress,
                               const PikaValueArray  *args,
                               GError               **error)
{
  gboolean success = TRUE;
  gdouble angle;

  angle = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "tilt-angle", angle,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_size_sensitivity_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble size = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "size-sensitivity", &size,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), size);

  return return_vals;
}

static PikaValueArray *
context_set_ink_size_sensitivity_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  gdouble size;

  size = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "size-sensitivity", size,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_tilt_sensitivity_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble tilt = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "tilt-sensitivity", &tilt,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), tilt);

  return return_vals;
}

static PikaValueArray *
context_set_ink_tilt_sensitivity_invoker (PikaProcedure         *procedure,
                                          Pika                  *pika,
                                          PikaContext           *context,
                                          PikaProgress          *progress,
                                          const PikaValueArray  *args,
                                          GError               **error)
{
  gboolean success = TRUE;
  gdouble tilt;

  tilt = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "tilt-sensitivity", tilt,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_speed_sensitivity_invoker (PikaProcedure         *procedure,
                                           Pika                  *pika,
                                           PikaContext           *context,
                                           PikaProgress          *progress,
                                           const PikaValueArray  *args,
                                           GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble speed = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "vel-sensitivity", &speed,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), speed);

  return return_vals;
}

static PikaValueArray *
context_set_ink_speed_sensitivity_invoker (PikaProcedure         *procedure,
                                           Pika                  *pika,
                                           PikaContext           *context,
                                           PikaProgress          *progress,
                                           const PikaValueArray  *args,
                                           GError               **error)
{
  gboolean success = TRUE;
  gdouble speed;

  speed = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "vel-sensitivity", speed,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_blob_type_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gint type = 0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "blob-type", &type,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_enum (pika_value_array_index (return_vals, 1), type);

  return return_vals;
}

static PikaValueArray *
context_set_ink_blob_type_invoker (PikaProcedure         *procedure,
                                   Pika                  *pika,
                                   PikaContext           *context,
                                   PikaProgress          *progress,
                                   const PikaValueArray  *args,
                                   GError               **error)
{
  gboolean success = TRUE;
  gint type;

  type = g_value_get_enum (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "blob-type", type,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_blob_aspect_ratio_invoker (PikaProcedure         *procedure,
                                           Pika                  *pika,
                                           PikaContext           *context,
                                           PikaProgress          *progress,
                                           const PikaValueArray  *args,
                                           GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble aspect = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    g_object_get (options,
                  "blob-aspect", &aspect,
                  NULL);
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), aspect);

  return return_vals;
}

static PikaValueArray *
context_set_ink_blob_aspect_ratio_invoker (PikaProcedure         *procedure,
                                           Pika                  *pika,
                                           PikaContext           *context,
                                           PikaProgress          *progress,
                                           const PikaValueArray  *args,
                                           GError               **error)
{
  gboolean success = TRUE;
  gdouble aspect;

  aspect = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "blob-aspect", aspect,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_ink_blob_angle_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  gdouble angle = 0.0;

  PikaPaintOptions *options =
    pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                        "pika-ink");

  if (options)
    {
      g_object_get (options,
                    "blob-angle", &angle,
                    NULL);
      angle *= (180-0 / G_PI);
    }
  else
    success = FALSE;

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_double (pika_value_array_index (return_vals, 1), angle);

  return return_vals;
}

static PikaValueArray *
context_set_ink_blob_angle_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  gdouble angle;

  angle = g_value_get_double (pika_value_array_index (args, 0));

  if (success)
    {
      PikaPaintOptions *options =
        pika_pdb_context_get_paint_options (PIKA_PDB_CONTEXT (context),
                                            "pika-ink");

      if (options)
        g_object_set (options,
                      "blob-angle", (gdouble) angle * G_PI / 180.0,
                      NULL);
      else
        success = FALSE;
    }

  return pika_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}

static PikaValueArray *
context_get_resource_invoker (PikaProcedure         *procedure,
                              Pika                  *pika,
                              PikaContext           *context,
                              PikaProgress          *progress,
                              const PikaValueArray  *args,
                              GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  const gchar *type_name;
  PikaResource *resource = NULL;

  type_name = g_value_get_string (pika_value_array_index (args, 0));

  if (success)
    {
      GType type = g_type_from_name (type_name);

      if (g_type_is_a (type, PIKA_TYPE_RESOURCE))
        {
          if (type == PIKA_TYPE_BRUSH)
            resource = PIKA_RESOURCE (pika_context_get_brush (context));
          else if (type == PIKA_TYPE_FONT)
            resource = PIKA_RESOURCE (pika_context_get_font (context));
          else if (type == PIKA_TYPE_GRADIENT)
            resource = PIKA_RESOURCE (pika_context_get_gradient (context));
          else if (type == PIKA_TYPE_PATTERN)
            resource = PIKA_RESOURCE (pika_context_get_pattern (context));
          else if (type == PIKA_TYPE_PALETTE)
            resource = PIKA_RESOURCE (pika_context_get_palette (context));
          else
            /* Should not be reached. */
            success = FALSE;
        }
      else
        {
          success = FALSE;
        }
    }

  return_vals = pika_procedure_get_return_values (procedure, success,
                                                  error ? *error : NULL);

  if (success)
    g_value_set_object (pika_value_array_index (return_vals, 1), resource);

  return return_vals;
}

void
register_context_procs (PikaPDB *pdb)
{
  PikaProcedure *procedure;

  /*
   * pika-context-push
   */
  procedure = pika_procedure_new (context_push_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-push");
  pika_procedure_set_static_help (procedure,
                                  "Pushes a context onto the top of the plug-in's context stack.",
                                  "Creates a new context by copying the current context. The copy becomes the new current context for the calling plug-in until it is popped again using 'pika-context-pop'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-pop
   */
  procedure = pika_procedure_new (context_pop_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-pop");
  pika_procedure_set_static_help (procedure,
                                  "Pops the topmost context from the plug-in's context stack.",
                                  "Removes the topmost context from the plug-in's context stack. The next context on the stack becomes the new current context of the plug-in, that is, the context that was active before the corresponding call to 'pika-context-push'",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-defaults
   */
  procedure = pika_procedure_new (context_set_defaults_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-defaults");
  pika_procedure_set_static_help (procedure,
                                  "Reset context settings to their default values.",
                                  "Resets context settings used by various procedures to their default value. You should usually call this after a context push so that a script which calls procedures affected by context settings will not be affected by changes in the global context.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Kevin Cozens <kcozens@svn.gnome.org>",
                                         "Kevin Cozens",
                                         "2011");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-list-paint-methods
   */
  procedure = pika_procedure_new (context_list_paint_methods_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-list-paint-methods");
  pika_procedure_set_static_help (procedure,
                                  "Lists the available paint methods.",
                                  "Lists the names of the available paint methods. Any of the names can be used for 'pika-context-set-paint-method'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Simon Budig",
                                         "Simon Budig",
                                         "2007");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boxed ("paint-methods",
                                                       "paint methods",
                                                       "The names of the available paint methods",
                                                       G_TYPE_STRV,
                                                       PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-paint-method
   */
  procedure = pika_procedure_new (context_get_paint_method_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-paint-method");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active paint method.",
                                  "Returns the name of the currently active paint method.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2005");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_string ("name",
                                                           "name",
                                                           "The name of the active paint method",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-paint-method
   */
  procedure = pika_procedure_new (context_set_paint_method_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-paint-method");
  pika_procedure_set_static_help (procedure,
                                  "Set the active paint method.",
                                  "Sets the active paint method to the named paint method. The paint method will be used in all subsequent paint operations. The name should be a name of an available paint method. Returns an error if no matching paint method is found.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2005");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_string ("name",
                                                       "name",
                                                       "The name of the paint method",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-stroke-method
   */
  procedure = pika_procedure_new (context_get_stroke_method_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-stroke-method");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active stroke method.",
                                  "Returns the currently active stroke method.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("stroke-method",
                                                      "stroke method",
                                                      "The active stroke method",
                                                      PIKA_TYPE_STROKE_METHOD,
                                                      PIKA_STROKE_LINE,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-stroke-method
   */
  procedure = pika_procedure_new (context_set_stroke_method_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-stroke-method");
  pika_procedure_set_static_help (procedure,
                                  "Set the active stroke method.",
                                  "Sets the active stroke method. The method will be used in all subsequent stroke operations.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("stroke-method",
                                                  "stroke method",
                                                  "The new stroke method",
                                                  PIKA_TYPE_STROKE_METHOD,
                                                  PIKA_STROKE_LINE,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-foreground
   */
  procedure = pika_procedure_new (context_get_foreground_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-foreground");
  pika_procedure_set_static_help (procedure,
                                  "Get the current PIKA foreground color.",
                                  "Returns the current PIKA foreground color. The foreground color is used in a variety of tools such as paint tools, blending, and bucket fill.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_rgb ("foreground",
                                                        "foreground",
                                                        "The foreground color",
                                                        FALSE,
                                                        NULL,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-foreground
   */
  procedure = pika_procedure_new (context_set_foreground_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-foreground");
  pika_procedure_set_static_help (procedure,
                                  "Set the current PIKA foreground color.",
                                  "Sets the current PIKA foreground color. After this is set, operations which use foreground such as paint tools, blending, and bucket fill will use the new value.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_rgb ("foreground",
                                                    "foreground",
                                                    "The foreground color",
                                                    FALSE,
                                                    NULL,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-background
   */
  procedure = pika_procedure_new (context_get_background_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-background");
  pika_procedure_set_static_help (procedure,
                                  "Get the current PIKA background color.",
                                  "Returns the current PIKA background color. The background color is used in a variety of tools such as blending, erasing (with non-alpha images), and image filling.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_rgb ("background",
                                                        "background",
                                                        "The background color",
                                                        FALSE,
                                                        NULL,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-background
   */
  procedure = pika_procedure_new (context_set_background_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-background");
  pika_procedure_set_static_help (procedure,
                                  "Set the current PIKA background color.",
                                  "Sets the current PIKA background color. After this is set, operations which use background such as blending, filling images, clearing, and erasing (in non-alpha images) will use the new value.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_rgb ("background",
                                                    "background",
                                                    "The background color",
                                                    FALSE,
                                                    NULL,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-default-colors
   */
  procedure = pika_procedure_new (context_set_default_colors_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-default-colors");
  pika_procedure_set_static_help (procedure,
                                  "Set the current PIKA foreground and background colors to black and white.",
                                  "Sets the current PIKA foreground and background colors to their initial default values, black and white.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-swap-colors
   */
  procedure = pika_procedure_new (context_swap_colors_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-swap-colors");
  pika_procedure_set_static_help (procedure,
                                  "Swap the current PIKA foreground and background colors.",
                                  "Swaps the current PIKA foreground and background colors, so that the new foreground color becomes the old background color and vice versa.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-opacity
   */
  procedure = pika_procedure_new (context_get_opacity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-opacity");
  pika_procedure_set_static_help (procedure,
                                  "Get the opacity.",
                                  "Returns the opacity setting. The return value is a floating point number between 0 and 100.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("opacity",
                                                        "opacity",
                                                        "The opacity",
                                                        0, 100, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-opacity
   */
  procedure = pika_procedure_new (context_set_opacity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-opacity");
  pika_procedure_set_static_help (procedure,
                                  "Set the opacity.",
                                  "Modifies the opacity setting. The value should be a floating point number between 0 and 100.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("opacity",
                                                    "opacity",
                                                    "The opacity",
                                                    0, 100, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-paint-mode
   */
  procedure = pika_procedure_new (context_get_paint_mode_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-paint-mode");
  pika_procedure_set_static_help (procedure,
                                  "Get the paint mode.",
                                  "Returns the paint-mode setting. The return value is an integer which corresponds to the values listed in the argument description.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("paint-mode",
                                                      "paint mode",
                                                      "The paint mode",
                                                      PIKA_TYPE_LAYER_MODE,
                                                      PIKA_LAYER_MODE_NORMAL,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-paint-mode
   */
  procedure = pika_procedure_new (context_set_paint_mode_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-paint-mode");
  pika_procedure_set_static_help (procedure,
                                  "Set the paint mode.",
                                  "Modifies the paint_mode setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("paint-mode",
                                                  "paint mode",
                                                  "The paint mode",
                                                  PIKA_TYPE_LAYER_MODE,
                                                  PIKA_LAYER_MODE_NORMAL,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-width
   */
  procedure = pika_procedure_new (context_get_line_width_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-width");
  pika_procedure_set_static_help (procedure,
                                  "Get the line width setting.",
                                  "Returns the line width setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("line-width",
                                                        "line width",
                                                        "The line width setting",
                                                        0.0, 2000.0, 0.0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-width
   */
  procedure = pika_procedure_new (context_set_line_width_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-width");
  pika_procedure_set_static_help (procedure,
                                  "Set the line width setting.",
                                  "Modifies the line width setting for stroking lines.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("line-width",
                                                    "line width",
                                                    "The line width setting",
                                                    0.0, 2000.0, 0.0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-width-unit
   */
  procedure = pika_procedure_new (context_get_line_width_unit_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-width-unit");
  pika_procedure_set_static_help (procedure,
                                  "Get the line width unit setting.",
                                  "Returns the line width unit setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_unit ("line-width-unit",
                                                         "line width unit",
                                                         "The line width unit setting",
                                                         TRUE,
                                                         FALSE,
                                                         PIKA_UNIT_PIXEL,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-width-unit
   */
  procedure = pika_procedure_new (context_set_line_width_unit_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-width-unit");
  pika_procedure_set_static_help (procedure,
                                  "Set the line width unit setting.",
                                  "Modifies the line width unit setting for stroking lines.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_unit ("line-width-unit",
                                                     "line width unit",
                                                     "The line width setting unit",
                                                     TRUE,
                                                     FALSE,
                                                     PIKA_UNIT_PIXEL,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-cap-style
   */
  procedure = pika_procedure_new (context_get_line_cap_style_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-cap-style");
  pika_procedure_set_static_help (procedure,
                                  "Get the line cap style setting.",
                                  "Returns the line cap style setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("cap-style",
                                                      "cap style",
                                                      "The line cap style setting",
                                                      PIKA_TYPE_CAP_STYLE,
                                                      PIKA_CAP_BUTT,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-cap-style
   */
  procedure = pika_procedure_new (context_set_line_cap_style_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-cap-style");
  pika_procedure_set_static_help (procedure,
                                  "Set the line cap style setting.",
                                  "Modifies the line cap style setting for stroking lines.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("cap-style",
                                                  "cap style",
                                                  "The line cap style setting",
                                                  PIKA_TYPE_CAP_STYLE,
                                                  PIKA_CAP_BUTT,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-join-style
   */
  procedure = pika_procedure_new (context_get_line_join_style_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-join-style");
  pika_procedure_set_static_help (procedure,
                                  "Get the line join style setting.",
                                  "Returns the line join style setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("join-style",
                                                      "join style",
                                                      "The line join style setting",
                                                      PIKA_TYPE_JOIN_STYLE,
                                                      PIKA_JOIN_MITER,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-join-style
   */
  procedure = pika_procedure_new (context_set_line_join_style_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-join-style");
  pika_procedure_set_static_help (procedure,
                                  "Set the line join style setting.",
                                  "Modifies the line join style setting for stroking lines.\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("join-style",
                                                  "join style",
                                                  "The line join style setting",
                                                  PIKA_TYPE_JOIN_STYLE,
                                                  PIKA_JOIN_MITER,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-miter-limit
   */
  procedure = pika_procedure_new (context_get_line_miter_limit_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-miter-limit");
  pika_procedure_set_static_help (procedure,
                                  "Get the line miter limit setting.",
                                  "Returns the line miter limit setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("miter-limit",
                                                        "miter limit",
                                                        "The line miter limit setting",
                                                        0.0, 100.0, 0.0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-miter-limit
   */
  procedure = pika_procedure_new (context_set_line_miter_limit_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-miter-limit");
  pika_procedure_set_static_help (procedure,
                                  "Set the line miter limit setting.",
                                  "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"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("miter-limit",
                                                    "miter limit",
                                                    "The line miter limit setting",
                                                    0.0, 100.0, 0.0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-dash-offset
   */
  procedure = pika_procedure_new (context_get_line_dash_offset_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-dash-offset");
  pika_procedure_set_static_help (procedure,
                                  "Get the line dash offset setting.",
                                  "Returns the line dash offset setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("dash-offset",
                                                        "dash offset",
                                                        "The line dash offset setting",
                                                        0.0, 2000.0, 0.0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-dash-offset
   */
  procedure = pika_procedure_new (context_set_line_dash_offset_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-dash-offset");
  pika_procedure_set_static_help (procedure,
                                  "Set the line dash offset setting.",
                                  "Modifies the line dash offset setting for stroking lines.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("dash-offset",
                                                    "dash offset",
                                                    "The line dash offset setting",
                                                    0.0, 100.0, 0.0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-line-dash-pattern
   */
  procedure = pika_procedure_new (context_get_line_dash_pattern_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-line-dash-pattern");
  pika_procedure_set_static_help (procedure,
                                  "Get the line dash pattern setting.",
                                  "Returns the line dash pattern setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_int ("num-dashes",
                                                     "num dashes",
                                                     "The number of dashes in the dash_pattern array",
                                                     0, G_MAXINT32, 0,
                                                     PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_float_array ("dashes",
                                                                "dashes",
                                                                "The line dash pattern setting",
                                                                PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-line-dash-pattern
   */
  procedure = pika_procedure_new (context_set_line_dash_pattern_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-line-dash-pattern");
  pika_procedure_set_static_help (procedure,
                                  "Set the line dash pattern setting.",
                                  "Modifies the line dash pattern setting for stroking lines.\n"
                                  "\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"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-stroke-selection', 'pika-drawable-edit-stroke-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2015");
  pika_procedure_add_argument (procedure,
                               g_param_spec_int ("num-dashes",
                                                 "num dashes",
                                                 "The number of dashes in the dash_pattern array",
                                                 0, G_MAXINT32, 0,
                                                 PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               pika_param_spec_float_array ("dashes",
                                                            "dashes",
                                                            "The line dash pattern setting",
                                                            PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush
   */
  procedure = pika_procedure_new (context_get_brush_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active brush.",
                                  "Returns the currently active brush. All paint and stroke operations use this brush.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_brush ("brush",
                                                          "brush",
                                                          "The active brush",
                                                          FALSE,
                                                          PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush
   */
  procedure = pika_procedure_new (context_set_brush_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush");
  pika_procedure_set_static_help (procedure,
                                  "Set the active brush.",
                                  "Sets the active brush in the current context. The brush will be used in subsequent paint and stroke operations. Returns an error when the brush data was uninstalled since the brush object was created.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_brush ("brush",
                                                      "brush",
                                                      "The brush",
                                                      FALSE,
                                                      PIKA_PARAM_READWRITE | PIKA_PARAM_NO_VALIDATE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush-size
   */
  procedure = pika_procedure_new (context_get_brush_size_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush-size");
  pika_procedure_set_static_help (procedure,
                                  "Get brush size in pixels.",
                                  "Get the brush size in pixels for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("size",
                                                        "size",
                                                        "Brush size in pixels",
                                                        0, G_MAXDOUBLE, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-size
   */
  procedure = pika_procedure_new (context_set_brush_size_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-size");
  pika_procedure_set_static_help (procedure,
                                  "Set brush size in pixels.",
                                  "Set the brush size in pixels for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("size",
                                                    "size",
                                                    "Brush size in pixels",
                                                    1, 10000, 1,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-default-size
   */
  procedure = pika_procedure_new (context_set_brush_default_size_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-default-size");
  pika_procedure_set_static_help (procedure,
                                  "Set brush size to its default.",
                                  "Set the brush size to the default (max of width and height) for paintbrush, airbrush, or pencil tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush-aspect-ratio
   */
  procedure = pika_procedure_new (context_get_brush_aspect_ratio_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush-aspect-ratio");
  pika_procedure_set_static_help (procedure,
                                  "Get brush aspect ratio.",
                                  "Set the aspect ratio for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("aspect",
                                                        "aspect",
                                                        "Aspect ratio",
                                                        -20, 20, -20,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-aspect-ratio
   */
  procedure = pika_procedure_new (context_set_brush_aspect_ratio_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-aspect-ratio");
  pika_procedure_set_static_help (procedure,
                                  "Set brush aspect ratio.",
                                  "Set the aspect ratio for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("aspect",
                                                    "aspect",
                                                    "Aspect ratio",
                                                    -20, 20, -20,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush-angle
   */
  procedure = pika_procedure_new (context_get_brush_angle_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush-angle");
  pika_procedure_set_static_help (procedure,
                                  "Get brush angle in degrees.",
                                  "Set the angle in degrees for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("angle",
                                                        "angle",
                                                        "Angle in degrees",
                                                        -180, 180, -180,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-angle
   */
  procedure = pika_procedure_new (context_set_brush_angle_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-angle");
  pika_procedure_set_static_help (procedure,
                                  "Set brush angle in degrees.",
                                  "Set the angle in degrees for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("angle",
                                                    "angle",
                                                    "Angle in degrees",
                                                    -180, 180, -180,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush-spacing
   */
  procedure = pika_procedure_new (context_get_brush_spacing_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush-spacing");
  pika_procedure_set_static_help (procedure,
                                  "Get brush spacing as percent of size.",
                                  "Get the brush spacing as percent of size for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("spacing",
                                                        "spacing",
                                                        "Brush spacing as fraction of size",
                                                        0.01, 50.0, 0.01,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-spacing
   */
  procedure = pika_procedure_new (context_set_brush_spacing_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-spacing");
  pika_procedure_set_static_help (procedure,
                                  "Set brush spacing as percent of size.",
                                  "Set the brush spacing as percent of size for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("spacing",
                                                    "spacing",
                                                    "Brush spacing as fraction of size",
                                                    0.01, 50.0, 0.01,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-default-spacing
   */
  procedure = pika_procedure_new (context_set_brush_default_spacing_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-default-spacing");
  pika_procedure_set_static_help (procedure,
                                  "Set brush spacing to its default.",
                                  "Set the brush spacing to the default for paintbrush, airbrush, or pencil tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush-hardness
   */
  procedure = pika_procedure_new (context_get_brush_hardness_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush-hardness");
  pika_procedure_set_static_help (procedure,
                                  "Get brush hardness in paint options.",
                                  "Get the brush hardness for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("hardness",
                                                        "hardness",
                                                        "Brush hardness",
                                                        0.0, 1.0, 0.0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-hardness
   */
  procedure = pika_procedure_new (context_set_brush_hardness_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-hardness");
  pika_procedure_set_static_help (procedure,
                                  "Set brush hardness.",
                                  "Set the brush hardness for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("hardness",
                                                    "hardness",
                                                    "Brush hardness",
                                                    0.0, 1.0, 0.0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-default-hardness
   */
  procedure = pika_procedure_new (context_set_brush_default_hardness_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-default-hardness");
  pika_procedure_set_static_help (procedure,
                                  "Set brush spacing to its default.",
                                  "Set the brush spacing to the default for paintbrush, airbrush, or pencil tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-brush-force
   */
  procedure = pika_procedure_new (context_get_brush_force_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-brush-force");
  pika_procedure_set_static_help (procedure,
                                  "Get brush force in paint options.",
                                  "Get the brush application force for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("force",
                                                        "force",
                                                        "Brush application force",
                                                        0.0, 1.0, 0.0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-brush-force
   */
  procedure = pika_procedure_new (context_set_brush_force_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-brush-force");
  pika_procedure_set_static_help (procedure,
                                  "Set brush application force.",
                                  "Set the brush application force for brush based paint tools.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Alexia Death",
                                         "Alexia Death",
                                         "2014");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("force",
                                                    "force",
                                                    "Brush application force",
                                                    0.0, 1.0, 0.0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-dynamics
   */
  procedure = pika_procedure_new (context_get_dynamics_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-dynamics");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active paint dynamics.",
                                  "Returns the name of the currently active paint dynamics. If enabled, all paint operations and stroke operations use this paint dynamics to control the application of paint to the image. If disabled, the dynamics will be ignored during paint actions.\n"
                                  "See 'pika-context-are-dynamics-enabled' to enquire whether dynamics are used or ignored.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_string ("name",
                                                           "name",
                                                           "The name of the active paint dynamics",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-dynamics
   */
  procedure = pika_procedure_new (context_set_dynamics_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-dynamics");
  pika_procedure_set_static_help (procedure,
                                  "Set the active paint dynamics.",
                                  "Sets the active paint dynamics. The paint dynamics will be used in all subsequent paint operations when dynamics are enabled. The name should be a name of an installed paint dynamics. Returns an error if no matching paint dynamics is found.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_string ("name",
                                                       "name",
                                                       "A name of a paint dynamics",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-are-dynamics-enabled
   */
  procedure = pika_procedure_new (context_are_dynamics_enabled_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-are-dynamics-enabled");
  pika_procedure_set_static_help (procedure,
                                  "Whether the currently active paint dynamics will be applied to painting.",
                                  "Returns whether the currently active paint dynamics (as returned by 'pika-context-get-dynamics') is enabled.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Jehan",
                                         "Jehan",
                                         "2022");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("enabled",
                                                         "enabled",
                                                         "Whether dynamics enabled or disabled",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-enable-dynamics
   */
  procedure = pika_procedure_new (context_enable_dynamics_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-enable-dynamics");
  pika_procedure_set_static_help (procedure,
                                  "Enables paint dynamics using the active paint dynamics.",
                                  "Enables the active paint dynamics to be used in all subsequent paint operations.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Jehan",
                                         "Jehan",
                                         "2022");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("enable",
                                                     "enable",
                                                     "Whether to enable or disable dynamics",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-mypaint-brush
   */
  procedure = pika_procedure_new (context_get_mypaint_brush_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-mypaint-brush");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active MyPaint brush.",
                                  "Returns the name of the currently active MyPaint brush.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2016");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_string ("name",
                                                           "name",
                                                           "The name of the active MyPaint brush",
                                                           FALSE, FALSE, FALSE,
                                                           NULL,
                                                           PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-mypaint-brush
   */
  procedure = pika_procedure_new (context_set_mypaint_brush_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-mypaint-brush");
  pika_procedure_set_static_help (procedure,
                                  "Set a MyPaint brush as the active MyPaint brush.",
                                  "Sets the active MyPaint brush to the named MyPaint brush. The brush will be used in all subsequent MyPaint paint operations. The name should be a name of an installed MyPaint brush. Returns an error if no matching MyPaint brush is found.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2016");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_string ("name",
                                                       "name",
                                                       "A name of a MyPaint brush",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-pattern
   */
  procedure = pika_procedure_new (context_get_pattern_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-pattern");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active pattern.",
                                  "Returns the active pattern in the current context. All clone and bucket-fill operations with patterns will use this pattern to control the application of paint to the image.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_pattern ("pattern",
                                                            "pattern",
                                                            "The active pattern",
                                                            FALSE,
                                                            PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-pattern
   */
  procedure = pika_procedure_new (context_set_pattern_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-pattern");
  pika_procedure_set_static_help (procedure,
                                  "Set the active pattern.",
                                  "Sets the active pattern in the current context. The pattern will be used in subsequent fill operations using a pattern. Returns an error when the pattern data was uninstalled since the pattern object was created.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_pattern ("pattern",
                                                        "pattern",
                                                        "The pattern",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE | PIKA_PARAM_NO_VALIDATE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-gradient
   */
  procedure = pika_procedure_new (context_get_gradient_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-gradient");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active gradient.",
                                  "Returns the currently active gradient.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_gradient ("gradient",
                                                             "gradient",
                                                             "The active gradient",
                                                             FALSE,
                                                             PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient
   */
  procedure = pika_procedure_new (context_set_gradient_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient");
  pika_procedure_set_static_help (procedure,
                                  "Sets the active gradient.",
                                  "Sets the active gradient in the current context. The gradient will be used in subsequent gradient operations. Returns an error when the gradient data was uninstalled since the gradient object was created.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_gradient ("gradient",
                                                         "gradient",
                                                         "The gradient",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE | PIKA_PARAM_NO_VALIDATE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-fg-bg-rgb
   */
  procedure = pika_procedure_new (context_set_gradient_fg_bg_rgb_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-fg-bg-rgb");
  pika_procedure_set_static_help (procedure,
                                  "Sets the built-in FG-BG RGB gradient as the active gradient.",
                                  "Sets the built-in FG-BG RGB gradient as the active gradient. The gradient will be used for subsequent gradient operations.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-fg-bg-hsv-cw
   */
  procedure = pika_procedure_new (context_set_gradient_fg_bg_hsv_cw_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-fg-bg-hsv-cw");
  pika_procedure_set_static_help (procedure,
                                  "Sets the built-in FG-BG HSV (cw) gradient as the active gradient.",
                                  "Sets the built-in FG-BG HSV (cw) gradient as the active gradient. The gradient will be used for subsequent gradient operations.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-fg-bg-hsv-ccw
   */
  procedure = pika_procedure_new (context_set_gradient_fg_bg_hsv_ccw_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-fg-bg-hsv-ccw");
  pika_procedure_set_static_help (procedure,
                                  "Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.",
                                  "Sets the built-in FG-BG HSV (ccw) gradient as the active gradient. The gradient will be used for subsequent gradient operations.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-fg-transparent
   */
  procedure = pika_procedure_new (context_set_gradient_fg_transparent_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-fg-transparent");
  pika_procedure_set_static_help (procedure,
                                  "Sets the built-in FG-Transparent gradient as the active gradient.",
                                  "Sets the built-in FG-Transparent gradient as the active gradient. The gradient will be used for subsequent gradient operations.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-gradient-blend-color-space
   */
  procedure = pika_procedure_new (context_get_gradient_blend_color_space_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-gradient-blend-color-space");
  pika_procedure_set_static_help (procedure,
                                  "Get the gradient blend color space.",
                                  "Get the gradient blend color space for paint tools and the gradient tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("blend-color-space",
                                                      "blend color space",
                                                      "Color blend space",
                                                      PIKA_TYPE_GRADIENT_BLEND_COLOR_SPACE,
                                                      PIKA_GRADIENT_BLEND_RGB_PERCEPTUAL,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-blend-color-space
   */
  procedure = pika_procedure_new (context_set_gradient_blend_color_space_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-blend-color-space");
  pika_procedure_set_static_help (procedure,
                                  "Set the gradient blend color space.",
                                  "Set the gradient blend color space for paint tools and the gradient tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("blend-color-space",
                                                  "blend color space",
                                                  "Blend color space",
                                                  PIKA_TYPE_GRADIENT_BLEND_COLOR_SPACE,
                                                  PIKA_GRADIENT_BLEND_RGB_PERCEPTUAL,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-gradient-repeat-mode
   */
  procedure = pika_procedure_new (context_get_gradient_repeat_mode_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-gradient-repeat-mode");
  pika_procedure_set_static_help (procedure,
                                  "Get the gradient repeat mode.",
                                  "Get the gradient repeat mode for paint tools and the gradient tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("repeat-mode",
                                                      "repeat mode",
                                                      "Repeat mode",
                                                      PIKA_TYPE_REPEAT_MODE,
                                                      PIKA_REPEAT_NONE,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-repeat-mode
   */
  procedure = pika_procedure_new (context_set_gradient_repeat_mode_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-repeat-mode");
  pika_procedure_set_static_help (procedure,
                                  "Set the gradient repeat mode.",
                                  "Set the gradient repeat mode for paint tools and the gradient tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("repeat-mode",
                                                  "repeat mode",
                                                  "Repeat mode",
                                                  PIKA_TYPE_REPEAT_MODE,
                                                  PIKA_REPEAT_NONE,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-gradient-reverse
   */
  procedure = pika_procedure_new (context_get_gradient_reverse_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-gradient-reverse");
  pika_procedure_set_static_help (procedure,
                                  "Get the gradient reverse setting.",
                                  "Get the gradient reverse setting for paint tools and the gradient tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("reverse",
                                                         "reverse",
                                                         "Reverse",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-gradient-reverse
   */
  procedure = pika_procedure_new (context_set_gradient_reverse_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-gradient-reverse");
  pika_procedure_set_static_help (procedure,
                                  "Set the gradient reverse setting.",
                                  "Set the gradient reverse setting for paint tools and the gradient tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2018");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("reverse",
                                                     "reverse",
                                                     "Reverse",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-palette
   */
  procedure = pika_procedure_new (context_get_palette_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-palette");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active palette.",
                                  "Returns the currently active palette.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_palette ("palette",
                                                            "palette",
                                                            "The active palette",
                                                            FALSE,
                                                            PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-palette
   */
  procedure = pika_procedure_new (context_set_palette_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-palette");
  pika_procedure_set_static_help (procedure,
                                  "Set the active palette.",
                                  "Sets the active palette in the current context. The palette will be used in subsequent paint operations. Returns an error when the palette data was uninstalled since the palette object was created.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_palette ("palette",
                                                        "palette",
                                                        "The palette",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE | PIKA_PARAM_NO_VALIDATE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-font
   */
  procedure = pika_procedure_new (context_get_font_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-font");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active font.",
                                  "Returns the currently active font.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_font ("font",
                                                         "font",
                                                         "The active font",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-font
   */
  procedure = pika_procedure_new (context_set_font_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-font");
  pika_procedure_set_static_help (procedure,
                                  "Set the active font.",
                                  "Sets the active font in the current context. The font will be used in subsequent text operations. Returns an error when the font data was uninstalled since the font object was created.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org> & Sven Neumann <sven@gimp.org>",
                                         "Michael Natterer & Sven Neumann",
                                         "2004");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_font ("font",
                                                     "font",
                                                     "The font",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE | PIKA_PARAM_NO_VALIDATE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-antialias
   */
  procedure = pika_procedure_new (context_get_antialias_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-antialias");
  pika_procedure_set_static_help (procedure,
                                  "Get the antialias setting.",
                                  "Returns the antialias setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("antialias",
                                                         "antialias",
                                                         "The antialias setting",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-antialias
   */
  procedure = pika_procedure_new (context_set_antialias_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-antialias");
  pika_procedure_set_static_help (procedure,
                                  "Set the antialias setting.",
                                  "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"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-color', 'pika-image-select-contiguous-color', 'pika-image-select-round-rectangle', 'pika-image-select-ellipse', 'pika-image-select-polygon', 'pika-image-select-item', 'pika-drawable-edit-bucket-fill', 'pika-drawable-edit-stroke-item', 'pika-drawable-edit-stroke-selection'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("antialias",
                                                     "antialias",
                                                     "The antialias setting",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-feather
   */
  procedure = pika_procedure_new (context_get_feather_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-feather");
  pika_procedure_set_static_help (procedure,
                                  "Get the feather setting.",
                                  "Returns the feather setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("feather",
                                                         "feather",
                                                         "The feather setting",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-feather
   */
  procedure = pika_procedure_new (context_set_feather_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-feather");
  pika_procedure_set_static_help (procedure,
                                  "Set the feather setting.",
                                  "Modifies the feather setting. If the feather option is enabled, selections will be blurred before combining. The blur is a gaussian blur; its radii can be controlled using 'pika-context-set-feather-radius'.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-color', 'pika-image-select-contiguous-color', 'pika-image-select-rectangle', 'pika-image-select-round-rectangle', 'pika-image-select-ellipse', 'pika-image-select-polygon', 'pika-image-select-item'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("feather",
                                                     "feather",
                                                     "The feather setting",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-feather-radius
   */
  procedure = pika_procedure_new (context_get_feather_radius_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-feather-radius");
  pika_procedure_set_static_help (procedure,
                                  "Get the feather radius setting.",
                                  "Returns the feather radius setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("feather-radius-x",
                                                        "feather radius x",
                                                        "The horizontal feather radius",
                                                        0, 1000, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("feather-radius-y",
                                                        "feather radius y",
                                                        "The vertical feather radius",
                                                        0, 1000, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-feather-radius
   */
  procedure = pika_procedure_new (context_set_feather_radius_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-feather-radius");
  pika_procedure_set_static_help (procedure,
                                  "Set the feather radius setting.",
                                  "Modifies the feather radius setting.\n"
                                  "\n"
                                  "This setting affects all procedures that are affected by 'pika-context-set-feather'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("feather-radius-x",
                                                    "feather radius x",
                                                    "The horizontal feather radius",
                                                    0, 1000, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("feather-radius-y",
                                                    "feather radius y",
                                                    "The vertical feather radius",
                                                    0, 1000, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-sample-merged
   */
  procedure = pika_procedure_new (context_get_sample_merged_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-sample-merged");
  pika_procedure_set_static_help (procedure,
                                  "Get the sample merged setting.",
                                  "Returns the sample merged setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("sample-merged",
                                                         "sample merged",
                                                         "The sample merged setting",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-sample-merged
   */
  procedure = pika_procedure_new (context_set_sample_merged_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-sample-merged");
  pika_procedure_set_static_help (procedure,
                                  "Set the sample merged setting.",
                                  "Modifies the sample merged setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether the pixel data from the given drawable is used ('sample-merged' is FALSE), or the pixel data from the composite image ('sample-merged' is TRUE. This is equivalent to sampling for colors after merging all visible layers).\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-color', 'pika-image-select-contiguous-color', 'pika-drawable-edit-bucket-fill'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("sample-merged",
                                                     "sample merged",
                                                     "The sample merged setting",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-sample-criterion
   */
  procedure = pika_procedure_new (context_get_sample_criterion_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-sample-criterion");
  pika_procedure_set_static_help (procedure,
                                  "Get the sample criterion setting.",
                                  "Returns the sample criterion setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("sample-criterion",
                                                      "sample criterion",
                                                      "The sample criterion setting",
                                                      PIKA_TYPE_SELECT_CRITERION,
                                                      PIKA_SELECT_CRITERION_COMPOSITE,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-sample-criterion
   */
  procedure = pika_procedure_new (context_set_sample_criterion_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-sample-criterion");
  pika_procedure_set_static_help (procedure,
                                  "Set the sample criterion setting.",
                                  "Modifies the sample criterion setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls how color similarity is determined. SELECT_CRITERION_COMPOSITE is the default value.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-color', 'pika-image-select-contiguous-color', 'pika-drawable-edit-bucket-fill'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("sample-criterion",
                                                  "sample criterion",
                                                  "The sample criterion setting",
                                                  PIKA_TYPE_SELECT_CRITERION,
                                                  PIKA_SELECT_CRITERION_COMPOSITE,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-sample-threshold
   */
  procedure = pika_procedure_new (context_get_sample_threshold_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-sample-threshold");
  pika_procedure_set_static_help (procedure,
                                  "Get the sample threshold setting.",
                                  "Returns the sample threshold setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("sample-threshold",
                                                        "sample threshold",
                                                        "The sample threshold setting",
                                                        0.0, 1.0, 0.0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-sample-threshold
   */
  procedure = pika_procedure_new (context_set_sample_threshold_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-sample-threshold");
  pika_procedure_set_static_help (procedure,
                                  "Set the sample threshold setting.",
                                  "Modifies the sample threshold setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls what is \"sufficiently close\" to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in pikarc will be used.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-color', 'pika-image-select-contiguous-color', 'pika-drawable-edit-bucket-fill'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("sample-threshold",
                                                    "sample threshold",
                                                    "The sample threshold setting",
                                                    0.0, 1.0, 0.0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-sample-threshold-int
   */
  procedure = pika_procedure_new (context_get_sample_threshold_int_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-sample-threshold-int");
  pika_procedure_set_static_help (procedure,
                                  "Get the sample threshold setting as an integer value.",
                                  "Returns the sample threshold setting as an integer value. See 'pika-context-get-sample-threshold'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_int ("sample-threshold",
                                                     "sample threshold",
                                                     "The sample threshold setting",
                                                     0, 255, 0,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-sample-threshold-int
   */
  procedure = pika_procedure_new (context_set_sample_threshold_int_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-sample-threshold-int");
  pika_procedure_set_static_help (procedure,
                                  "Set the sample threshold setting as an integer value.",
                                  "Modifies the sample threshold setting as an integer value. See 'pika-context-set-sample-threshold'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_argument (procedure,
                               g_param_spec_int ("sample-threshold",
                                                 "sample threshold",
                                                 "The sample threshold setting",
                                                 0, 255, 0,
                                                 PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-sample-transparent
   */
  procedure = pika_procedure_new (context_get_sample_transparent_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-sample-transparent");
  pika_procedure_set_static_help (procedure,
                                  "Get the sample transparent setting.",
                                  "Returns the sample transparent setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("sample-transparent",
                                                         "sample transparent",
                                                         "The sample transparent setting",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-sample-transparent
   */
  procedure = pika_procedure_new (context_set_sample_transparent_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-sample-transparent");
  pika_procedure_set_static_help (procedure,
                                  "Set the sample transparent setting.",
                                  "Modifies the sample transparent setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether transparency is considered to be a unique selectable color. When this setting is TRUE, transparent areas can be selected or filled.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-color', 'pika-image-select-contiguous-color', 'pika-drawable-edit-bucket-fill'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2011");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("sample-transparent",
                                                     "sample transparent",
                                                     "The sample transparent setting",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-diagonal-neighbors
   */
  procedure = pika_procedure_new (context_get_diagonal_neighbors_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-diagonal-neighbors");
  pika_procedure_set_static_help (procedure,
                                  "Get the diagonal neighbors setting.",
                                  "Returns the diagonal neighbors setting.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ell",
                                         "Ell",
                                         "2016");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("diagonal-neighbors",
                                                         "diagonal neighbors",
                                                         "The diagonal neighbors setting",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-diagonal-neighbors
   */
  procedure = pika_procedure_new (context_set_diagonal_neighbors_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-diagonal-neighbors");
  pika_procedure_set_static_help (procedure,
                                  "Set the diagonal neighbors setting.",
                                  "Modifies the diagonal neighbors setting. If the affected region of an operation is based on a seed point, like when doing a seed fill, then, when this setting is TRUE, all eight neighbors of each pixel are considered when calculating the affected region; in contrast, when this setting is FALSE, only the four orthogonal neighbors of each pixel are considered.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-image-select-contiguous-color', 'pika-drawable-edit-bucket-fill'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ell",
                                         "Ell",
                                         "2016");
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("diagonal-neighbors",
                                                     "diagonal neighbors",
                                                     "The diagonal neighbors setting",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-distance-metric
   */
  procedure = pika_procedure_new (context_get_distance_metric_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-distance-metric");
  pika_procedure_set_static_help (procedure,
                                  "Get the distance metric used in some computations.",
                                  "Returns the distance metric in the current context. See 'pika-context-set-distance-metric' to know more about its usage.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Jehan",
                                         "Jehan",
                                         "2018");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("metric",
                                                      "metric",
                                                      "The distance metric",
                                                      GEGL_TYPE_DISTANCE_METRIC,
                                                      GEGL_DISTANCE_METRIC_EUCLIDEAN,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-distance-metric
   */
  procedure = pika_procedure_new (context_set_distance_metric_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-distance-metric");
  pika_procedure_set_static_help (procedure,
                                  "Set the distance metric used in some computations.",
                                  "Modifies the distance metric used in some computations, such as 'pika-drawable-edit-gradient-fill'. In particular, it does not change the metric used in generic distance computation on canvas, as in the Measure tool.\n"
                                  "\n"
                                  "This setting affects the following procedures: 'pika-drawable-edit-gradient-fill'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Jehan",
                                         "Jehan",
                                         "2018");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("metric",
                                                  "metric",
                                                  "The distance metric",
                                                  GEGL_TYPE_DISTANCE_METRIC,
                                                  GEGL_DISTANCE_METRIC_EUCLIDEAN,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-interpolation
   */
  procedure = pika_procedure_new (context_get_interpolation_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-interpolation");
  pika_procedure_set_static_help (procedure,
                                  "Get the interpolation type.",
                                  "Returns the interpolation setting. The return value is an integer which corresponds to the values listed in the argument description. If the interpolation has not been set explicitly by 'pika-context-set-interpolation', the default interpolation set in pikarc will be used.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("interpolation",
                                                      "interpolation",
                                                      "The interpolation type",
                                                      PIKA_TYPE_INTERPOLATION_TYPE,
                                                      PIKA_INTERPOLATION_NONE,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-interpolation
   */
  procedure = pika_procedure_new (context_set_interpolation_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-interpolation");
  pika_procedure_set_static_help (procedure,
                                  "Set the interpolation type.",
                                  "Modifies the interpolation setting.\n"
                                  "\n"
                                  "This setting affects affects the following procedures: 'pika-item-transform-flip', 'pika-item-transform-perspective', 'pika-item-transform-rotate', 'pika-item-transform-scale', 'pika-item-transform-shear', 'pika-item-transform-2d', 'pika-item-transform-matrix', 'pika-image-scale', 'pika-layer-scale'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("interpolation",
                                                  "interpolation",
                                                  "The interpolation type",
                                                  PIKA_TYPE_INTERPOLATION_TYPE,
                                                  PIKA_INTERPOLATION_NONE,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-transform-direction
   */
  procedure = pika_procedure_new (context_get_transform_direction_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-transform-direction");
  pika_procedure_set_static_help (procedure,
                                  "Get the transform direction.",
                                  "Returns the transform direction. The return value is an integer which corresponds to the values listed in the argument description.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("transform-direction",
                                                      "transform direction",
                                                      "The transform direction",
                                                      PIKA_TYPE_TRANSFORM_DIRECTION,
                                                      PIKA_TRANSFORM_FORWARD,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-transform-direction
   */
  procedure = pika_procedure_new (context_set_transform_direction_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-transform-direction");
  pika_procedure_set_static_help (procedure,
                                  "Set the transform direction.",
                                  "Modifies the transform direction setting.\n"
                                  "\n"
                                  "This setting affects affects the following procedures: 'pika-item-transform-flip', 'pika-item-transform-perspective', 'pika-item-transform-rotate', 'pika-item-transform-scale', 'pika-item-transform-shear', 'pika-item-transform-2d', 'pika-item-transform-matrix'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("transform-direction",
                                                  "transform direction",
                                                  "The transform direction",
                                                  PIKA_TYPE_TRANSFORM_DIRECTION,
                                                  PIKA_TRANSFORM_FORWARD,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-transform-resize
   */
  procedure = pika_procedure_new (context_get_transform_resize_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-transform-resize");
  pika_procedure_set_static_help (procedure,
                                  "Get the transform resize type.",
                                  "Returns the transform resize setting. The return value is an integer which corresponds to the values listed in the argument description.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("transform-resize",
                                                      "transform resize",
                                                      "The transform resize type",
                                                      PIKA_TYPE_TRANSFORM_RESIZE,
                                                      PIKA_TRANSFORM_RESIZE_ADJUST,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-transform-resize
   */
  procedure = pika_procedure_new (context_set_transform_resize_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-transform-resize");
  pika_procedure_set_static_help (procedure,
                                  "Set the transform resize type.",
                                  "Modifies the transform resize setting. When transforming pixels, if the result of a transform operation has a different size than the original area, this setting determines how the resulting area is sized.\n"
                                  "\n"
                                  "This setting affects affects the following procedures: 'pika-item-transform-flip', 'pika-item-transform-flip-simple', 'pika-item-transform-perspective', 'pika-item-transform-rotate', 'pika-item-transform-rotate-simple', 'pika-item-transform-scale', 'pika-item-transform-shear', 'pika-item-transform-2d', 'pika-item-transform-matrix'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Michael Natterer <mitch@gimp.org>",
                                         "Michael Natterer",
                                         "2010");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("transform-resize",
                                                  "transform resize",
                                                  "The transform resize type",
                                                  PIKA_TYPE_TRANSFORM_RESIZE,
                                                  PIKA_TRANSFORM_RESIZE_ADJUST,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-size
   */
  procedure = pika_procedure_new (context_get_ink_size_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-size");
  pika_procedure_set_static_help (procedure,
                                  "Get ink blob size in pixels.",
                                  "Get the ink blob size in pixels for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("size",
                                                        "size",
                                                        "ink blob size in pixels",
                                                        0, 200, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-size
   */
  procedure = pika_procedure_new (context_set_ink_size_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-size");
  pika_procedure_set_static_help (procedure,
                                  "Set ink blob size in pixels.",
                                  "Set the ink blob size in pixels for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("size",
                                                    "size",
                                                    "ink blob size in pixels",
                                                    0, 200, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-angle
   */
  procedure = pika_procedure_new (context_get_ink_angle_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-angle");
  pika_procedure_set_static_help (procedure,
                                  "Get ink angle in degrees.",
                                  "Get the ink angle in degrees for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("angle",
                                                        "angle",
                                                        "ink angle in degrees",
                                                        -90, 90, -90,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-angle
   */
  procedure = pika_procedure_new (context_set_ink_angle_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-angle");
  pika_procedure_set_static_help (procedure,
                                  "Set ink angle in degrees.",
                                  "Set the ink angle in degrees for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("angle",
                                                    "angle",
                                                    "ink angle in degrees",
                                                    -90, 90, -90,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-size-sensitivity
   */
  procedure = pika_procedure_new (context_get_ink_size_sensitivity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-size-sensitivity");
  pika_procedure_set_static_help (procedure,
                                  "Get ink size sensitivity.",
                                  "Get the ink size sensitivity for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("size",
                                                        "size",
                                                        "ink size sensitivity",
                                                        0, 1, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-size-sensitivity
   */
  procedure = pika_procedure_new (context_set_ink_size_sensitivity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-size-sensitivity");
  pika_procedure_set_static_help (procedure,
                                  "Set ink size sensitivity.",
                                  "Set the ink size sensitivity for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("size",
                                                    "size",
                                                    "ink size sensitivity",
                                                    0, 1, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-tilt-sensitivity
   */
  procedure = pika_procedure_new (context_get_ink_tilt_sensitivity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-tilt-sensitivity");
  pika_procedure_set_static_help (procedure,
                                  "Get ink tilt sensitivity.",
                                  "Get the ink tilt sensitivity for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("tilt",
                                                        "tilt",
                                                        "ink tilt sensitivity",
                                                        0, 1, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-tilt-sensitivity
   */
  procedure = pika_procedure_new (context_set_ink_tilt_sensitivity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-tilt-sensitivity");
  pika_procedure_set_static_help (procedure,
                                  "Set ink tilt sensitivity.",
                                  "Set the ink tilt sensitivity for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("tilt",
                                                    "tilt",
                                                    "ink tilt sensitivity",
                                                    0, 1, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-speed-sensitivity
   */
  procedure = pika_procedure_new (context_get_ink_speed_sensitivity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-speed-sensitivity");
  pika_procedure_set_static_help (procedure,
                                  "Get ink speed sensitivity.",
                                  "Get the ink speed sensitivity for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("speed",
                                                        "speed",
                                                        "ink speed sensitivity",
                                                        0, 1, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-speed-sensitivity
   */
  procedure = pika_procedure_new (context_set_ink_speed_sensitivity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-speed-sensitivity");
  pika_procedure_set_static_help (procedure,
                                  "Set ink speed sensitivity.",
                                  "Set the ink speed sensitivity for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("speed",
                                                    "speed",
                                                    "ink speed sensitivity",
                                                    0, 1, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-blob-type
   */
  procedure = pika_procedure_new (context_get_ink_blob_type_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-blob-type");
  pika_procedure_set_static_help (procedure,
                                  "Get ink blob type.",
                                  "Get the ink blob type for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_enum ("type",
                                                      "type",
                                                      "Ink blob type",
                                                      PIKA_TYPE_INK_BLOB_TYPE,
                                                      PIKA_INK_BLOB_TYPE_CIRCLE,
                                                      PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-blob-type
   */
  procedure = pika_procedure_new (context_set_ink_blob_type_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-blob-type");
  pika_procedure_set_static_help (procedure,
                                  "Set ink blob type.",
                                  "Set the ink blob type for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("type",
                                                  "type",
                                                  "Ink blob type",
                                                  PIKA_TYPE_INK_BLOB_TYPE,
                                                  PIKA_INK_BLOB_TYPE_CIRCLE,
                                                  PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-blob-aspect-ratio
   */
  procedure = pika_procedure_new (context_get_ink_blob_aspect_ratio_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-blob-aspect-ratio");
  pika_procedure_set_static_help (procedure,
                                  "Get ink blob aspect ratio.",
                                  "Get the ink blob aspect ratio for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("aspect",
                                                        "aspect",
                                                        "ink blob aspect ratio",
                                                        1, 10, 1,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-blob-aspect-ratio
   */
  procedure = pika_procedure_new (context_set_ink_blob_aspect_ratio_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-blob-aspect-ratio");
  pika_procedure_set_static_help (procedure,
                                  "Set ink blob aspect ratio.",
                                  "Set the ink blob aspect ratio for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("aspect",
                                                    "aspect",
                                                    "ink blob aspect ratio",
                                                    1, 10, 1,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-ink-blob-angle
   */
  procedure = pika_procedure_new (context_get_ink_blob_angle_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-ink-blob-angle");
  pika_procedure_set_static_help (procedure,
                                  "Get ink blob angle in degrees.",
                                  "Get the ink blob angle in degrees for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("angle",
                                                        "angle",
                                                        "ink blob angle in degrees",
                                                        -180, 180, -180,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-set-ink-blob-angle
   */
  procedure = pika_procedure_new (context_set_ink_blob_angle_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-set-ink-blob-angle");
  pika_procedure_set_static_help (procedure,
                                  "Set ink blob angle in degrees.",
                                  "Set the ink blob angle in degrees for ink tool.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Ed Swartz",
                                         "Ed Swartz",
                                         "2012");
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("angle",
                                                    "angle",
                                                    "ink blob angle in degrees",
                                                    -180, 180, -180,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-context-get-resource
   */
  procedure = pika_procedure_new (context_get_resource_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-context-get-resource");
  pika_procedure_set_static_help (procedure,
                                  "Get the currently active resource for a type.",
                                  "Returns the currently active resource for the given type name.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Jehan",
                                         "Jehan",
                                         "2023");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_string ("type-name",
                                                       "type name",
                                                       "The name of the resource type",
                                                       FALSE, FALSE, TRUE,
                                                       NULL,
                                                       PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_resource ("resource",
                                                             "resource",
                                                             "The active resource",
                                                             FALSE,
                                                             PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);
}
