/* LIBPIKA - The PIKA Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * pikaimagegrid_pdb.c
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

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

#include "config.h"

#include "stamp-pdbgen.h"

#include "pika.h"


/**
 * SECTION: pikaimagegrid
 * @title: pikaimagegrid
 * @short_description: Functions manuipulating an image's grid.
 *
 * Functions manuipulating an image's grid.
 **/


/**
 * pika_image_grid_get_spacing:
 * @image: The image.
 * @xspacing: (out): The image's grid horizontal spacing.
 * @yspacing: (out): The image's grid vertical spacing.
 *
 * Gets the spacing of an image's grid.
 *
 * This procedure retrieves the horizontal and vertical spacing of an
 * image's grid. It takes the image as parameter.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_get_spacing (PikaImage *image,
                             gdouble   *xspacing,
                             gdouble   *yspacing)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-get-spacing",
                                               args);
  pika_value_array_unref (args);

  *xspacing = 0.0;
  *yspacing = 0.0;

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  if (success)
    {
      *xspacing = PIKA_VALUES_GET_DOUBLE (return_vals, 1);
      *yspacing = PIKA_VALUES_GET_DOUBLE (return_vals, 2);
    }

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_set_spacing:
 * @image: The image.
 * @xspacing: The image's grid horizontal spacing.
 * @yspacing: The image's grid vertical spacing.
 *
 * Sets the spacing of an image's grid.
 *
 * This procedure sets the horizontal and vertical spacing of an
 * image's grid.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_set_spacing (PikaImage *image,
                             gdouble    xspacing,
                             gdouble    yspacing)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_DOUBLE, xspacing,
                                          G_TYPE_DOUBLE, yspacing,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-set-spacing",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_get_offset:
 * @image: The image.
 * @xoffset: (out): The image's grid horizontal offset.
 * @yoffset: (out): The image's grid vertical offset.
 *
 * Gets the offset of an image's grid.
 *
 * This procedure retrieves the horizontal and vertical offset of an
 * image's grid. It takes the image as parameter.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_get_offset (PikaImage *image,
                            gdouble   *xoffset,
                            gdouble   *yoffset)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-get-offset",
                                               args);
  pika_value_array_unref (args);

  *xoffset = 0.0;
  *yoffset = 0.0;

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  if (success)
    {
      *xoffset = PIKA_VALUES_GET_DOUBLE (return_vals, 1);
      *yoffset = PIKA_VALUES_GET_DOUBLE (return_vals, 2);
    }

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_set_offset:
 * @image: The image.
 * @xoffset: The image's grid horizontal offset.
 * @yoffset: The image's grid vertical offset.
 *
 * Sets the offset of an image's grid.
 *
 * This procedure sets the horizontal and vertical offset of an image's
 * grid.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_set_offset (PikaImage *image,
                            gdouble    xoffset,
                            gdouble    yoffset)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_DOUBLE, xoffset,
                                          G_TYPE_DOUBLE, yoffset,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-set-offset",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_get_foreground_color:
 * @image: The image.
 * @fgcolor: (out caller-allocates): The image's grid foreground color.
 *
 * Sets the foreground color of an image's grid.
 *
 * This procedure gets the foreground color of an image's grid.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_get_foreground_color (PikaImage *image,
                                      PikaRGB   *fgcolor)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-get-foreground-color",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  if (success)
    PIKA_VALUES_GET_RGB (return_vals, 1, &*fgcolor);

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_set_foreground_color:
 * @image: The image.
 * @fgcolor: The new foreground color.
 *
 * Gets the foreground color of an image's grid.
 *
 * This procedure sets the foreground color of an image's grid.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_set_foreground_color (PikaImage     *image,
                                      const PikaRGB *fgcolor)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          PIKA_TYPE_RGB, fgcolor,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-set-foreground-color",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_get_background_color:
 * @image: The image.
 * @bgcolor: (out caller-allocates): The image's grid background color.
 *
 * Sets the background color of an image's grid.
 *
 * This procedure gets the background color of an image's grid.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_get_background_color (PikaImage *image,
                                      PikaRGB   *bgcolor)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-get-background-color",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  if (success)
    PIKA_VALUES_GET_RGB (return_vals, 1, &*bgcolor);

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_set_background_color:
 * @image: The image.
 * @bgcolor: The new background color.
 *
 * Gets the background color of an image's grid.
 *
 * This procedure sets the background color of an image's grid.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_set_background_color (PikaImage     *image,
                                      const PikaRGB *bgcolor)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          PIKA_TYPE_RGB, bgcolor,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-set-background-color",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  pika_value_array_unref (return_vals);

  return success;
}

/**
 * pika_image_grid_get_style:
 * @image: The image.
 *
 * Gets the style of an image's grid.
 *
 * This procedure retrieves the style of an image's grid.
 *
 * Returns: The image's grid style.
 *
 * Since: 2.4
 **/
PikaGridStyle
pika_image_grid_get_style (PikaImage *image)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  PikaGridStyle style = 0;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-get-style",
                                               args);
  pika_value_array_unref (args);

  if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
    style = PIKA_VALUES_GET_ENUM (return_vals, 1);

  pika_value_array_unref (return_vals);

  return style;
}

/**
 * pika_image_grid_set_style:
 * @image: The image.
 * @style: The image's grid style.
 *
 * Sets the style unit of an image's grid.
 *
 * This procedure sets the style of an image's grid. It takes the image
 * and the new style as parameters.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.4
 **/
gboolean
pika_image_grid_set_style (PikaImage     *image,
                           PikaGridStyle  style)
{
  PikaValueArray *args;
  PikaValueArray *return_vals;
  gboolean success = TRUE;

  args = pika_value_array_new_from_types (NULL,
                                          PIKA_TYPE_IMAGE, image,
                                          PIKA_TYPE_GRID_STYLE, style,
                                          G_TYPE_NONE);

  return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
                                               "pika-image-grid-set-style",
                                               args);
  pika_value_array_unref (args);

  success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;

  pika_value_array_unref (return_vals);

  return success;
}
