/* 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 "libpikabase/pikabase.h"
#include "libpikacolor/pikacolor.h"

#include "libpikabase/pikabase.h"

#include "pdb-types.h"

#include "core/pikachannel-combine.h"
#include "core/pikachannel.h"
#include "core/pikaimage.h"
#include "core/pikaparamspecs.h"

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

#include "pika-intl.h"


static PikaValueArray *
channel_new_invoker (PikaProcedure         *procedure,
                     Pika                  *pika,
                     PikaContext           *context,
                     PikaProgress          *progress,
                     const PikaValueArray  *args,
                     GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaImage *image;
  gint width;
  gint height;
  const gchar *name;
  gdouble opacity;
  PikaRGB color;
  PikaChannel *channel = NULL;

  image = g_value_get_object (pika_value_array_index (args, 0));
  width = g_value_get_int (pika_value_array_index (args, 1));
  height = g_value_get_int (pika_value_array_index (args, 2));
  name = g_value_get_string (pika_value_array_index (args, 3));
  opacity = g_value_get_double (pika_value_array_index (args, 4));
  pika_value_get_rgb (pika_value_array_index (args, 5), &color);

  if (success)
    {
      PikaRGB rgb_color = color;

      rgb_color.a = opacity / 100.0;
      channel = pika_channel_new (image, width, height, name, &rgb_color);

      if (! channel)
        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), channel);

  return return_vals;
}

static PikaValueArray *
channel_new_from_component_invoker (PikaProcedure         *procedure,
                                    Pika                  *pika,
                                    PikaContext           *context,
                                    PikaProgress          *progress,
                                    const PikaValueArray  *args,
                                    GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaImage *image;
  gint component;
  const gchar *name;
  PikaChannel *channel = NULL;

  image = g_value_get_object (pika_value_array_index (args, 0));
  component = g_value_get_enum (pika_value_array_index (args, 1));
  name = g_value_get_string (pika_value_array_index (args, 2));

  if (success)
    {
      if (pika_image_get_component_format (image, component) != NULL)
        channel = pika_channel_new_from_component (image,
                                                   component, name, NULL);

      if (channel)
        pika_item_set_visible (PIKA_ITEM (channel), FALSE, 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), channel);

  return return_vals;
}

static PikaValueArray *
channel_copy_invoker (PikaProcedure         *procedure,
                      Pika                  *pika,
                      PikaContext           *context,
                      PikaProgress          *progress,
                      const PikaValueArray  *args,
                      GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaChannel *channel;
  PikaChannel *channel_copy = NULL;

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

  if (success)
    {
      PikaImage *image  = pika_item_get_image (PIKA_ITEM (channel));
      gint       width  = pika_image_get_width  (image);
      gint       height = pika_image_get_height (image);

      if (pika_item_get_width  (PIKA_ITEM (channel)) == width &&
          pika_item_get_height (PIKA_ITEM (channel)) == height)
        {
          channel_copy = PIKA_CHANNEL (pika_item_duplicate (PIKA_ITEM (channel),
                                                            PIKA_TYPE_CHANNEL));

          if (! channel_copy)
            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), channel_copy);

  return return_vals;
}

static PikaValueArray *
channel_combine_masks_invoker (PikaProcedure         *procedure,
                               Pika                  *pika,
                               PikaContext           *context,
                               PikaProgress          *progress,
                               const PikaValueArray  *args,
                               GError               **error)
{
  gboolean success = TRUE;
  PikaChannel *channel1;
  PikaChannel *channel2;
  gint operation;
  gint offx;
  gint offy;

  channel1 = g_value_get_object (pika_value_array_index (args, 0));
  channel2 = g_value_get_object (pika_value_array_index (args, 1));
  operation = g_value_get_enum (pika_value_array_index (args, 2));
  offx = g_value_get_int (pika_value_array_index (args, 3));
  offy = g_value_get_int (pika_value_array_index (args, 4));

  if (success)
    {
      if (pika_item_is_attached (PIKA_ITEM (channel1)))
        pika_channel_push_undo (channel1, _("Combine Masks"));

      pika_channel_combine_mask (channel1, channel2, operation, offx, offy);
    }

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

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

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

  if (success)
    {
      show_masked = pika_channel_get_show_masked (channel);
    }

  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), show_masked);

  return return_vals;
}

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

  channel = g_value_get_object (pika_value_array_index (args, 0));
  show_masked = g_value_get_boolean (pika_value_array_index (args, 1));

  if (success)
    {
      pika_channel_set_show_masked (channel, show_masked);
    }

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

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

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

  if (success)
    {
      opacity = pika_channel_get_opacity (channel) * 100;
    }

  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), opacity);

  return return_vals;
}

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

  channel = g_value_get_object (pika_value_array_index (args, 0));
  opacity = g_value_get_double (pika_value_array_index (args, 1));

  if (success)
    {
      pika_channel_set_opacity (channel, opacity / 100.0, TRUE);
    }

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

static PikaValueArray *
channel_get_color_invoker (PikaProcedure         *procedure,
                           Pika                  *pika,
                           PikaContext           *context,
                           PikaProgress          *progress,
                           const PikaValueArray  *args,
                           GError               **error)
{
  gboolean success = TRUE;
  PikaValueArray *return_vals;
  PikaChannel *channel;
  PikaRGB color = { 0.0, 0.0, 0.0, 1.0 };

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

  if (success)
    {
      pika_channel_get_color (channel, &color);
      pika_rgb_set_alpha (&color, 1.0);
    }

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

  if (success)
    pika_value_set_rgb (pika_value_array_index (return_vals, 1), &color);

  return return_vals;
}

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

  channel = g_value_get_object (pika_value_array_index (args, 0));
  pika_value_get_rgb (pika_value_array_index (args, 1), &color);

  if (success)
    {
      PikaRGB rgb_color = color;

      rgb_color.a = channel->color.a;
      pika_channel_set_color (channel, &rgb_color, TRUE);
    }

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

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

  /*
   * pika-channel-new
   */
  procedure = pika_procedure_new (channel_new_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-new");
  pika_procedure_set_static_help (procedure,
                                  "Create a new channel.",
                                  "This procedure creates a new channel with the specified width, height, name, opacity and color.\n"
                                  "The new channel still needs to be added to the image, as this is not automatic. Add the new channel with 'pika-image-insert-channel'. Other attributes, such as channel visibility, should be set with explicit procedure calls.\n"
                                  "The channel's contents are undefined initially.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_image ("image",
                                                      "image",
                                                      "The image to which to add the channel",
                                                      FALSE,
                                                      PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_int ("width",
                                                 "width",
                                                 "The channel width",
                                                 1, PIKA_MAX_IMAGE_SIZE, 1,
                                                 PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_int ("height",
                                                 "height",
                                                 "The channel height",
                                                 1, PIKA_MAX_IMAGE_SIZE, 1,
                                                 PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               pika_param_spec_string ("name",
                                                       "name",
                                                       "The channel name",
                                                       FALSE, FALSE, FALSE,
                                                       NULL,
                                                       PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("opacity",
                                                    "opacity",
                                                    "The channel opacity",
                                                    0, 100, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               pika_param_spec_rgb ("color",
                                                    "color",
                                                    "The channel compositing color",
                                                    FALSE,
                                                    NULL,
                                                    PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_channel ("channel",
                                                            "channel",
                                                            "The newly created channel",
                                                            FALSE,
                                                            PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-new-from-component
   */
  procedure = pika_procedure_new (channel_new_from_component_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-new-from-component");
  pika_procedure_set_static_help (procedure,
                                  "Create a new channel from a color component",
                                  "This procedure creates a new channel from a color component.\n"
                                  "The new channel still needs to be added to the image, as this is not automatic. Add the new channel with 'pika-image-insert-channel'. Other attributes, such as channel visibility, should be set with explicit procedure calls.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Shlomi Fish <shlomif@iglu.org.il>",
                                         "Shlomi Fish",
                                         "2005");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_image ("image",
                                                      "image",
                                                      "The image to which to add the channel",
                                                      FALSE,
                                                      PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("component",
                                                  "component",
                                                  "The image component",
                                                  PIKA_TYPE_CHANNEL_TYPE,
                                                  PIKA_CHANNEL_RED,
                                                  PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               pika_param_spec_string ("name",
                                                       "name",
                                                       "The channel name",
                                                       FALSE, FALSE, FALSE,
                                                       NULL,
                                                       PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_channel ("channel",
                                                            "channel",
                                                            "The newly created channel",
                                                            FALSE,
                                                            PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-copy
   */
  procedure = pika_procedure_new (channel_copy_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-copy");
  pika_procedure_set_static_help (procedure,
                                  "Copy a channel.",
                                  "This procedure copies the specified channel and returns the copy.\n"
                                  "The new channel still needs to be added to the image, as this is not automatic. Add the new channel with 'pika-image-insert-channel'.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel to copy",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_channel ("channel-copy",
                                                            "channel copy",
                                                            "The newly copied channel",
                                                            FALSE,
                                                            PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-combine-masks
   */
  procedure = pika_procedure_new (channel_combine_masks_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-combine-masks");
  pika_procedure_set_static_help (procedure,
                                  "Combine two channel masks.",
                                  "This procedure combines two channel masks. The result is stored in the first channel.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel1",
                                                        "channel1",
                                                        "The channel1",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel2",
                                                        "channel2",
                                                        "The channel2",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_enum ("operation",
                                                  "operation",
                                                  "The selection operation",
                                                  PIKA_TYPE_CHANNEL_OPS,
                                                  PIKA_CHANNEL_OP_ADD,
                                                  PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_int ("offx",
                                                 "offx",
                                                 "x offset between upper left corner of channels: (second - first)",
                                                 G_MININT32, G_MAXINT32, 0,
                                                 PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_int ("offy",
                                                 "offy",
                                                 "y offset between upper left corner of channels: (second - first)",
                                                 G_MININT32, G_MAXINT32, 0,
                                                 PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-get-show-masked
   */
  procedure = pika_procedure_new (channel_get_show_masked_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-get-show-masked");
  pika_procedure_set_static_help (procedure,
                                  "Get the composite method of the specified channel.",
                                  "This procedure returns the specified channel's composite method. If it is TRUE, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_boolean ("show-masked",
                                                         "show masked",
                                                         "The channel composite method",
                                                         FALSE,
                                                         PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-set-show-masked
   */
  procedure = pika_procedure_new (channel_set_show_masked_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-set-show-masked");
  pika_procedure_set_static_help (procedure,
                                  "Set the composite method of the specified channel.",
                                  "This procedure sets the specified channel's composite method. If it is TRUE, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_boolean ("show-masked",
                                                     "show masked",
                                                     "The new channel composite method",
                                                     FALSE,
                                                     PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-get-opacity
   */
  procedure = pika_procedure_new (channel_get_opacity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-get-opacity");
  pika_procedure_set_static_help (procedure,
                                  "Get the opacity of the specified channel.",
                                  "This procedure returns the specified channel's opacity.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   g_param_spec_double ("opacity",
                                                        "opacity",
                                                        "The channel opacity",
                                                        0, 100, 0,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-set-opacity
   */
  procedure = pika_procedure_new (channel_set_opacity_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-set-opacity");
  pika_procedure_set_static_help (procedure,
                                  "Set the opacity of the specified channel.",
                                  "This procedure sets the specified channel's opacity.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               g_param_spec_double ("opacity",
                                                    "opacity",
                                                    "The new channel opacity",
                                                    0, 100, 0,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-get-color
   */
  procedure = pika_procedure_new (channel_get_color_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-get-color");
  pika_procedure_set_static_help (procedure,
                                  "Get the compositing color of the specified channel.",
                                  "This procedure returns the specified channel's compositing color.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_return_value (procedure,
                                   pika_param_spec_rgb ("color",
                                                        "color",
                                                        "The channel compositing color",
                                                        FALSE,
                                                        NULL,
                                                        PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);

  /*
   * pika-channel-set-color
   */
  procedure = pika_procedure_new (channel_set_color_invoker);
  pika_object_set_static_name (PIKA_OBJECT (procedure),
                               "pika-channel-set-color");
  pika_procedure_set_static_help (procedure,
                                  "Set the compositing color of the specified channel.",
                                  "This procedure sets the specified channel's compositing color.",
                                  NULL);
  pika_procedure_set_static_attribution (procedure,
                                         "Spencer Kimball & Peter Mattis",
                                         "Spencer Kimball & Peter Mattis",
                                         "1995-1996");
  pika_procedure_add_argument (procedure,
                               pika_param_spec_channel ("channel",
                                                        "channel",
                                                        "The channel",
                                                        FALSE,
                                                        PIKA_PARAM_READWRITE));
  pika_procedure_add_argument (procedure,
                               pika_param_spec_rgb ("color",
                                                    "color",
                                                    "The new channel compositing color",
                                                    FALSE,
                                                    NULL,
                                                    PIKA_PARAM_READWRITE));
  pika_pdb_register_procedure (pdb, procedure);
  g_object_unref (procedure);
}
