gimp/app/pdb/paint_tools_cmds.c
Michael Natterer 03c28ec7fc app/pdb/pdb-types.h renamed struct Argument to GimpArgument and struct
2006-03-31  Michael Natterer  <mitch@gimp.org>

	* app/pdb/pdb-types.h
	* app/pdb/gimpargument.h: renamed struct Argument to GimpArgument
	and struct ProcArg to GimpArgumentSpec.

	* app/batch.c
	* app/actions/plug-in-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimppdbprogress.c
	* app/dialogs/about-dialog.c
	* app/file/file-open.c
	* app/file/file-save.c
	* app/pdb/gimpargument.c
	* app/pdb/gimpprocedure.[ch]
	* app/pdb/procedural-db-query.c
	* app/pdb/procedural_db.[ch]
	* app/plug-in/plug-in-message.c
	* app/plug-in/plug-in-params.[ch]
	* app/plug-in/plug-in-proc-frame.h
	* app/plug-in/plug-in-progress.c
	* app/plug-in/plug-in-rc.c
	* app/plug-in/plug-in-run.[ch]
	* app/plug-in/plug-ins.c
	* app/widgets/gimpbrushselect.c
	* app/widgets/gimpfontselect.c
	* app/widgets/gimpgradientselect.c
	* app/widgets/gimphelp.c
	* app/widgets/gimppaletteselect.c
	* app/widgets/gimppatternselect.c
	* app/widgets/gimppdbdialog.[ch]
	* app/xcf/xcf.c
	* tools/pdbgen/app.pl
	* tools/pdbgen/pdb/fileops.pdb
	* tools/pdbgen/pdb/procedural_db.pdb: changed accordingly.

	* app/pdb/*_cmds.c: regenerated.
2006-03-31 20:16:22 +00:00

1479 lines
62 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 "libgimpmath/gimpmath.h"
#include "pdb-types.h"
#include "gimpargument.h"
#include "gimpprocedure.h"
#include "procedural_db.h"
#include "core/gimpparamspecs.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpdrawable.h"
#include "core/gimppaintinfo.h"
#include "paint/gimppaintcore-stroke.h"
#include "paint/gimppaintcore.h"
#include "paint/gimppaintoptions.h"
static GimpProcedure airbrush_proc;
static GimpProcedure airbrush_default_proc;
static GimpProcedure clone_proc;
static GimpProcedure clone_default_proc;
static GimpProcedure convolve_proc;
static GimpProcedure convolve_default_proc;
static GimpProcedure dodgeburn_proc;
static GimpProcedure dodgeburn_default_proc;
static GimpProcedure eraser_proc;
static GimpProcedure eraser_default_proc;
static GimpProcedure paintbrush_proc;
static GimpProcedure paintbrush_default_proc;
static GimpProcedure pencil_proc;
static GimpProcedure smudge_proc;
static GimpProcedure smudge_default_proc;
void
register_paint_tools_procs (Gimp *gimp)
{
GimpProcedure *procedure;
/*
* airbrush
*/
procedure = gimp_procedure_init (&airbrush_proc, 4, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("pressure",
"pressure",
"The pressure of the airbrush strokes (0 <= pressure <= 100)",
0, 100, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* airbrush_default
*/
procedure = gimp_procedure_init (&airbrush_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* clone
*/
procedure = gimp_procedure_init (&clone_proc, 7, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("src-drawable",
"src drawable",
"The source drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("clone-type",
"clone type",
"The type of clone: { GIMP_IMAGE_CLONE (0), GIMP_PATTERN_CLONE (1) }",
GIMP_TYPE_CLONE_TYPE,
GIMP_IMAGE_CLONE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("src-x",
"src x",
"The x coordinate in the source image",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("src-y",
"src y",
"The y coordinate in the source image",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* clone_default
*/
procedure = gimp_procedure_init (&clone_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* convolve
*/
procedure = gimp_procedure_init (&convolve_proc, 5, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("pressure",
"pressure",
"The pressure (0 <= pressure <= 100)",
0, 100, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("convolve-type",
"convolve type",
"Convolve type: { GIMP_BLUR_CONVOLVE (0), GIMP_SHARPEN_CONVOLVE (1) }",
GIMP_TYPE_CONVOLVE_TYPE,
GIMP_BLUR_CONVOLVE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* convolve_default
*/
procedure = gimp_procedure_init (&convolve_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* dodgeburn
*/
procedure = gimp_procedure_init (&dodgeburn_proc, 6, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("exposure",
"exposure",
"The exposure of the strokes (0 <= exposure <= 100)",
0, 100, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("dodgeburn-type",
"dodgeburn type",
"The type either dodge or burn: { GIMP_DODGE (0), GIMP_BURN (1) }",
GIMP_TYPE_DODGE_BURN_TYPE,
GIMP_DODGE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("dodgeburn-mode",
"dodgeburn mode",
"The mode: { GIMP_SHADOWS (0), GIMP_MIDTONES (1), GIMP_HIGHLIGHTS (2) }",
GIMP_TYPE_TRANSFER_MODE,
GIMP_SHADOWS,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* dodgeburn_default
*/
procedure = gimp_procedure_init (&dodgeburn_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* eraser
*/
procedure = gimp_procedure_init (&eraser_proc, 5, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("hardness",
"hardness",
"{ GIMP_BRUSH_HARD (0), GIMP_BRUSH_SOFT (1) }",
GIMP_TYPE_BRUSH_APPLICATION_MODE,
GIMP_BRUSH_HARD,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("method",
"method",
"{ GIMP_PAINT_CONSTANT (0), GIMP_PAINT_INCREMENTAL (1) }",
GIMP_TYPE_PAINT_APPLICATION_MODE,
GIMP_PAINT_CONSTANT,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* eraser_default
*/
procedure = gimp_procedure_init (&eraser_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* paintbrush
*/
procedure = gimp_procedure_init (&paintbrush_proc, 6, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("fade-out",
"fade out",
"Fade out parameter (0 <= fade_out)",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_enum ("method",
"method",
"{ GIMP_PAINT_CONSTANT (0), GIMP_PAINT_INCREMENTAL (1) }",
GIMP_TYPE_PAINT_APPLICATION_MODE,
GIMP_PAINT_CONSTANT,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("gradient-length",
"gradient length",
"Length of gradient to draw (0 <= gradient_length)",
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* paintbrush_default
*/
procedure = gimp_procedure_init (&paintbrush_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* pencil
*/
procedure = gimp_procedure_init (&pencil_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* smudge
*/
procedure = gimp_procedure_init (&smudge_proc, 4, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOAT,
g_param_spec_double ("pressure",
"pressure",
"The pressure of the smudge strokes (0 <= pressure <= 100)",
0, 100, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
/*
* smudge_default
*/
procedure = gimp_procedure_init (&smudge_default_proc, 3, 0);
gimp_procedure_add_argument (procedure,
GIMP_PDB_DRAWABLE,
gimp_param_spec_item_id ("drawable",
"drawable",
"The affected drawable",
gimp,
GIMP_TYPE_DRAWABLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_INT32,
g_param_spec_int ("num-strokes",
"num strokes",
"Number of stroke control points (count each coordinate as 2 points)",
2, G_MAXINT32, 2,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
GIMP_PDB_FLOATARRAY,
g_param_spec_pointer ("strokes",
"strokes",
"Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
GIMP_PARAM_READWRITE));
procedural_db_register (gimp, procedure);
}
static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
static gboolean
paint_tools_stroke (Gimp *gimp,
GimpContext *context,
GimpPaintOptions *options,
GimpDrawable *drawable,
gint n_strokes,
gdouble *strokes,
const gchar *first_property_name,
...)
{
GimpPaintCore *core;
GimpCoords *coords;
gboolean retval;
gint i;
va_list args;
n_strokes /= 2; /* #doubles -> #points */
/* undefine the paint-relevant context properties and get them
* from the current context
*/
gimp_context_define_properties (GIMP_CONTEXT (options),
GIMP_CONTEXT_PAINT_PROPS_MASK,
FALSE);
gimp_context_set_parent (GIMP_CONTEXT (options), context);
va_start (args, first_property_name);
core = GIMP_PAINT_CORE (g_object_new_valist (options->paint_info->paint_type,
first_property_name, args));
va_end (args);
coords = g_new (GimpCoords, n_strokes);
for (i = 0; i < n_strokes; i++)
{
coords[i] = default_coords;
coords[i].x = strokes[2 * i];
coords[i].y = strokes[2 * i + 1];
}
retval = gimp_paint_core_stroke (core, drawable, options,
coords, n_strokes);
g_free (coords);
g_object_unref (core);
g_object_unref (options);
return retval;
}
static GimpArgument *
airbrush_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gdouble pressure;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
pressure = g_value_get_double (&args[1].value);
num_strokes = g_value_get_int (&args[2].value);
strokes = g_value_get_pointer (&args[3].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-airbrush");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"pressure", pressure,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure airbrush_proc =
{
TRUE, TRUE,
"gimp-airbrush",
"gimp-airbrush",
"Paint in the current brush with varying pressure. Paint application is time-dependent.",
"This tool simulates the use of an airbrush. Paint pressure represents the relative intensity of the paint application. High pressure results in a thicker layer of paint while low pressure results in a thinner layer.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { airbrush_invoker } }
};
static GimpArgument *
airbrush_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-airbrush");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure airbrush_default_proc =
{
TRUE, TRUE,
"gimp-airbrush-default",
"gimp-airbrush-default",
"Paint in the current brush with varying pressure. Paint application is time-dependent.",
"This tool simulates the use of an airbrush. It is similar to gimp_airbrush except that the pressure is derived from the airbrush tools options box. It the option has not been set the default for the option will be used.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { airbrush_default_invoker } }
};
static GimpArgument *
clone_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
GimpDrawable *src_drawable;
gint32 clone_type;
gdouble src_x;
gdouble src_y;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
src_drawable = (GimpDrawable *) gimp_value_get_item (&args[1].value, gimp, GIMP_TYPE_DRAWABLE);
clone_type = g_value_get_enum (&args[2].value);
src_x = g_value_get_double (&args[3].value);
src_y = g_value_get_double (&args[4].value);
num_strokes = g_value_get_int (&args[5].value);
strokes = g_value_get_pointer (&args[6].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-clone");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"clone-type", clone_type,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes,
"src-drawable", src_drawable,
"src-x", src_x,
"src-y", src_y,
NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure clone_proc =
{
TRUE, TRUE,
"gimp-clone",
"gimp-clone",
"Clone from the source to the dest drawable using the current brush",
"This tool clones (copies) from the source drawable starting at the specified source coordinates to the dest drawable. If the \"clone_type\" argument is set to PATTERN-CLONE, then the current pattern is used as the source and the \"src_drawable\" argument is ignored. Pattern cloning assumes a tileable pattern and mods the sum of the src coordinates and subsequent stroke offsets with the width and height of the pattern. For image cloning, if the sum of the src coordinates and subsequent stroke offsets exceeds the extents of the src drawable, then no paint is transferred. The clone tool is capable of transforming between any image types including RGB->Indexed--although converting from any type to indexed is significantly slower.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { clone_invoker } }
};
static GimpArgument *
clone_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-clone");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure clone_default_proc =
{
TRUE, TRUE,
"gimp-clone-default",
"gimp-clone-default",
"Clone from the source to the dest drawable using the current brush",
"This tool clones (copies) from the source drawable starting at the specified source coordinates to the dest drawable. This function performs exactly the same as the gimp_clone function except that the tools arguments are obtained from the clones option dialog. It this dialog has not been activated then the dialogs default values will be used.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { clone_default_invoker } }
};
static GimpArgument *
convolve_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gdouble pressure;
gint32 convolve_type;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
pressure = g_value_get_double (&args[1].value);
convolve_type = g_value_get_enum (&args[2].value);
num_strokes = g_value_get_int (&args[3].value);
strokes = g_value_get_pointer (&args[4].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-convolve");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"type", convolve_type,
"rate", pressure,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure convolve_proc =
{
TRUE, TRUE,
"gimp-convolve",
"gimp-convolve",
"Convolve (Blur, Sharpen) using the current brush.",
"This tool convolves the specified drawable with either a sharpening or blurring kernel. The pressure parameter controls the magnitude of the operation. Like the paintbrush, this tool linearly interpolates between the specified stroke coordinates.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { convolve_invoker } }
};
static GimpArgument *
convolve_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-convolve");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure convolve_default_proc =
{
TRUE, TRUE,
"gimp-convolve-default",
"gimp-convolve-default",
"Convolve (Blur, Sharpen) using the current brush.",
"This tool convolves the specified drawable with either a sharpening or blurring kernel. This function performs exactly the same as the gimp_convolve function except that the tools arguments are obtained from the convolve option dialog. It this dialog has not been activated then the dialogs default values will be used.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { convolve_default_invoker } }
};
static GimpArgument *
dodgeburn_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gdouble exposure;
gint32 dodgeburn_type;
gint32 dodgeburn_mode;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
exposure = g_value_get_double (&args[1].value);
dodgeburn_type = g_value_get_enum (&args[2].value);
dodgeburn_mode = g_value_get_enum (&args[3].value);
num_strokes = g_value_get_int (&args[4].value);
strokes = g_value_get_pointer (&args[5].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-dodge-burn");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"type", dodgeburn_type,
"mode", dodgeburn_mode,
"exposure", exposure,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure dodgeburn_proc =
{
TRUE, TRUE,
"gimp-dodgeburn",
"gimp-dodgeburn",
"Dodgeburn image with varying exposure.",
"Dodgeburn. More details here later.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { dodgeburn_invoker } }
};
static GimpArgument *
dodgeburn_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-dodge-burn");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure dodgeburn_default_proc =
{
TRUE, TRUE,
"gimp-dodgeburn-default",
"gimp-dodgeburn-default",
"Dodgeburn image with varying exposure. This is the same as the gimp_dodgeburn function except that the exposure, type and mode are taken from the tools option dialog. If the dialog has not been activated then the defaults as used by the dialog will be used.",
"Dodgeburn. More details here later.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { dodgeburn_default_invoker } }
};
static GimpArgument *
eraser_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
gint32 hardness;
gint32 method;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
hardness = g_value_get_enum (&args[3].value);
method = g_value_get_enum (&args[4].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-eraser");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"application-mode", method,
"hard", hardness,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure eraser_proc =
{
TRUE, TRUE,
"gimp-eraser",
"gimp-eraser",
"Erase using the current brush.",
"This tool erases using the current brush mask. If the specified drawable contains an alpha channel, then the erased pixels will become transparent. Otherwise, the eraser tool replaces the contents of the drawable with the background color. Like paintbrush, this tool linearly interpolates between the specified stroke coordinates.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { eraser_invoker } }
};
static GimpArgument *
eraser_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-eraser");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure eraser_default_proc =
{
TRUE, TRUE,
"gimp-eraser-default",
"gimp-eraser-default",
"Erase using the current brush.",
"This tool erases using the current brush mask. This function performs exactly the same as the gimp_eraser function except that the tools arguments are obtained from the eraser option dialog. It this dialog has not been activated then the dialogs default values will be used.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { eraser_default_invoker } }
};
static GimpArgument *
paintbrush_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gdouble fade_out;
gint32 num_strokes;
gdouble *strokes;
gint32 method;
gdouble gradient_length;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
fade_out = g_value_get_double (&args[1].value);
num_strokes = g_value_get_int (&args[2].value);
strokes = g_value_get_pointer (&args[3].value);
method = g_value_get_enum (&args[4].value);
gradient_length = g_value_get_double (&args[5].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-paintbrush");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"application-mode", method,
"use-fade", fade_out > 0.0,
"fade-length", fade_out,
"use-gradient", gradient_length > 0.0,
"gradient-length", gradient_length,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure paintbrush_proc =
{
TRUE, TRUE,
"gimp-paintbrush",
"gimp-paintbrush",
"Paint in the current brush with optional fade out parameter and pull colors from a gradient.",
"This tool is the standard paintbrush. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The \"fade_out\" parameter is measured in pixels and allows the brush stroke to linearly fall off. The pressure is set to the maximum at the beginning of the stroke. As the distance of the stroke nears the fade_out value, the pressure will approach zero. The gradient_length is the distance to spread the gradient over. It is measured in pixels. If the gradient_length is 0, no gradient is used.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { paintbrush_invoker } }
};
static GimpArgument *
paintbrush_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-paintbrush");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure paintbrush_default_proc =
{
TRUE, TRUE,
"gimp-paintbrush-default",
"gimp-paintbrush-default",
"Paint in the current brush. The fade out parameter and pull colors from a gradient parameter are set from the paintbrush options dialog. If this dialog has not been activated then the dialog defaults will be used.",
"This tool is similar to the standard paintbrush. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The \"fade_out\" parameter is measured in pixels and allows the brush stroke to linearly fall off (value obtained from the option dialog). The pressure is set to the maximum at the beginning of the stroke. As the distance of the stroke nears the fade_out value, the pressure will approach zero. The gradient_length (value obtained from the option dialog) is the distance to spread the gradient over. It is measured in pixels. If the gradient_length is 0, no gradient is used.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { paintbrush_default_invoker } }
};
static GimpArgument *
pencil_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-pencil");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure pencil_proc =
{
TRUE, TRUE,
"gimp-pencil",
"gimp-pencil",
"Paint in the current brush without sub-pixel sampling.",
"This tool is the standard pencil. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The brush mask is treated as though it contains only black and white values. Any value below half is treated as black; any above half, as white.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { pencil_invoker } }
};
static GimpArgument *
smudge_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gdouble pressure;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
pressure = g_value_get_double (&args[1].value);
num_strokes = g_value_get_int (&args[2].value);
strokes = g_value_get_pointer (&args[3].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-smudge");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
g_object_set (options,
"rate", pressure,
NULL);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure smudge_proc =
{
TRUE, TRUE,
"gimp-smudge",
"gimp-smudge",
"Smudge image with varying pressure.",
"This tool simulates a smudge using the current brush. High pressure results in a greater smudge of paint while low pressure results in a lesser smudge.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { smudge_invoker } }
};
static GimpArgument *
smudge_default_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
GimpArgument *args)
{
gboolean success = TRUE;
GimpDrawable *drawable;
gint32 num_strokes;
gdouble *strokes;
drawable = (GimpDrawable *) gimp_value_get_item (&args[0].value, gimp, GIMP_TYPE_DRAWABLE);
num_strokes = g_value_get_int (&args[1].value);
strokes = g_value_get_pointer (&args[2].value);
if (success)
{
GimpPaintInfo *info = (GimpPaintInfo *)
gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-smudge");
success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
if (success)
{
GimpPaintOptions *options = gimp_paint_options_new (info);
success = paint_tools_stroke (gimp, context, options, drawable,
num_strokes, strokes, NULL);
}
}
return gimp_procedure_get_return_values (procedure, success);
}
static GimpProcedure smudge_default_proc =
{
TRUE, TRUE,
"gimp-smudge-default",
"gimp-smudge-default",
"Smudge image with varying pressure.",
"This tool simulates a smudge using the current brush. It behaves exactly the same as gimp_smudge except that the pressure value is taken from the smudge tool options or the options default if the tools option dialog has not been activated.",
"Andy Thomas",
"Andy Thomas",
"1999",
NULL,
GIMP_INTERNAL,
0, NULL, 0, NULL,
{ { smudge_default_invoker } }
};