gimp/app/pdb/drawable_cmds.c

2762 lines
108 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
#include "config.h"
#include <glib-object.h>
#include "pdb-types.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "procedural_db.h"
#include "core/gimpparamspecs.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpdrawable-foreground-extract.h"
#include "core/gimpdrawable-offset.h"
#include "core/gimpdrawable-preview.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "gimp-intl.h"
#include "plug-in/plug-in.h"
static GimpProcedure drawable_delete_proc;
static GimpProcedure drawable_is_layer_proc;
static GimpProcedure drawable_is_layer_mask_proc;
static GimpProcedure drawable_is_channel_proc;
static GimpProcedure drawable_type_proc;
static GimpProcedure drawable_type_with_alpha_proc;
static GimpProcedure drawable_has_alpha_proc;
static GimpProcedure drawable_is_rgb_proc;
static GimpProcedure drawable_is_gray_proc;
static GimpProcedure drawable_is_indexed_proc;
static GimpProcedure drawable_bpp_proc;
static GimpProcedure drawable_width_proc;
static GimpProcedure drawable_height_proc;
static GimpProcedure drawable_offsets_proc;
static GimpProcedure drawable_get_image_proc;
static GimpProcedure drawable_set_image_proc;
static GimpProcedure drawable_get_name_proc;
static GimpProcedure drawable_set_name_proc;
static GimpProcedure drawable_get_visible_proc;
static GimpProcedure drawable_set_visible_proc;
static GimpProcedure drawable_get_linked_proc;
static GimpProcedure drawable_set_linked_proc;
static GimpProcedure drawable_get_tattoo_proc;
static GimpProcedure drawable_set_tattoo_proc;
static GimpProcedure drawable_mask_bounds_proc;
static GimpProcedure drawable_mask_intersect_proc;
static GimpProcedure drawable_merge_shadow_proc;
static GimpProcedure drawable_update_proc;
static GimpProcedure drawable_get_pixel_proc;
static GimpProcedure drawable_set_pixel_proc;
static GimpProcedure drawable_fill_proc;
static GimpProcedure drawable_offset_proc;
static GimpProcedure drawable_thumbnail_proc;
static GimpProcedure drawable_sub_thumbnail_proc;
static GimpProcedure drawable_foreground_extract_proc;
void
register_drawable_procs (Gimp *gimp)
{
GimpProcedure *procedure;
/*
* drawable_delete
*/
procedure = gimp_procedure_init (&drawable_delete_proc, 1, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable to delete",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_is_layer
*/
procedure = gimp_procedure_init (&drawable_is_layer_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("layer",
"layer",
"TRUE if the drawable is a layer",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_is_layer_mask
*/
procedure = gimp_procedure_init (&drawable_is_layer_mask_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("layer-mask",
"layer mask",
"TRUE if the drawable is a layer mask",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_is_channel
*/
procedure = gimp_procedure_init (&drawable_is_channel_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("channel",
"channel",
"TRUE if the drawable is a channel",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_type
*/
procedure = gimp_procedure_init (&drawable_type_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("type",
"type",
"The drawable's type: { GIMP_RGB_IMAGE (0), GIMP_RGBA_IMAGE (1), GIMP_GRAY_IMAGE (2), GIMP_GRAYA_IMAGE (3), GIMP_INDEXED_IMAGE (4), GIMP_INDEXEDA_IMAGE (5) }",
GIMP_TYPE_IMAGE_TYPE,
GIMP_RGB_IMAGE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_type_with_alpha
*/
procedure = gimp_procedure_init (&drawable_type_with_alpha_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
gimp_param_spec_enum ("type-with-alpha",
"type with alpha",
"The drawable's type with alpha: { GIMP_RGBA_IMAGE (1), GIMP_GRAYA_IMAGE (3), GIMP_INDEXEDA_IMAGE (5) }",
GIMP_TYPE_IMAGE_TYPE,
GIMP_RGB_IMAGE,
GIMP_PARAM_READWRITE));
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0].pspec),
GIMP_RGB_IMAGE);
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0].pspec),
GIMP_GRAY_IMAGE);
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0].pspec),
GIMP_INDEXED_IMAGE);
procedural_db_register (gimp, procedure);
/*
* drawable_has_alpha
*/
procedure = gimp_procedure_init (&drawable_has_alpha_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("has-alpha",
"has alpha",
"Does the drawable have an alpha channel?",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_is_rgb
*/
procedure = gimp_procedure_init (&drawable_is_rgb_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("is-rgb",
"is rgb",
"TRUE if the drawable is an RGB type",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_is_gray
*/
procedure = gimp_procedure_init (&drawable_is_gray_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("is-gray",
"is gray",
"TRUE if the drawable is a grayscale type",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_is_indexed
*/
procedure = gimp_procedure_init (&drawable_is_indexed_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("is-indexed",
"is indexed",
"TRUE if the drawable is an indexed type",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_bpp
*/
procedure = gimp_procedure_init (&drawable_bpp_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("bpp",
"bpp",
"Bytes per pixel",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_width
*/
procedure = gimp_procedure_init (&drawable_width_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("width",
"width",
"Width of drawable",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_height
*/
procedure = gimp_procedure_init (&drawable_height_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("height",
"height",
"Height of drawable",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_offsets
*/
procedure = gimp_procedure_init (&drawable_offsets_proc, 1, 2);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("offset-x",
"offset x",
"x offset of drawable",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("offset-y",
"offset y",
"y offset of drawable",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_get_image
*/
procedure = gimp_procedure_init (&drawable_get_image_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_IMAGE,
gimp_param_spec_image_id ("image",
"image",
"The drawable's image",
gimp,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_set_image
*/
procedure = gimp_procedure_init (&drawable_set_image_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_IMAGE,
gimp_param_spec_image_id ("image",
"image",
"The image",
gimp,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_get_name
*/
procedure = gimp_procedure_init (&drawable_get_name_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_STRING,
gimp_param_spec_string ("name",
"name",
"The drawable name",
FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_set_name
*/
procedure = gimp_procedure_init (&drawable_set_name_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_STRING,
gimp_param_spec_string ("name",
"name",
"The new drawable name",
FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_get_visible
*/
procedure = gimp_procedure_init (&drawable_get_visible_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("visible",
"visible",
"The drawable visibility",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_set_visible
*/
procedure = gimp_procedure_init (&drawable_set_visible_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("visible",
"visible",
"The new drawable visibility",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_get_linked
*/
procedure = gimp_procedure_init (&drawable_get_linked_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("linked",
"linked",
"The drawable linked state (for moves)",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_set_linked
*/
procedure = gimp_procedure_init (&drawable_set_linked_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("linked",
"linked",
"The new drawable linked state",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_get_tattoo
*/
procedure = gimp_procedure_init (&drawable_get_tattoo_proc, 1, 1);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_uint ("tattoo",
"tattoo",
"The drawable tattoo",
1, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_set_tattoo
*/
procedure = gimp_procedure_init (&drawable_set_tattoo_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_uint ("tattoo",
"tattoo",
"The new drawable tattoo",
1, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_mask_bounds
*/
procedure = gimp_procedure_init (&drawable_mask_bounds_proc, 1, 5);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("non-empty",
"non empty",
"TRUE if there is a selection",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("x1",
"x1",
"x coordinate of the upper left corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("y1",
"y1",
"y coordinate of the upper left corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("x2",
"x2",
"x coordinate of the lower right corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("y2",
"y2",
"y coordinate of the lower right corner of selection bounds",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_mask_intersect
*/
procedure = gimp_procedure_init (&drawable_mask_intersect_proc, 1, 5);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("non-empty",
"non empty",
"TRUE if the returned area is not empty",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("x",
"x",
"x coordinate of the upper left corner of the intersection",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("y",
"y",
"y coordinate of the upper left corner of the intersection",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("width",
"width",
"width of the intersection",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("height",
"height",
"height of the intersection",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_merge_shadow
*/
procedure = gimp_procedure_init (&drawable_merge_shadow_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("undo",
"undo",
"Push merge to undo stack?",
FALSE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_update
*/
procedure = gimp_procedure_init (&drawable_update_proc, 5, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("x",
"x",
"x coordinate of upper left corner of update region",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("y",
"y",
"y coordinate of upper left corner of update region",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("width",
"width",
"Width of update region",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("height",
"height",
"Height of update region",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_get_pixel
*/
procedure = gimp_procedure_init (&drawable_get_pixel_proc, 3, 2);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("x-coord",
"x coord",
"The x coordinate",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("y-coord",
"y coord",
"The y coordinate",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-channels",
"num channels",
"The number of channels for the pixel",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT8ARRAY,
g_param_spec_pointer ("pixel",
"pixel",
"The pixel value",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_set_pixel
*/
procedure = gimp_procedure_init (&drawable_set_pixel_proc, 5, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("x-coord",
"x coord",
"The x coordinate",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("y-coord",
"y coord",
"The y coordinate",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-channels",
"num channels",
"The number of channels for the pixel",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT8ARRAY,
g_param_spec_pointer ("pixel",
"pixel",
"The pixel value",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_fill
*/
procedure = gimp_procedure_init (&drawable_fill_proc, 2, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("fill-type",
"fill type",
"The type of fill: { GIMP_FOREGROUND_FILL (0), GIMP_BACKGROUND_FILL (1), GIMP_WHITE_FILL (2), GIMP_TRANSPARENT_FILL (3), GIMP_PATTERN_FILL (4) }",
GIMP_TYPE_FILL_TYPE,
GIMP_FOREGROUND_FILL,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_offset
*/
procedure = gimp_procedure_init (&drawable_offset_proc, 5, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable to offset",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_boolean ("wrap-around",
"wrap around",
"wrap image around or fill vacated regions",
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("fill-type",
"fill type",
"fill vacated regions of drawable with background or transparent: { GIMP_OFFSET_BACKGROUND (0), GIMP_OFFSET_TRANSPARENT (1) }",
GIMP_TYPE_OFFSET_TYPE,
GIMP_OFFSET_BACKGROUND,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("offset-x",
"offset x",
"offset by this amount in X direction",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("offset-y",
"offset y",
"offset by this amount in Y direction",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_thumbnail
*/
procedure = gimp_procedure_init (&drawable_thumbnail_proc, 3, 5);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("width",
"width",
"The requested thumbnail width",
1, 512, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("height",
"height",
"The requested thumbnail height",
1, 512, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("actual-width",
"actual width",
"The previews width",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("actual-height",
"actual height",
"The previews height",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("bpp",
"bpp",
"The previews bpp",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("thumbnail-data-count",
"thumbnail data count",
"The number of bytes in thumbnail data",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT8ARRAY,
g_param_spec_pointer ("thumbnail-data",
"thumbnail data",
"The thumbnail data",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_sub_thumbnail
*/
procedure = gimp_procedure_init (&drawable_sub_thumbnail_proc, 7, 5);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("src-x",
"src x",
"The x coordinate of the area",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("src-y",
"src y",
"The y coordinate of the area",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("src-width",
"src width",
"The width of the area",
1, G_MAXINT32, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("src-height",
"src height",
"The height of the area",
1, G_MAXINT32, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("dest-width",
"dest width",
"The thumbnail width",
1, 512, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("dest-height",
"dest height",
"The thumbnail height",
1, 512, 1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("width",
"width",
"The previews width",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("height",
"height",
"The previews height",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("bpp",
"bpp",
"The previews bpp",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("thumbnail-data-count",
"thumbnail data count",
"The number of bytes in thumbnail data",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
GIMP_PDB_INT8ARRAY,
g_param_spec_pointer ("thumbnail-data",
"thumbnail data",
"The thumbnail data",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* drawable_foreground_extract
*/
procedure = gimp_procedure_init (&drawable_foreground_extract_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("mode",
"mode",
"The algorithm to use: { GIMP_FOREGROUND_EXTRACT_SIOX (0) }",
GIMP_TYPE_FOREGROUND_EXTRACT_MODE,
GIMP_FOREGROUND_EXTRACT_SIOX,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("mask",
"mask",
"Tri-Map",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
}
static Argument *
drawable_delete_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
if (gimp_item_is_floating (GIMP_ITEM (drawable)))
gimp_item_sink (GIMP_ITEM (drawable));
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_delete_proc =
{
TRUE, TRUE,
"gimp-drawable-delete",
"gimp-drawable-delete",
"Delete a drawable.",
"This procedure deletes the specified drawable. This must not be done if the image containing this drawable was already deleted or if the drawable was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a drawable which has not yet been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_delete_invoker } }
};
static Argument *
drawable_is_layer_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean layer = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
layer = GIMP_IS_LAYER (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, layer);
return return_vals;
}
static GimpProcedure drawable_is_layer_proc =
{
TRUE, TRUE,
"gimp-drawable-is-layer",
"gimp-drawable-is-layer",
"Returns whether the drawable is a layer.",
"This procedure returns TRUE if the specified drawable is a layer.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_is_layer_invoker } }
};
static Argument *
drawable_is_layer_mask_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean layer_mask = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
layer_mask = GIMP_IS_LAYER_MASK (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, layer_mask);
return return_vals;
}
static GimpProcedure drawable_is_layer_mask_proc =
{
TRUE, TRUE,
"gimp-drawable-is-layer-mask",
"gimp-drawable-is-layer-mask",
"Returns whether the drawable is a layer mask.",
"This procedure returns TRUE if the specified drawable is a layer mask.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_is_layer_mask_invoker } }
};
static Argument *
drawable_is_channel_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean channel = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
channel = GIMP_IS_CHANNEL (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, channel);
return return_vals;
}
static GimpProcedure drawable_is_channel_proc =
{
TRUE, TRUE,
"gimp-drawable-is-channel",
"gimp-drawable-is-channel",
"Returns whether the drawable is a channel.",
"This procedure returns TRUE if the specified drawable is a channel.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_is_channel_invoker } }
};
static Argument *
drawable_type_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 type = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
type = gimp_drawable_type (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_enum (&return_vals[1].value, type);
return return_vals;
}
static GimpProcedure drawable_type_proc =
{
TRUE, TRUE,
"gimp-drawable-type",
"gimp-drawable-type",
"Returns the drawable's type.",
"This procedure returns the drawable's type.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_type_invoker } }
};
static Argument *
drawable_type_with_alpha_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 type_with_alpha = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
type_with_alpha = gimp_drawable_type_with_alpha (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_enum (&return_vals[1].value, type_with_alpha);
return return_vals;
}
static GimpProcedure drawable_type_with_alpha_proc =
{
TRUE, TRUE,
"gimp-drawable-type-with-alpha",
"gimp-drawable-type-with-alpha",
"Returns the drawable's type with alpha.",
"This procedure returns the drawable's type as if had an alpha channel. If the type is currently Gray, for instance, the returned type would be GrayA. If the drawable already has an alpha channel, the drawable's type is simply returned.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_type_with_alpha_invoker } }
};
static Argument *
drawable_has_alpha_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean has_alpha = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
has_alpha = gimp_drawable_has_alpha (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, has_alpha);
return return_vals;
}
static GimpProcedure drawable_has_alpha_proc =
{
TRUE, TRUE,
"gimp-drawable-has-alpha",
"gimp-drawable-has-alpha",
"Returns TRUE if the drawable has an alpha channel.",
"This procedure returns whether the specified drawable has an alpha channel. This can only be true for layers, and the associated type will be one of: { RGBA , GRAYA, INDEXEDA }.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_has_alpha_invoker } }
};
static Argument *
drawable_is_rgb_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean is_rgb = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
is_rgb = gimp_drawable_is_rgb (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, is_rgb);
return return_vals;
}
static GimpProcedure drawable_is_rgb_proc =
{
TRUE, TRUE,
"gimp-drawable-is-rgb",
"gimp-drawable-is-rgb",
"Returns whether the drawable is an RGB type.",
"This procedure returns TRUE if the specified drawable is of type { RGB, RGBA }.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_is_rgb_invoker } }
};
static Argument *
drawable_is_gray_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean is_gray = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
is_gray = gimp_drawable_is_gray (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, is_gray);
return return_vals;
}
static GimpProcedure drawable_is_gray_proc =
{
TRUE, TRUE,
"gimp-drawable-is-gray",
"gimp-drawable-is-gray",
"Returns whether the drawable is a grayscale type.",
"This procedure returns TRUE if the specified drawable is of type { Gray, GrayA }.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_is_gray_invoker } }
};
static Argument *
drawable_is_indexed_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean is_indexed = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
is_indexed = gimp_drawable_is_indexed (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, is_indexed);
return return_vals;
}
static GimpProcedure drawable_is_indexed_proc =
{
TRUE, TRUE,
"gimp-drawable-is-indexed",
"gimp-drawable-is-indexed",
"Returns whether the drawable is an indexed type.",
"This procedure returns TRUE if the specified drawable is of type { Indexed, IndexedA }.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_is_indexed_invoker } }
};
static Argument *
drawable_bpp_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 bpp = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
bpp = gimp_drawable_bytes (drawable);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_int (&return_vals[1].value, bpp);
return return_vals;
}
static GimpProcedure drawable_bpp_proc =
{
TRUE, TRUE,
"gimp-drawable-bpp",
"gimp-drawable-bpp",
"Returns the bytes per pixel.",
"This procedure returns the number of bytes per pixel (or the number of channels) for the specified drawable.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_bpp_invoker } }
};
static Argument *
drawable_width_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 width = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
width = gimp_item_width (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_int (&return_vals[1].value, width);
return return_vals;
}
static GimpProcedure drawable_width_proc =
{
TRUE, TRUE,
"gimp-drawable-width",
"gimp-drawable-width",
"Returns the width of the drawable.",
"This procedure returns the specified drawable's width in pixels.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_width_invoker } }
};
static Argument *
drawable_height_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 height = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
height = gimp_item_height (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_int (&return_vals[1].value, height);
return return_vals;
}
static GimpProcedure drawable_height_proc =
{
TRUE, TRUE,
"gimp-drawable-height",
"gimp-drawable-height",
"Returns the height of the drawable.",
"This procedure returns the specified drawable's height in pixels.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_height_invoker } }
};
static Argument *
drawable_offsets_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 offset_x = 0;
gint32 offset_y = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
gimp_item_offsets (GIMP_ITEM (drawable), &offset_x, &offset_y);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
{
g_value_set_int (&return_vals[1].value, offset_x);
g_value_set_int (&return_vals[2].value, offset_y);
}
return return_vals;
}
static GimpProcedure drawable_offsets_proc =
{
TRUE, TRUE,
"gimp-drawable-offsets",
"gimp-drawable-offsets",
"Returns the offsets for the drawable.",
"This procedure returns the specified drawable's offsets. This only makes sense if the drawable is a layer since channels are anchored. The offsets of a channel will be returned as 0.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_offsets_invoker } }
};
static Argument *
drawable_get_image_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
GimpImage *image = NULL;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
image = gimp_item_get_image (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
gimp_value_set_image (&return_vals[1].value, image);
return return_vals;
}
static GimpProcedure drawable_get_image_proc =
{
TRUE, TRUE,
"gimp-drawable-get-image",
"gimp-drawable-get-image",
"Returns the drawable's image.",
"This procedure returns the drawable's image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_get_image_invoker } }
};
static Argument *
drawable_set_image_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
GimpImage *image;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
image = gimp_value_get_image (&args[1].value, gimp);
if (success)
{
if (image != gimp_item_get_image (GIMP_ITEM (drawable)))
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_set_image_proc =
{
TRUE, TRUE,
"gimp-drawable-set-image",
"gimp-drawable-set-image",
"This procedure is deprecated!",
"This procedure is deprecated!",
"",
"",
"",
"NONE",
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_set_image_invoker } }
};
static Argument *
drawable_get_name_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gchar *name = NULL;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (drawable)));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_take_string (&return_vals[1].value, name);
return return_vals;
}
static GimpProcedure drawable_get_name_proc =
{
TRUE, TRUE,
"gimp-drawable-get-name",
"gimp-drawable-get-name",
"Get the name of the specified drawable.",
"This procedure returns the specified drawable's name.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_get_name_invoker } }
};
static Argument *
drawable_set_name_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gchar *name;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
name = (gchar *) g_value_get_string (&args[1].value);
if (success)
{
success = gimp_item_rename (GIMP_ITEM (drawable), name);
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_set_name_proc =
{
TRUE, TRUE,
"gimp-drawable-set-name",
"gimp-drawable-set-name",
"Set the name of the specified drawable.",
"This procedure sets the specified drawable's name.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_set_name_invoker } }
};
static Argument *
drawable_get_visible_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean visible = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
visible = gimp_item_get_visible (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, visible);
return return_vals;
}
static GimpProcedure drawable_get_visible_proc =
{
TRUE, TRUE,
"gimp-drawable-get-visible",
"gimp-drawable-get-visible",
"Get the visibility of the specified drawable.",
"This procedure returns the specified drawable's visibility.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_get_visible_invoker } }
};
static Argument *
drawable_set_visible_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gboolean visible;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
visible = g_value_get_boolean (&args[1].value);
if (success)
{
gimp_item_set_visible (GIMP_ITEM (drawable), visible, TRUE);
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_set_visible_proc =
{
TRUE, TRUE,
"gimp-drawable-set-visible",
"gimp-drawable-set-visible",
"Set the visibility of the specified drawable.",
"This procedure sets the specified drawable's visibility.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_set_visible_invoker } }
};
static Argument *
drawable_get_linked_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean linked = FALSE;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
linked = gimp_item_get_linked (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_boolean (&return_vals[1].value, linked);
return return_vals;
}
static GimpProcedure drawable_get_linked_proc =
{
TRUE, TRUE,
"gimp-drawable-get-linked",
"gimp-drawable-get-linked",
"Get the linked state of the specified drawable.",
"This procedure returns the specified drawable's linked state.",
"Wolfgang Hofer",
"Wolfgang Hofer",
"1998",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_get_linked_invoker } }
};
static Argument *
drawable_set_linked_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gboolean linked;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
linked = g_value_get_boolean (&args[1].value);
if (success)
{
gimp_item_set_linked (GIMP_ITEM (drawable), linked, TRUE);
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_set_linked_proc =
{
TRUE, TRUE,
"gimp-drawable-set-linked",
"gimp-drawable-set-linked",
"Set the linked state of the specified drawable.",
"This procedure sets the specified drawable's linked state.",
"Wolfgang Hofer",
"Wolfgang Hofer",
"1998",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_set_linked_invoker } }
};
static Argument *
drawable_get_tattoo_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 tattoo = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
tattoo = gimp_item_get_tattoo (GIMP_ITEM (drawable));
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_uint (&return_vals[1].value, tattoo);
return return_vals;
}
static GimpProcedure drawable_get_tattoo_proc =
{
TRUE, TRUE,
"gimp-drawable-get-tattoo",
"gimp-drawable-get-tattoo",
"Get the tattoo of the specified drawable.",
"This procedure returns the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.",
"Jay Cox",
"Jay Cox",
"1998",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_get_tattoo_invoker } }
};
static Argument *
drawable_set_tattoo_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 tattoo;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
tattoo = g_value_get_uint (&args[1].value);
if (success)
{
gimp_item_set_tattoo (GIMP_ITEM (drawable), tattoo);
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_set_tattoo_proc =
{
TRUE, TRUE,
"gimp-drawable-set-tattoo",
"gimp-drawable-set-tattoo",
"Set the tattoo of the specified drawable.",
"This procedure sets the specified drawable's tattoo. A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.",
"Jay Cox",
"Jay Cox",
"1998",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_set_tattoo_invoker } }
};
static Argument *
drawable_mask_bounds_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean non_empty = FALSE;
gint32 x1 = 0;
gint32 y1 = 0;
gint32 x2 = 0;
gint32 y2 = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
{
g_value_set_boolean (&return_vals[1].value, non_empty);
g_value_set_int (&return_vals[2].value, x1);
g_value_set_int (&return_vals[3].value, y1);
g_value_set_int (&return_vals[4].value, x2);
g_value_set_int (&return_vals[5].value, y2);
}
return return_vals;
}
static GimpProcedure drawable_mask_bounds_proc =
{
TRUE, TRUE,
"gimp-drawable-mask-bounds",
"gimp-drawable-mask-bounds",
"Find the bounding box of the current selection in relation to the specified drawable.",
"This procedure returns whether there is a selection. If there is one, the upper left and lower righthand corners of its bounding box are returned. These coordinates are specified relative to the drawable's origin, and bounded by the drawable's extents. Please note that the pixel specified by the lower righthand coordinate of the bounding box is not part of the selection. The selection ends at the upper left corner of this pixel. This means the width of the selection can be calculated as (x2 - x1), its height as (y2 - y1). Note that the returned boolean does NOT correspond with the returned region being empty or not, it always returns whether the selection is non_empty. See gimp_drawable_mask_intersect() for a boolean return value which is more useful in most cases.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_mask_bounds_invoker } }
};
static Argument *
drawable_mask_intersect_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gboolean non_empty = FALSE;
gint32 x = 0;
gint32 y = 0;
gint32 width = 0;
gint32 height = 0;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
non_empty = gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height);
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
{
g_value_set_boolean (&return_vals[1].value, non_empty);
g_value_set_int (&return_vals[2].value, x);
g_value_set_int (&return_vals[3].value, y);
g_value_set_int (&return_vals[4].value, width);
g_value_set_int (&return_vals[5].value, height);
}
return return_vals;
}
static GimpProcedure drawable_mask_intersect_proc =
{
TRUE, TRUE,
"gimp-drawable-mask-intersect",
"gimp-drawable-mask-intersect",
"Find the bounding box of the current selection in relation to the specified drawable.",
"This procedure returns whether there is an intersection between the drawable and the selection. Unlike gimp_drawable_mask_bounds(), the intersection's bounds are returned as x, y, width, height. If there is no selection this function returns TRUE and the returned bounds are the extents of the whole drawable.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_mask_intersect_invoker } }
};
static Argument *
drawable_merge_shadow_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gboolean undo;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
undo = g_value_get_boolean (&args[1].value);
if (success)
{
if (gimp_item_is_attached (GIMP_ITEM (drawable)))
{
gchar *undo_desc = NULL;
if (gimp->current_plug_in)
undo_desc = plug_in_get_undo_desc (gimp->current_plug_in);
if (! undo_desc)
undo_desc = g_strdup (_("Plug-In"));
gimp_drawable_merge_shadow (drawable, undo, undo_desc);
g_free (undo_desc);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_merge_shadow_proc =
{
TRUE, TRUE,
"gimp-drawable-merge-shadow",
"gimp-drawable-merge-shadow",
"Merge the shadow buffer with the specified drawable.",
"This procedure combines the contents of the image's shadow buffer (for temporary processing) with the specified drawable. The \"undo\" parameter specifies whether to add an undo step for the operation. Requesting no undo is useful for such applications as 'auto-apply'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_merge_shadow_invoker } }
};
static Argument *
drawable_update_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 x;
gint32 y;
gint32 width;
gint32 height;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
x = g_value_get_int (&args[1].value);
y = g_value_get_int (&args[2].value);
width = g_value_get_int (&args[3].value);
height = g_value_get_int (&args[4].value);
if (success)
{
gimp_drawable_update (drawable, x, y, width, height);
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_update_proc =
{
TRUE, TRUE,
"gimp-drawable-update",
"gimp-drawable-update",
"Update the specified region of the drawable.",
"This procedure updates the specified region of the drawable. The (x, y) coordinate pair is relative to the drawable's origin, not to the image origin. Therefore, the entire drawable can be updated using (0, 0, width, height).",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_update_invoker } }
};
static Argument *
drawable_get_pixel_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 x_coord;
gint32 y_coord;
gint32 num_channels = 0;
guint8 *pixel = NULL;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
x_coord = g_value_get_int (&args[1].value);
y_coord = g_value_get_int (&args[2].value);
if (success)
{
if (x_coord < gimp_item_width (GIMP_ITEM (drawable)) &&
y_coord < gimp_item_height (GIMP_ITEM (drawable)))
{
Tile *tile;
guint8 *p;
gint b;
num_channels = gimp_drawable_bytes (drawable);
pixel = g_new (guint8, num_channels);
tile = tile_manager_get_tile (gimp_drawable_data (drawable),
x_coord, y_coord,
TRUE, TRUE);
x_coord %= TILE_WIDTH;
y_coord %= TILE_HEIGHT;
p = tile_data_pointer (tile, x_coord, y_coord);
for (b = 0; b < num_channels; b++)
pixel[b] = p[b];
tile_release (tile, FALSE);
}
else
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
{
g_value_set_int (&return_vals[1].value, num_channels);
g_value_set_pointer (&return_vals[2].value, pixel);
}
return return_vals;
}
static GimpProcedure drawable_get_pixel_proc =
{
TRUE, TRUE,
"gimp-drawable-get-pixel",
"gimp-drawable-get-pixel",
"Gets the value of the pixel at the specified coordinates.",
"This procedure gets the pixel value at the specified coordinates. The 'num_channels' argument must always be equal to the bytes-per-pixel value for the specified drawable.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_get_pixel_invoker } }
};
static Argument *
drawable_set_pixel_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 x_coord;
gint32 y_coord;
gint32 num_channels;
guint8 *pixel;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
x_coord = g_value_get_int (&args[1].value);
y_coord = g_value_get_int (&args[2].value);
num_channels = g_value_get_int (&args[3].value);
pixel = g_value_get_pointer (&args[4].value);
if (success)
{
if (x_coord < gimp_item_width (GIMP_ITEM (drawable)) &&
y_coord < gimp_item_height (GIMP_ITEM (drawable)) &&
num_channels == gimp_drawable_bytes (drawable))
{
Tile *tile;
guint8 *p;
gint b;
tile = tile_manager_get_tile (gimp_drawable_data (drawable),
x_coord, y_coord,
TRUE, TRUE);
x_coord %= TILE_WIDTH;
y_coord %= TILE_HEIGHT;
p = tile_data_pointer (tile, x_coord, y_coord);
for (b = 0; b < num_channels; b++)
*p++ = *pixel++;
tile_release (tile, TRUE);
}
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_set_pixel_proc =
{
TRUE, TRUE,
"gimp-drawable-set-pixel",
"gimp-drawable-set-pixel",
"Sets the value of the pixel at the specified coordinates.",
"This procedure sets the pixel value at the specified coordinates. The 'num_channels' argument must always be equal to the bytes-per-pixel value for the specified drawable. Note that this function is not undoable, you should use it only on drawables you just created yourself.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_set_pixel_invoker } }
};
static Argument *
drawable_fill_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 fill_type;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
fill_type = g_value_get_enum (&args[1].value);
if (success)
{
gimp_drawable_fill_by_type (drawable, context, (GimpFillType) fill_type);
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_fill_proc =
{
TRUE, TRUE,
"gimp-drawable-fill",
"gimp-drawable-fill",
"Fill the drawable with the specified fill mode.",
"This procedure fills the drawable with the fill mode. If the fill mode is foreground the current foreground color is used. If the fill mode is background, the current background color is used. If the fill type is white, then white is used. Transparent fill only affects layers with an alpha channel, in which case the alpha channel is set to transparent. If the drawable has no alpha channel, it is filled to white. No fill leaves the drawable's contents undefined. This procedure is unlike the bucket fill tool because it fills regardless of a selection",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_fill_invoker } }
};
static Argument *
drawable_offset_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gboolean wrap_around;
gint32 fill_type;
gint32 offset_x;
gint32 offset_y;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
wrap_around = g_value_get_boolean (&args[1].value);
fill_type = g_value_get_enum (&args[2].value);
offset_x = g_value_get_int (&args[3].value);
offset_y = g_value_get_int (&args[4].value);
if (success)
{
if (gimp_item_is_attached (GIMP_ITEM (drawable)))
gimp_drawable_offset (drawable, context, wrap_around, fill_type,
offset_x, offset_y);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_offset_proc =
{
TRUE, TRUE,
"gimp-drawable-offset",
"gimp-drawable-offset",
"Offset the drawable by the specified amounts in the X and Y directions",
"This procedure offsets the specified drawable by the amounts specified by 'offset_x' and 'offset_y'. If 'wrap_around' is set to TRUE, then portions of the drawable which are offset out of bounds are wrapped around. Alternatively, the undefined regions of the drawable can be filled with transparency or the background color, as specified by the 'fill_type' parameter.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_offset_invoker } }
};
static Argument *
drawable_thumbnail_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 width;
gint32 height;
gint32 actual_width = 0;
gint32 actual_height = 0;
gint32 bpp = 0;
gint32 thumbnail_data_count = 0;
guint8 *thumbnail_data = NULL;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
width = g_value_get_int (&args[1].value);
height = g_value_get_int (&args[2].value);
if (success)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
TempBuf *buf;
gint dwidth, dheight;
/* Adjust the width/height ratio */
dwidth = gimp_item_width (GIMP_ITEM (drawable));
dheight = gimp_item_height (GIMP_ITEM (drawable));
if (dwidth > dheight)
height = MAX (1, (width * dheight) / dwidth);
else
width = MAX (1, (height * dwidth) / dheight);
if (image->gimp->config->layer_previews)
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable),
width, height);
else
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
width, height,
gimp_drawable_has_alpha (drawable) ?
4 : 3);
if (buf)
{
actual_width = buf->width;
actual_height = buf->height;
bpp = buf->bytes;
thumbnail_data_count = actual_width * actual_height * bpp;
thumbnail_data = g_memdup (temp_buf_data (buf),
thumbnail_data_count);
temp_buf_free (buf);
}
else
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
{
g_value_set_int (&return_vals[1].value, actual_width);
g_value_set_int (&return_vals[2].value, actual_height);
g_value_set_int (&return_vals[3].value, bpp);
g_value_set_int (&return_vals[4].value, thumbnail_data_count);
g_value_set_pointer (&return_vals[5].value, thumbnail_data);
}
return return_vals;
}
static GimpProcedure drawable_thumbnail_proc =
{
TRUE, TRUE,
"gimp-drawable-thumbnail",
"gimp-drawable-thumbnail",
"Get a thumbnail of a drawable.",
"This function gets data from which a thumbnail of a drawable preview can be created. Maximum x or y dimension is 512 pixels. The pixels are returned in RGB[A] or GRAY[A] format. The bpp return value gives the number of bytes in the image.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_thumbnail_invoker } }
};
static Argument *
drawable_sub_thumbnail_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_vals;
GimpDrawable *drawable;
gint32 src_x;
gint32 src_y;
gint32 src_width;
gint32 src_height;
gint32 dest_width;
gint32 dest_height;
gint32 width = 0;
gint32 height = 0;
gint32 bpp = 0;
gint32 thumbnail_data_count = 0;
guint8 *thumbnail_data = NULL;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
src_x = g_value_get_int (&args[1].value);
src_y = g_value_get_int (&args[2].value);
src_width = g_value_get_int (&args[3].value);
src_height = g_value_get_int (&args[4].value);
dest_width = g_value_get_int (&args[5].value);
dest_height = g_value_get_int (&args[6].value);
if (success)
{
if ((src_x + src_width) <= gimp_item_width (GIMP_ITEM (drawable)) &&
(src_y + src_height) <= gimp_item_height (GIMP_ITEM (drawable)))
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
TempBuf *buf;
if (image->gimp->config->layer_previews)
buf = gimp_drawable_get_sub_preview (drawable,
src_x, src_y,
src_width, src_height,
dest_width, dest_height);
else
buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable),
dest_width, dest_height,
gimp_drawable_has_alpha (drawable) ?
4 : 3);
if (buf)
{
width = buf->width;
height = buf->height;
bpp = buf->bytes;
thumbnail_data_count = buf->height * buf->width * buf->bytes;
thumbnail_data = g_memdup (temp_buf_data (buf),
thumbnail_data_count);
temp_buf_free (buf);
}
else
success = FALSE;
}
else
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
{
g_value_set_int (&return_vals[1].value, width);
g_value_set_int (&return_vals[2].value, height);
g_value_set_int (&return_vals[3].value, bpp);
g_value_set_int (&return_vals[4].value, thumbnail_data_count);
g_value_set_pointer (&return_vals[5].value, thumbnail_data);
}
return return_vals;
}
static GimpProcedure drawable_sub_thumbnail_proc =
{
TRUE, TRUE,
"gimp-drawable-sub-thumbnail",
"gimp-drawable-sub-thumbnail",
"Get a thumbnail of a sub-area of a drawable drawable.",
"This function gets data from which a thumbnail of a drawable preview can be created. Maximum x or y dimension is 512 pixels. The pixels are returned in RGB[A] or GRAY[A] format. The bpp return value gives the number of bytes in the image.",
"Michael Natterer <mitch@gimp.org>",
"Michael Natterer",
"2004",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_sub_thumbnail_invoker } }
};
static Argument *
drawable_foreground_extract_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 mode;
GimpDrawable *mask;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
mode = g_value_get_enum (&args[1].value);
mask = (GimpDrawable *) gimp_value_get_item (&args[2].value, gimp, GIMP_TYPE_DRAWABLE);
if (success)
{
if (gimp_item_is_attached (GIMP_ITEM (drawable)))
gimp_drawable_foreground_extract (drawable, mode, mask, progress);
else
success = FALSE;
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure drawable_foreground_extract_proc =
{
TRUE, TRUE,
"gimp-drawable-foreground-extract",
"gimp-drawable-foreground-extract",
"Extract the foreground of a drawable using a given trimap.",
"Image Segmentation by Uniform Color Clustering, see http://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf",
"Gerald Friedland <fland@inf.fu-berlin.de>, Kristian Jantz <jantz@inf.fu-berlin.de>, Sven Neumann <sven@gimp.org>",
"Gerald Friedland",
"2005",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { drawable_foreground_extract_invoker } }
};