~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/pdb/paint_tools_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
26
26
#include "libgimpmath/gimpmath.h"
27
27
 
28
28
#include "pdb-types.h"
29
 
#include "procedural_db.h"
 
29
#include "gimppdb.h"
 
30
#include "gimpprocedure.h"
 
31
#include "core/gimpparamspecs.h"
30
32
 
31
33
#include "core/gimp.h"
32
34
#include "core/gimpcontainer.h"
33
35
#include "core/gimpdrawable.h"
34
36
#include "core/gimppaintinfo.h"
35
37
#include "paint/gimppaintcore-stroke.h"
 
38
#include "paint/gimppaintcore.h"
36
39
#include "paint/gimppaintoptions.h"
37
40
 
38
 
static ProcRecord airbrush_proc;
39
 
static ProcRecord airbrush_default_proc;
40
 
static ProcRecord clone_proc;
41
 
static ProcRecord clone_default_proc;
42
 
static ProcRecord convolve_proc;
43
 
static ProcRecord convolve_default_proc;
44
 
static ProcRecord dodgeburn_proc;
45
 
static ProcRecord dodgeburn_default_proc;
46
 
static ProcRecord eraser_proc;
47
 
static ProcRecord eraser_default_proc;
48
 
static ProcRecord paintbrush_proc;
49
 
static ProcRecord paintbrush_default_proc;
50
 
static ProcRecord pencil_proc;
51
 
static ProcRecord smudge_proc;
52
 
static ProcRecord smudge_default_proc;
53
 
 
54
 
void
55
 
register_paint_tools_procs (Gimp *gimp)
56
 
{
57
 
  procedural_db_register (gimp, &airbrush_proc);
58
 
  procedural_db_register (gimp, &airbrush_default_proc);
59
 
  procedural_db_register (gimp, &clone_proc);
60
 
  procedural_db_register (gimp, &clone_default_proc);
61
 
  procedural_db_register (gimp, &convolve_proc);
62
 
  procedural_db_register (gimp, &convolve_default_proc);
63
 
  procedural_db_register (gimp, &dodgeburn_proc);
64
 
  procedural_db_register (gimp, &dodgeburn_default_proc);
65
 
  procedural_db_register (gimp, &eraser_proc);
66
 
  procedural_db_register (gimp, &eraser_default_proc);
67
 
  procedural_db_register (gimp, &paintbrush_proc);
68
 
  procedural_db_register (gimp, &paintbrush_default_proc);
69
 
  procedural_db_register (gimp, &pencil_proc);
70
 
  procedural_db_register (gimp, &smudge_proc);
71
 
  procedural_db_register (gimp, &smudge_default_proc);
72
 
}
 
41
#include "internal_procs.h"
 
42
 
 
43
 
 
44
static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
73
45
 
74
46
static gboolean
75
47
paint_tools_stroke (Gimp             *gimp,
77
49
                    GimpPaintOptions *options,
78
50
                    GimpDrawable     *drawable,
79
51
                    gint              n_strokes,
80
 
                    gdouble          *strokes)
 
52
                    const gdouble    *strokes,
 
53
                    const gchar      *first_property_name,
 
54
                    ...)
81
55
{
82
56
  GimpPaintCore *core;
83
57
  GimpCoords    *coords;
84
58
  gboolean       retval;
85
59
  gint           i;
 
60
  va_list        args;
 
61
 
 
62
  n_strokes /= 2;  /* #doubles -> #points */
86
63
 
87
64
  /*  undefine the paint-relevant context properties and get them
88
65
   *  from the current context
92
69
                                  FALSE);
93
70
  gimp_context_set_parent (GIMP_CONTEXT (options), context);
94
71
 
95
 
  core = g_object_new (options->paint_info->paint_type, NULL);
 
72
  va_start (args, first_property_name);
 
73
  core = GIMP_PAINT_CORE (g_object_new_valist (options->paint_info->paint_type,
 
74
                                               first_property_name, args));
 
75
  va_end (args);
96
76
 
97
77
  coords = g_new (GimpCoords, n_strokes);
98
78
 
99
79
  for (i = 0; i < n_strokes; i++)
100
80
    {
101
 
      coords[i].x        = strokes[2 * i];
102
 
      coords[i].y        = strokes[2 * i + 1];
103
 
      coords[i].pressure = GIMP_COORDS_DEFAULT_PRESSURE;
104
 
      coords[i].xtilt    = GIMP_COORDS_DEFAULT_TILT;
105
 
      coords[i].ytilt    = GIMP_COORDS_DEFAULT_TILT;
106
 
      coords[i].wheel    = GIMP_COORDS_DEFAULT_WHEEL;
 
81
      coords[i]   = default_coords;
 
82
      coords[i].x = strokes[2 * i];
 
83
      coords[i].y = strokes[2 * i + 1];
107
84
    }
108
85
 
109
86
  retval = gimp_paint_core_stroke (core, drawable, options,
117
94
  return retval;
118
95
}
119
96
 
120
 
static Argument *
121
 
airbrush_invoker (Gimp         *gimp,
122
 
                  GimpContext  *context,
123
 
                  GimpProgress *progress,
124
 
                  Argument     *args)
 
97
static GValueArray *
 
98
airbrush_invoker (GimpProcedure     *procedure,
 
99
                  Gimp              *gimp,
 
100
                  GimpContext       *context,
 
101
                  GimpProgress      *progress,
 
102
                  const GValueArray *args)
125
103
{
126
104
  gboolean success = TRUE;
127
105
  GimpDrawable *drawable;
128
106
  gdouble pressure;
129
107
  gint32 num_strokes;
130
 
  gdouble *strokes;
131
 
 
132
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
133
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
134
 
    success = FALSE;
135
 
 
136
 
  pressure = args[1].value.pdb_float;
137
 
  if (pressure < 0.0 || pressure > 100.0)
138
 
    success = FALSE;
139
 
 
140
 
  num_strokes = args[2].value.pdb_int;
141
 
  if (!(num_strokes < 2))
142
 
    num_strokes /= 2;
143
 
  else
144
 
    success = FALSE;
145
 
 
146
 
  strokes = (gdouble *) args[3].value.pdb_pointer;
 
108
  const gdouble *strokes;
 
109
 
 
110
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
111
  pressure = g_value_get_double (&args->values[1]);
 
112
  num_strokes = g_value_get_int (&args->values[2]);
 
113
  strokes = gimp_value_get_floatarray (&args->values[3]);
147
114
 
148
115
  if (success)
149
116
    {
150
117
      GimpPaintInfo *info = (GimpPaintInfo *)
151
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpAirbrush");
 
118
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-airbrush");
152
119
 
153
120
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
154
121
 
161
128
                        NULL);
162
129
 
163
130
          success = paint_tools_stroke (gimp, context, options, drawable,
164
 
                                        num_strokes, strokes);
 
131
                                        num_strokes, strokes,
 
132
                                        "undo-desc", info->blurb,
 
133
                                        NULL);
165
134
        }
166
135
    }
167
136
 
168
 
  return procedural_db_return_args (&airbrush_proc, success);
 
137
  return gimp_procedure_get_return_values (procedure, success);
169
138
}
170
139
 
171
 
static ProcArg airbrush_inargs[] =
172
 
{
173
 
  {
174
 
    GIMP_PDB_DRAWABLE,
175
 
    "drawable",
176
 
    "The affected drawable"
177
 
  },
178
 
  {
179
 
    GIMP_PDB_FLOAT,
180
 
    "pressure",
181
 
    "The pressure of the airbrush strokes (0 <= pressure <= 100)"
182
 
  },
183
 
  {
184
 
    GIMP_PDB_INT32,
185
 
    "num_strokes",
186
 
    "Number of stroke control points (count each coordinate as 2 points)"
187
 
  },
188
 
  {
189
 
    GIMP_PDB_FLOATARRAY,
190
 
    "strokes",
191
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
192
 
  }
193
 
};
194
 
 
195
 
static ProcRecord airbrush_proc =
196
 
{
197
 
  "gimp_airbrush",
198
 
  "Paint in the current brush with varying pressure. Paint application is time-dependent.",
199
 
  "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.",
200
 
  "Spencer Kimball & Peter Mattis",
201
 
  "Spencer Kimball & Peter Mattis",
202
 
  "1995-1996",
203
 
  NULL,
204
 
  GIMP_INTERNAL,
205
 
  4,
206
 
  airbrush_inargs,
207
 
  0,
208
 
  NULL,
209
 
  { { airbrush_invoker } }
210
 
};
211
 
 
212
 
static Argument *
213
 
airbrush_default_invoker (Gimp         *gimp,
214
 
                          GimpContext  *context,
215
 
                          GimpProgress *progress,
216
 
                          Argument     *args)
 
140
static GValueArray *
 
141
airbrush_default_invoker (GimpProcedure     *procedure,
 
142
                          Gimp              *gimp,
 
143
                          GimpContext       *context,
 
144
                          GimpProgress      *progress,
 
145
                          const GValueArray *args)
217
146
{
218
147
  gboolean success = TRUE;
219
148
  GimpDrawable *drawable;
220
149
  gint32 num_strokes;
221
 
  gdouble *strokes;
222
 
 
223
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
224
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
225
 
    success = FALSE;
226
 
 
227
 
  num_strokes = args[1].value.pdb_int;
228
 
  if (!(num_strokes < 2))
229
 
    num_strokes /= 2;
230
 
  else
231
 
    success = FALSE;
232
 
 
233
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
 
150
  const gdouble *strokes;
 
151
 
 
152
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
153
  num_strokes = g_value_get_int (&args->values[1]);
 
154
  strokes = gimp_value_get_floatarray (&args->values[2]);
234
155
 
235
156
  if (success)
236
157
    {
237
158
      GimpPaintInfo *info = (GimpPaintInfo *)
238
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpAirbrush");
 
159
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-airbrush");
239
160
 
240
161
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
241
162
 
244
165
          GimpPaintOptions *options = gimp_paint_options_new (info);
245
166
 
246
167
          success = paint_tools_stroke (gimp, context, options, drawable,
247
 
                                        num_strokes, strokes);
 
168
                                        num_strokes, strokes,
 
169
                                        "undo-desc", info->blurb,
 
170
                                        NULL);
248
171
        }
249
172
    }
250
173
 
251
 
  return procedural_db_return_args (&airbrush_default_proc, success);
 
174
  return gimp_procedure_get_return_values (procedure, success);
252
175
}
253
176
 
254
 
static ProcArg airbrush_default_inargs[] =
255
 
{
256
 
  {
257
 
    GIMP_PDB_DRAWABLE,
258
 
    "drawable",
259
 
    "The affected drawable"
260
 
  },
261
 
  {
262
 
    GIMP_PDB_INT32,
263
 
    "num_strokes",
264
 
    "Number of stroke control points (count each coordinate as 2 points)"
265
 
  },
266
 
  {
267
 
    GIMP_PDB_FLOATARRAY,
268
 
    "strokes",
269
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
270
 
  }
271
 
};
272
 
 
273
 
static ProcRecord airbrush_default_proc =
274
 
{
275
 
  "gimp_airbrush_default",
276
 
  "Paint in the current brush with varying pressure. Paint application is time-dependent.",
277
 
  "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.",
278
 
  "Andy Thomas",
279
 
  "Andy Thomas",
280
 
  "1999",
281
 
  NULL,
282
 
  GIMP_INTERNAL,
283
 
  3,
284
 
  airbrush_default_inargs,
285
 
  0,
286
 
  NULL,
287
 
  { { airbrush_default_invoker } }
288
 
};
289
 
 
290
 
static Argument *
291
 
clone_invoker (Gimp         *gimp,
292
 
               GimpContext  *context,
293
 
               GimpProgress *progress,
294
 
               Argument     *args)
 
177
static GValueArray *
 
178
clone_invoker (GimpProcedure     *procedure,
 
179
               Gimp              *gimp,
 
180
               GimpContext       *context,
 
181
               GimpProgress      *progress,
 
182
               const GValueArray *args)
295
183
{
296
184
  gboolean success = TRUE;
297
185
  GimpDrawable *drawable;
300
188
  gdouble src_x;
301
189
  gdouble src_y;
302
190
  gint32 num_strokes;
303
 
  gdouble *strokes;
304
 
 
305
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
306
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
307
 
    success = FALSE;
308
 
 
309
 
  src_drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[1].value.pdb_int);
310
 
  if (! (GIMP_IS_DRAWABLE (src_drawable) && ! gimp_item_is_removed (GIMP_ITEM (src_drawable))))
311
 
    success = FALSE;
312
 
 
313
 
  clone_type = args[2].value.pdb_int;
314
 
  if (clone_type < GIMP_IMAGE_CLONE || clone_type > GIMP_PATTERN_CLONE)
315
 
    success = FALSE;
316
 
 
317
 
  src_x = args[3].value.pdb_float;
318
 
 
319
 
  src_y = args[4].value.pdb_float;
320
 
 
321
 
  num_strokes = args[5].value.pdb_int;
322
 
  if (!(num_strokes < 2))
323
 
    num_strokes /= 2;
324
 
  else
325
 
    success = FALSE;
326
 
 
327
 
  strokes = (gdouble *) args[6].value.pdb_pointer;
 
191
  const gdouble *strokes;
 
192
 
 
193
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
194
  src_drawable = gimp_value_get_drawable (&args->values[1], gimp);
 
195
  clone_type = g_value_get_enum (&args->values[2]);
 
196
  src_x = g_value_get_double (&args->values[3]);
 
197
  src_y = g_value_get_double (&args->values[4]);
 
198
  num_strokes = g_value_get_int (&args->values[5]);
 
199
  strokes = gimp_value_get_floatarray (&args->values[6]);
328
200
 
329
201
  if (success)
330
202
    {
331
203
      GimpPaintInfo *info = (GimpPaintInfo *)
332
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpClone");
 
204
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-clone");
333
205
 
334
206
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
335
207
 
341
213
                        "clone-type", clone_type,
342
214
                        NULL);
343
215
 
344
 
    #ifdef __GNUC__
345
 
    #warning FIXME: re-enable clone src_drawable
346
 
    #endif
347
 
    #if 0
348
 
      FIXME
349
 
 
350
 
          core->src_drawable = src_drawable;
351
 
          core->src_x        = srx_x;
352
 
          core->src_y        = src_y;
353
 
    #endif
354
 
 
355
216
          success = paint_tools_stroke (gimp, context, options, drawable,
356
 
                                        num_strokes, strokes);
 
217
                                        num_strokes, strokes,
 
218
                                        "undo-desc",    info->blurb,
 
219
                                        "src-drawable", src_drawable,
 
220
                                        "src-x",        src_x,
 
221
                                        "src-y",        src_y,
 
222
                                        NULL);
357
223
        }
358
224
    }
359
225
 
360
 
  return procedural_db_return_args (&clone_proc, success);
 
226
  return gimp_procedure_get_return_values (procedure, success);
361
227
}
362
228
 
363
 
static ProcArg clone_inargs[] =
364
 
{
365
 
  {
366
 
    GIMP_PDB_DRAWABLE,
367
 
    "drawable",
368
 
    "The affected drawable"
369
 
  },
370
 
  {
371
 
    GIMP_PDB_DRAWABLE,
372
 
    "src_drawable",
373
 
    "The source drawable"
374
 
  },
375
 
  {
376
 
    GIMP_PDB_INT32,
377
 
    "clone_type",
378
 
    "The type of clone: { GIMP_IMAGE_CLONE (0), GIMP_PATTERN_CLONE (1) }"
379
 
  },
380
 
  {
381
 
    GIMP_PDB_FLOAT,
382
 
    "src_x",
383
 
    "The x coordinate in the source image"
384
 
  },
385
 
  {
386
 
    GIMP_PDB_FLOAT,
387
 
    "src_y",
388
 
    "The y coordinate in the source image"
389
 
  },
390
 
  {
391
 
    GIMP_PDB_INT32,
392
 
    "num_strokes",
393
 
    "Number of stroke control points (count each coordinate as 2 points)"
394
 
  },
395
 
  {
396
 
    GIMP_PDB_FLOATARRAY,
397
 
    "strokes",
398
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
399
 
  }
400
 
};
401
 
 
402
 
static ProcRecord clone_proc =
403
 
{
404
 
  "gimp_clone",
405
 
  "Clone from the source to the dest drawable using the current brush",
406
 
  "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.",
407
 
  "Spencer Kimball & Peter Mattis",
408
 
  "Spencer Kimball & Peter Mattis",
409
 
  "1995-1996",
410
 
  NULL,
411
 
  GIMP_INTERNAL,
412
 
  7,
413
 
  clone_inargs,
414
 
  0,
415
 
  NULL,
416
 
  { { clone_invoker } }
417
 
};
418
 
 
419
 
static Argument *
420
 
clone_default_invoker (Gimp         *gimp,
421
 
                       GimpContext  *context,
422
 
                       GimpProgress *progress,
423
 
                       Argument     *args)
 
229
static GValueArray *
 
230
clone_default_invoker (GimpProcedure     *procedure,
 
231
                       Gimp              *gimp,
 
232
                       GimpContext       *context,
 
233
                       GimpProgress      *progress,
 
234
                       const GValueArray *args)
424
235
{
425
236
  gboolean success = TRUE;
426
237
  GimpDrawable *drawable;
427
238
  gint32 num_strokes;
428
 
  gdouble *strokes;
429
 
 
430
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
431
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
432
 
    success = FALSE;
433
 
 
434
 
  num_strokes = args[1].value.pdb_int;
435
 
  if (!(num_strokes < 2))
436
 
    num_strokes /= 2;
437
 
  else
438
 
    success = FALSE;
439
 
 
440
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
 
239
  const gdouble *strokes;
 
240
 
 
241
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
242
  num_strokes = g_value_get_int (&args->values[1]);
 
243
  strokes = gimp_value_get_floatarray (&args->values[2]);
441
244
 
442
245
  if (success)
443
246
    {
444
247
      GimpPaintInfo *info = (GimpPaintInfo *)
445
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpClone");
 
248
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-clone");
446
249
 
447
250
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
448
251
 
451
254
          GimpPaintOptions *options = gimp_paint_options_new (info);
452
255
 
453
256
          success = paint_tools_stroke (gimp, context, options, drawable,
454
 
                                        num_strokes, strokes);
 
257
                                        num_strokes, strokes,
 
258
                                        "undo-desc", info->blurb,
 
259
                                        NULL);
455
260
        }
456
261
    }
457
262
 
458
 
  return procedural_db_return_args (&clone_default_proc, success);
 
263
  return gimp_procedure_get_return_values (procedure, success);
459
264
}
460
265
 
461
 
static ProcArg clone_default_inargs[] =
462
 
{
463
 
  {
464
 
    GIMP_PDB_DRAWABLE,
465
 
    "drawable",
466
 
    "The affected drawable"
467
 
  },
468
 
  {
469
 
    GIMP_PDB_INT32,
470
 
    "num_strokes",
471
 
    "Number of stroke control points (count each coordinate as 2 points)"
472
 
  },
473
 
  {
474
 
    GIMP_PDB_FLOATARRAY,
475
 
    "strokes",
476
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
477
 
  }
478
 
};
479
 
 
480
 
static ProcRecord clone_default_proc =
481
 
{
482
 
  "gimp_clone_default",
483
 
  "Clone from the source to the dest drawable using the current brush",
484
 
  "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.",
485
 
  "Andy Thomas",
486
 
  "Andy Thomas",
487
 
  "1999",
488
 
  NULL,
489
 
  GIMP_INTERNAL,
490
 
  3,
491
 
  clone_default_inargs,
492
 
  0,
493
 
  NULL,
494
 
  { { clone_default_invoker } }
495
 
};
496
 
 
497
 
static Argument *
498
 
convolve_invoker (Gimp         *gimp,
499
 
                  GimpContext  *context,
500
 
                  GimpProgress *progress,
501
 
                  Argument     *args)
 
266
static GValueArray *
 
267
convolve_invoker (GimpProcedure     *procedure,
 
268
                  Gimp              *gimp,
 
269
                  GimpContext       *context,
 
270
                  GimpProgress      *progress,
 
271
                  const GValueArray *args)
502
272
{
503
273
  gboolean success = TRUE;
504
274
  GimpDrawable *drawable;
505
275
  gdouble pressure;
506
276
  gint32 convolve_type;
507
277
  gint32 num_strokes;
508
 
  gdouble *strokes;
509
 
 
510
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
511
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
512
 
    success = FALSE;
513
 
 
514
 
  pressure = args[1].value.pdb_float;
515
 
  if (pressure < 0.0 || pressure > 100.0)
516
 
    success = FALSE;
517
 
 
518
 
  convolve_type = args[2].value.pdb_int;
519
 
  if (convolve_type < GIMP_BLUR_CONVOLVE || convolve_type > GIMP_SHARPEN_CONVOLVE)
520
 
    success = FALSE;
521
 
 
522
 
  num_strokes = args[3].value.pdb_int;
523
 
  if (!(num_strokes < 2))
524
 
    num_strokes /= 2;
525
 
  else
526
 
    success = FALSE;
527
 
 
528
 
  strokes = (gdouble *) args[4].value.pdb_pointer;
 
278
  const gdouble *strokes;
 
279
 
 
280
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
281
  pressure = g_value_get_double (&args->values[1]);
 
282
  convolve_type = g_value_get_enum (&args->values[2]);
 
283
  num_strokes = g_value_get_int (&args->values[3]);
 
284
  strokes = gimp_value_get_floatarray (&args->values[4]);
529
285
 
530
286
  if (success)
531
287
    {
532
288
      GimpPaintInfo *info = (GimpPaintInfo *)
533
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpConvolve");
 
289
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-convolve");
534
290
 
535
291
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
536
292
 
544
300
                        NULL);
545
301
 
546
302
          success = paint_tools_stroke (gimp, context, options, drawable,
547
 
                                        num_strokes, strokes);
 
303
                                        num_strokes, strokes,
 
304
                                        "undo-desc", info->blurb,
 
305
                                        NULL);
548
306
        }
549
307
    }
550
308
 
551
 
  return procedural_db_return_args (&convolve_proc, success);
 
309
  return gimp_procedure_get_return_values (procedure, success);
552
310
}
553
311
 
554
 
static ProcArg convolve_inargs[] =
555
 
{
556
 
  {
557
 
    GIMP_PDB_DRAWABLE,
558
 
    "drawable",
559
 
    "The affected drawable"
560
 
  },
561
 
  {
562
 
    GIMP_PDB_FLOAT,
563
 
    "pressure",
564
 
    "The pressure: 0 <= pressure <= 100"
565
 
  },
566
 
  {
567
 
    GIMP_PDB_INT32,
568
 
    "convolve_type",
569
 
    "Convolve type: { GIMP_BLUR_CONVOLVE (0), GIMP_SHARPEN_CONVOLVE (1) }"
570
 
  },
571
 
  {
572
 
    GIMP_PDB_INT32,
573
 
    "num_strokes",
574
 
    "Number of stroke control points (count each coordinate as 2 points)"
575
 
  },
576
 
  {
577
 
    GIMP_PDB_FLOATARRAY,
578
 
    "strokes",
579
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
580
 
  }
581
 
};
582
 
 
583
 
static ProcRecord convolve_proc =
584
 
{
585
 
  "gimp_convolve",
586
 
  "Convolve (Blur, Sharpen) using the current brush.",
587
 
  "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.",
588
 
  "Spencer Kimball & Peter Mattis",
589
 
  "Spencer Kimball & Peter Mattis",
590
 
  "1995-1996",
591
 
  NULL,
592
 
  GIMP_INTERNAL,
593
 
  5,
594
 
  convolve_inargs,
595
 
  0,
596
 
  NULL,
597
 
  { { convolve_invoker } }
598
 
};
599
 
 
600
 
static Argument *
601
 
convolve_default_invoker (Gimp         *gimp,
602
 
                          GimpContext  *context,
603
 
                          GimpProgress *progress,
604
 
                          Argument     *args)
 
312
static GValueArray *
 
313
convolve_default_invoker (GimpProcedure     *procedure,
 
314
                          Gimp              *gimp,
 
315
                          GimpContext       *context,
 
316
                          GimpProgress      *progress,
 
317
                          const GValueArray *args)
605
318
{
606
319
  gboolean success = TRUE;
607
320
  GimpDrawable *drawable;
608
321
  gint32 num_strokes;
609
 
  gdouble *strokes;
610
 
 
611
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
612
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
613
 
    success = FALSE;
614
 
 
615
 
  num_strokes = args[1].value.pdb_int;
616
 
  if (!(num_strokes < 2))
617
 
    num_strokes /= 2;
618
 
  else
619
 
    success = FALSE;
620
 
 
621
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
 
322
  const gdouble *strokes;
 
323
 
 
324
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
325
  num_strokes = g_value_get_int (&args->values[1]);
 
326
  strokes = gimp_value_get_floatarray (&args->values[2]);
622
327
 
623
328
  if (success)
624
329
    {
625
330
      GimpPaintInfo *info = (GimpPaintInfo *)
626
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpConvolve");
 
331
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-convolve");
627
332
 
628
333
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
629
334
 
632
337
          GimpPaintOptions *options = gimp_paint_options_new (info);
633
338
 
634
339
          success = paint_tools_stroke (gimp, context, options, drawable,
635
 
                                        num_strokes, strokes);
 
340
                                        num_strokes, strokes,
 
341
                                        "undo-desc", info->blurb,
 
342
                                        NULL);
636
343
        }
637
344
    }
638
345
 
639
 
  return procedural_db_return_args (&convolve_default_proc, success);
 
346
  return gimp_procedure_get_return_values (procedure, success);
640
347
}
641
348
 
642
 
static ProcArg convolve_default_inargs[] =
643
 
{
644
 
  {
645
 
    GIMP_PDB_DRAWABLE,
646
 
    "drawable",
647
 
    "The affected drawable"
648
 
  },
649
 
  {
650
 
    GIMP_PDB_INT32,
651
 
    "num_strokes",
652
 
    "Number of stroke control points (count each coordinate as 2 points)"
653
 
  },
654
 
  {
655
 
    GIMP_PDB_FLOATARRAY,
656
 
    "strokes",
657
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
658
 
  }
659
 
};
660
 
 
661
 
static ProcRecord convolve_default_proc =
662
 
{
663
 
  "gimp_convolve_default",
664
 
  "Convolve (Blur, Sharpen) using the current brush.",
665
 
  "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.",
666
 
  "Andy Thomas",
667
 
  "Andy Thomas",
668
 
  "1999",
669
 
  NULL,
670
 
  GIMP_INTERNAL,
671
 
  3,
672
 
  convolve_default_inargs,
673
 
  0,
674
 
  NULL,
675
 
  { { convolve_default_invoker } }
676
 
};
677
 
 
678
 
static Argument *
679
 
dodgeburn_invoker (Gimp         *gimp,
680
 
                   GimpContext  *context,
681
 
                   GimpProgress *progress,
682
 
                   Argument     *args)
 
349
static GValueArray *
 
350
dodgeburn_invoker (GimpProcedure     *procedure,
 
351
                   Gimp              *gimp,
 
352
                   GimpContext       *context,
 
353
                   GimpProgress      *progress,
 
354
                   const GValueArray *args)
683
355
{
684
356
  gboolean success = TRUE;
685
357
  GimpDrawable *drawable;
687
359
  gint32 dodgeburn_type;
688
360
  gint32 dodgeburn_mode;
689
361
  gint32 num_strokes;
690
 
  gdouble *strokes;
691
 
 
692
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
693
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
694
 
    success = FALSE;
695
 
 
696
 
  exposure = args[1].value.pdb_float;
697
 
  if (exposure < 0.0 || exposure > 100.0)
698
 
    success = FALSE;
699
 
 
700
 
  dodgeburn_type = args[2].value.pdb_int;
701
 
  if (dodgeburn_type < GIMP_DODGE || dodgeburn_type > GIMP_BURN)
702
 
    success = FALSE;
703
 
 
704
 
  dodgeburn_mode = args[3].value.pdb_int;
705
 
  if (dodgeburn_mode < GIMP_SHADOWS || dodgeburn_mode > GIMP_HIGHLIGHTS)
706
 
    success = FALSE;
707
 
 
708
 
  num_strokes = args[4].value.pdb_int;
709
 
  if (!(num_strokes < 2))
710
 
    num_strokes /= 2;
711
 
  else
712
 
    success = FALSE;
713
 
 
714
 
  strokes = (gdouble *) args[5].value.pdb_pointer;
 
362
  const gdouble *strokes;
 
363
 
 
364
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
365
  exposure = g_value_get_double (&args->values[1]);
 
366
  dodgeburn_type = g_value_get_enum (&args->values[2]);
 
367
  dodgeburn_mode = g_value_get_enum (&args->values[3]);
 
368
  num_strokes = g_value_get_int (&args->values[4]);
 
369
  strokes = gimp_value_get_floatarray (&args->values[5]);
715
370
 
716
371
  if (success)
717
372
    {
718
373
      GimpPaintInfo *info = (GimpPaintInfo *)
719
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpDodgeBurn");
 
374
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-dodge-burn");
720
375
 
721
376
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
722
377
 
731
386
                        NULL);
732
387
 
733
388
          success = paint_tools_stroke (gimp, context, options, drawable,
734
 
                                        num_strokes, strokes);
 
389
                                        num_strokes, strokes,
 
390
                                        "undo-desc", info->blurb,
 
391
                                        NULL);
735
392
        }
736
393
    }
737
394
 
738
 
  return procedural_db_return_args (&dodgeburn_proc, success);
 
395
  return gimp_procedure_get_return_values (procedure, success);
739
396
}
740
397
 
741
 
static ProcArg dodgeburn_inargs[] =
742
 
{
743
 
  {
744
 
    GIMP_PDB_DRAWABLE,
745
 
    "drawable",
746
 
    "The affected drawable"
747
 
  },
748
 
  {
749
 
    GIMP_PDB_FLOAT,
750
 
    "exposure",
751
 
    "The exposer of the strokes (0 <= exposure <= 100)"
752
 
  },
753
 
  {
754
 
    GIMP_PDB_INT32,
755
 
    "dodgeburn_type",
756
 
    "The type either dodge or burn: { GIMP_DODGE (0), GIMP_BURN (1) }"
757
 
  },
758
 
  {
759
 
    GIMP_PDB_INT32,
760
 
    "dodgeburn_mode",
761
 
    "The mode: { GIMP_SHADOWS (0), GIMP_MIDTONES (1), GIMP_HIGHLIGHTS (2) }"
762
 
  },
763
 
  {
764
 
    GIMP_PDB_INT32,
765
 
    "num_strokes",
766
 
    "Number of stroke control points (count each coordinate as 2 points)"
767
 
  },
768
 
  {
769
 
    GIMP_PDB_FLOATARRAY,
770
 
    "strokes",
771
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
772
 
  }
773
 
};
774
 
 
775
 
static ProcRecord dodgeburn_proc =
776
 
{
777
 
  "gimp_dodgeburn",
778
 
  "Dodgeburn image with varying exposure.",
779
 
  "Dodgeburn. More details here later.",
780
 
  "Andy Thomas",
781
 
  "Andy Thomas",
782
 
  "1999",
783
 
  NULL,
784
 
  GIMP_INTERNAL,
785
 
  6,
786
 
  dodgeburn_inargs,
787
 
  0,
788
 
  NULL,
789
 
  { { dodgeburn_invoker } }
790
 
};
791
 
 
792
 
static Argument *
793
 
dodgeburn_default_invoker (Gimp         *gimp,
794
 
                           GimpContext  *context,
795
 
                           GimpProgress *progress,
796
 
                           Argument     *args)
 
398
static GValueArray *
 
399
dodgeburn_default_invoker (GimpProcedure     *procedure,
 
400
                           Gimp              *gimp,
 
401
                           GimpContext       *context,
 
402
                           GimpProgress      *progress,
 
403
                           const GValueArray *args)
797
404
{
798
405
  gboolean success = TRUE;
799
406
  GimpDrawable *drawable;
800
407
  gint32 num_strokes;
801
 
  gdouble *strokes;
802
 
 
803
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
804
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
805
 
    success = FALSE;
806
 
 
807
 
  num_strokes = args[1].value.pdb_int;
808
 
  if (!(num_strokes < 2))
809
 
    num_strokes /= 2;
810
 
  else
811
 
    success = FALSE;
812
 
 
813
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
 
408
  const gdouble *strokes;
 
409
 
 
410
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
411
  num_strokes = g_value_get_int (&args->values[1]);
 
412
  strokes = gimp_value_get_floatarray (&args->values[2]);
814
413
 
815
414
  if (success)
816
415
    {
817
416
      GimpPaintInfo *info = (GimpPaintInfo *)
818
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpDodgeBurn");
 
417
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-dodge-burn");
819
418
 
820
419
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
821
420
 
824
423
          GimpPaintOptions *options = gimp_paint_options_new (info);
825
424
 
826
425
          success = paint_tools_stroke (gimp, context, options, drawable,
827
 
                                        num_strokes, strokes);
 
426
                                        num_strokes, strokes,
 
427
                                        "undo-desc", info->blurb,
 
428
                                        NULL);
828
429
        }
829
430
    }
830
431
 
831
 
  return procedural_db_return_args (&dodgeburn_default_proc, success);
 
432
  return gimp_procedure_get_return_values (procedure, success);
832
433
}
833
434
 
834
 
static ProcArg dodgeburn_default_inargs[] =
835
 
{
836
 
  {
837
 
    GIMP_PDB_DRAWABLE,
838
 
    "drawable",
839
 
    "The affected drawable"
840
 
  },
841
 
  {
842
 
    GIMP_PDB_INT32,
843
 
    "num_strokes",
844
 
    "Number of stroke control points (count each coordinate as 2 points)"
845
 
  },
846
 
  {
847
 
    GIMP_PDB_FLOATARRAY,
848
 
    "strokes",
849
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
850
 
  }
851
 
};
852
 
 
853
 
static ProcRecord dodgeburn_default_proc =
854
 
{
855
 
  "gimp_dodgeburn_default",
856
 
  "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.",
857
 
  "Dodgeburn. More details here later.",
858
 
  "Spencer Kimball & Peter Mattis",
859
 
  "Spencer Kimball & Peter Mattis",
860
 
  "1995-1996",
861
 
  NULL,
862
 
  GIMP_INTERNAL,
863
 
  3,
864
 
  dodgeburn_default_inargs,
865
 
  0,
866
 
  NULL,
867
 
  { { dodgeburn_default_invoker } }
868
 
};
869
 
 
870
 
static Argument *
871
 
eraser_invoker (Gimp         *gimp,
872
 
                GimpContext  *context,
873
 
                GimpProgress *progress,
874
 
                Argument     *args)
 
435
static GValueArray *
 
436
eraser_invoker (GimpProcedure     *procedure,
 
437
                Gimp              *gimp,
 
438
                GimpContext       *context,
 
439
                GimpProgress      *progress,
 
440
                const GValueArray *args)
875
441
{
876
442
  gboolean success = TRUE;
877
443
  GimpDrawable *drawable;
878
444
  gint32 num_strokes;
879
 
  gdouble *strokes;
 
445
  const gdouble *strokes;
880
446
  gint32 hardness;
881
447
  gint32 method;
882
448
 
883
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
884
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
885
 
    success = FALSE;
886
 
 
887
 
  num_strokes = args[1].value.pdb_int;
888
 
  if (!(num_strokes < 2))
889
 
    num_strokes /= 2;
890
 
  else
891
 
    success = FALSE;
892
 
 
893
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
894
 
 
895
 
  hardness = args[3].value.pdb_int;
896
 
  if (hardness < GIMP_BRUSH_HARD || hardness > GIMP_BRUSH_SOFT)
897
 
    success = FALSE;
898
 
 
899
 
  method = args[4].value.pdb_int;
900
 
  if (method < GIMP_PAINT_CONSTANT || method > GIMP_PAINT_INCREMENTAL)
901
 
    success = FALSE;
 
449
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
450
  num_strokes = g_value_get_int (&args->values[1]);
 
451
  strokes = gimp_value_get_floatarray (&args->values[2]);
 
452
  hardness = g_value_get_enum (&args->values[3]);
 
453
  method = g_value_get_enum (&args->values[4]);
902
454
 
903
455
  if (success)
904
456
    {
905
457
      GimpPaintInfo *info = (GimpPaintInfo *)
906
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpEraser");
 
458
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-eraser");
907
459
 
908
460
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
909
461
 
917
469
                        NULL);
918
470
 
919
471
          success = paint_tools_stroke (gimp, context, options, drawable,
920
 
                                        num_strokes, strokes);
921
 
        }
922
 
    }
923
 
 
924
 
  return procedural_db_return_args (&eraser_proc, success);
925
 
}
926
 
 
927
 
static ProcArg eraser_inargs[] =
928
 
{
929
 
  {
930
 
    GIMP_PDB_DRAWABLE,
931
 
    "drawable",
932
 
    "The affected drawable"
933
 
  },
934
 
  {
935
 
    GIMP_PDB_INT32,
936
 
    "num_strokes",
937
 
    "Number of stroke control points (count each coordinate as 2 points)"
938
 
  },
939
 
  {
940
 
    GIMP_PDB_FLOATARRAY,
941
 
    "strokes",
942
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
943
 
  },
944
 
  {
945
 
    GIMP_PDB_INT32,
946
 
    "hardness",
947
 
    "GIMP_BRUSH_HARD (0) or GIMP_BRUSH_SOFT (1)"
948
 
  },
949
 
  {
950
 
    GIMP_PDB_INT32,
951
 
    "method",
952
 
    "GIMP_PAINT_CONSTANT (0) or GIMP_PAINT_INCREMENTAL (1)"
953
 
  }
954
 
};
955
 
 
956
 
static ProcRecord eraser_proc =
957
 
{
958
 
  "gimp_eraser",
959
 
  "Erase using the current brush.",
960
 
  "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.",
961
 
  "Spencer Kimball & Peter Mattis",
962
 
  "Spencer Kimball & Peter Mattis",
963
 
  "1995-1996",
964
 
  NULL,
965
 
  GIMP_INTERNAL,
966
 
  5,
967
 
  eraser_inargs,
968
 
  0,
969
 
  NULL,
970
 
  { { eraser_invoker } }
971
 
};
972
 
 
973
 
static Argument *
974
 
eraser_default_invoker (Gimp         *gimp,
975
 
                        GimpContext  *context,
976
 
                        GimpProgress *progress,
977
 
                        Argument     *args)
978
 
{
979
 
  gboolean success = TRUE;
980
 
  GimpDrawable *drawable;
981
 
  gint32 num_strokes;
982
 
  gdouble *strokes;
983
 
 
984
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
985
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
986
 
    success = FALSE;
987
 
 
988
 
  num_strokes = args[1].value.pdb_int;
989
 
  if (!(num_strokes < 2))
990
 
    num_strokes /= 2;
991
 
  else
992
 
    success = FALSE;
993
 
 
994
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
995
 
 
996
 
  if (success)
997
 
    {
998
 
      GimpPaintInfo *info = (GimpPaintInfo *)
999
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpEraser");
1000
 
 
1001
 
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
1002
 
 
1003
 
      if (success)
1004
 
        {
1005
 
          GimpPaintOptions *options = gimp_paint_options_new (info);
1006
 
 
1007
 
          success = paint_tools_stroke (gimp, context, options, drawable,
1008
 
                                        num_strokes, strokes);
1009
 
        }
1010
 
    }
1011
 
 
1012
 
  return procedural_db_return_args (&eraser_default_proc, success);
1013
 
}
1014
 
 
1015
 
static ProcArg eraser_default_inargs[] =
1016
 
{
1017
 
  {
1018
 
    GIMP_PDB_DRAWABLE,
1019
 
    "drawable",
1020
 
    "The affected drawable"
1021
 
  },
1022
 
  {
1023
 
    GIMP_PDB_INT32,
1024
 
    "num_strokes",
1025
 
    "Number of stroke control points (count each coordinate as 2 points)"
1026
 
  },
1027
 
  {
1028
 
    GIMP_PDB_FLOATARRAY,
1029
 
    "strokes",
1030
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
1031
 
  }
1032
 
};
1033
 
 
1034
 
static ProcRecord eraser_default_proc =
1035
 
{
1036
 
  "gimp_eraser_default",
1037
 
  "Erase using the current brush.",
1038
 
  "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.",
1039
 
  "Andy Thomas",
1040
 
  "Andy Thomas",
1041
 
  "1999",
1042
 
  NULL,
1043
 
  GIMP_INTERNAL,
1044
 
  3,
1045
 
  eraser_default_inargs,
1046
 
  0,
1047
 
  NULL,
1048
 
  { { eraser_default_invoker } }
1049
 
};
1050
 
 
1051
 
static Argument *
1052
 
paintbrush_invoker (Gimp         *gimp,
1053
 
                    GimpContext  *context,
1054
 
                    GimpProgress *progress,
1055
 
                    Argument     *args)
 
472
                                        num_strokes, strokes,
 
473
                                        "undo-desc", info->blurb,
 
474
                                        NULL);
 
475
        }
 
476
    }
 
477
 
 
478
  return gimp_procedure_get_return_values (procedure, success);
 
479
}
 
480
 
 
481
static GValueArray *
 
482
eraser_default_invoker (GimpProcedure     *procedure,
 
483
                        Gimp              *gimp,
 
484
                        GimpContext       *context,
 
485
                        GimpProgress      *progress,
 
486
                        const GValueArray *args)
 
487
{
 
488
  gboolean success = TRUE;
 
489
  GimpDrawable *drawable;
 
490
  gint32 num_strokes;
 
491
  const gdouble *strokes;
 
492
 
 
493
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
494
  num_strokes = g_value_get_int (&args->values[1]);
 
495
  strokes = gimp_value_get_floatarray (&args->values[2]);
 
496
 
 
497
  if (success)
 
498
    {
 
499
      GimpPaintInfo *info = (GimpPaintInfo *)
 
500
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-eraser");
 
501
 
 
502
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
 
503
 
 
504
      if (success)
 
505
        {
 
506
          GimpPaintOptions *options = gimp_paint_options_new (info);
 
507
 
 
508
          success = paint_tools_stroke (gimp, context, options, drawable,
 
509
                                        num_strokes, strokes,
 
510
                                        "undo-desc", info->blurb,
 
511
                                        NULL);
 
512
        }
 
513
    }
 
514
 
 
515
  return gimp_procedure_get_return_values (procedure, success);
 
516
}
 
517
 
 
518
static GValueArray *
 
519
heal_invoker (GimpProcedure     *procedure,
 
520
              Gimp              *gimp,
 
521
              GimpContext       *context,
 
522
              GimpProgress      *progress,
 
523
              const GValueArray *args)
 
524
{
 
525
  gboolean success = TRUE;
 
526
  GimpDrawable *drawable;
 
527
  GimpDrawable *src_drawable;
 
528
  gdouble src_x;
 
529
  gdouble src_y;
 
530
  gint32 num_strokes;
 
531
  const gdouble *strokes;
 
532
 
 
533
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
534
  src_drawable = gimp_value_get_drawable (&args->values[1], gimp);
 
535
  src_x = g_value_get_double (&args->values[2]);
 
536
  src_y = g_value_get_double (&args->values[3]);
 
537
  num_strokes = g_value_get_int (&args->values[4]);
 
538
  strokes = gimp_value_get_floatarray (&args->values[5]);
 
539
 
 
540
  if (success)
 
541
    {
 
542
      GimpPaintInfo *info = (GimpPaintInfo *)
 
543
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-heal");
 
544
 
 
545
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
 
546
 
 
547
      if (success)
 
548
        {
 
549
          GimpPaintOptions *options = gimp_paint_options_new (info);
 
550
 
 
551
          success = paint_tools_stroke (gimp, context, options, drawable,
 
552
                                        num_strokes, strokes,
 
553
                                        "undo-desc",    info->blurb,
 
554
                                        "src-drawable", src_drawable,
 
555
                                        "src-x",        src_x,
 
556
                                        "src-y",        src_y,
 
557
                                        NULL);
 
558
        }
 
559
    }
 
560
 
 
561
  return gimp_procedure_get_return_values (procedure, success);
 
562
}
 
563
 
 
564
static GValueArray *
 
565
heal_default_invoker (GimpProcedure     *procedure,
 
566
                      Gimp              *gimp,
 
567
                      GimpContext       *context,
 
568
                      GimpProgress      *progress,
 
569
                      const GValueArray *args)
 
570
{
 
571
  gboolean success = TRUE;
 
572
  GimpDrawable *drawable;
 
573
  gint32 num_strokes;
 
574
  const gdouble *strokes;
 
575
 
 
576
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
577
  num_strokes = g_value_get_int (&args->values[1]);
 
578
  strokes = gimp_value_get_floatarray (&args->values[2]);
 
579
 
 
580
  if (success)
 
581
    {
 
582
      GimpPaintInfo *info = (GimpPaintInfo *)
 
583
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-heal");
 
584
 
 
585
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
 
586
 
 
587
      if (success)
 
588
        {
 
589
          GimpPaintOptions *options = gimp_paint_options_new (info);
 
590
 
 
591
          success = paint_tools_stroke (gimp, context, options, drawable,
 
592
                                        num_strokes, strokes,
 
593
                                        "undo-desc", info->blurb,
 
594
                                        NULL);
 
595
        }
 
596
    }
 
597
 
 
598
  return gimp_procedure_get_return_values (procedure, success);
 
599
}
 
600
 
 
601
static GValueArray *
 
602
paintbrush_invoker (GimpProcedure     *procedure,
 
603
                    Gimp              *gimp,
 
604
                    GimpContext       *context,
 
605
                    GimpProgress      *progress,
 
606
                    const GValueArray *args)
1056
607
{
1057
608
  gboolean success = TRUE;
1058
609
  GimpDrawable *drawable;
1059
610
  gdouble fade_out;
1060
611
  gint32 num_strokes;
1061
 
  gdouble *strokes;
 
612
  const gdouble *strokes;
1062
613
  gint32 method;
1063
614
  gdouble gradient_length;
1064
615
 
1065
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1066
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1067
 
    success = FALSE;
1068
 
 
1069
 
  fade_out = args[1].value.pdb_float;
1070
 
  if (fade_out < 0.0)
1071
 
    success = FALSE;
1072
 
 
1073
 
  num_strokes = args[2].value.pdb_int;
1074
 
  if (!(num_strokes < 2))
1075
 
    num_strokes /= 2;
1076
 
  else
1077
 
    success = FALSE;
1078
 
 
1079
 
  strokes = (gdouble *) args[3].value.pdb_pointer;
1080
 
 
1081
 
  method = args[4].value.pdb_int;
1082
 
  if (method < GIMP_PAINT_CONSTANT || method > GIMP_PAINT_INCREMENTAL)
1083
 
    success = FALSE;
1084
 
 
1085
 
  gradient_length = args[5].value.pdb_float;
1086
 
  if (gradient_length < 0.0)
1087
 
    success = FALSE;
 
616
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
617
  fade_out = g_value_get_double (&args->values[1]);
 
618
  num_strokes = g_value_get_int (&args->values[2]);
 
619
  strokes = gimp_value_get_floatarray (&args->values[3]);
 
620
  method = g_value_get_enum (&args->values[4]);
 
621
  gradient_length = g_value_get_double (&args->values[5]);
1088
622
 
1089
623
  if (success)
1090
624
    {
1091
625
      GimpPaintInfo *info = (GimpPaintInfo *)
1092
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpPaintbrush");
 
626
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-paintbrush");
1093
627
 
1094
628
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
1095
629
 
1106
640
                        NULL);
1107
641
 
1108
642
          success = paint_tools_stroke (gimp, context, options, drawable,
1109
 
                                        num_strokes, strokes);
1110
 
        }
1111
 
    }
1112
 
 
1113
 
  return procedural_db_return_args (&paintbrush_proc, success);
1114
 
}
1115
 
 
1116
 
static ProcArg paintbrush_inargs[] =
1117
 
{
1118
 
  {
1119
 
    GIMP_PDB_DRAWABLE,
1120
 
    "drawable",
1121
 
    "The affected drawable"
1122
 
  },
1123
 
  {
1124
 
    GIMP_PDB_FLOAT,
1125
 
    "fade_out",
1126
 
    "Fade out parameter: 0 <= fade_out"
1127
 
  },
1128
 
  {
1129
 
    GIMP_PDB_INT32,
1130
 
    "num_strokes",
1131
 
    "Number of stroke control points (count each coordinate as 2 points)"
1132
 
  },
1133
 
  {
1134
 
    GIMP_PDB_FLOATARRAY,
1135
 
    "strokes",
1136
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
1137
 
  },
1138
 
  {
1139
 
    GIMP_PDB_INT32,
1140
 
    "method",
1141
 
    "GIMP_PAINT_CONSTANT (0) or GIMP_PAINT_INCREMENTAL (1)"
1142
 
  },
1143
 
  {
1144
 
    GIMP_PDB_FLOAT,
1145
 
    "gradient_length",
1146
 
    "Length of gradient to draw: 0 <= gradient_length"
1147
 
  }
1148
 
};
1149
 
 
1150
 
static ProcRecord paintbrush_proc =
1151
 
{
1152
 
  "gimp_paintbrush",
1153
 
  "Paint in the current brush with optional fade out parameter and pull colors from a gradient.",
1154
 
  "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.",
1155
 
  "Spencer Kimball & Peter Mattis",
1156
 
  "Spencer Kimball & Peter Mattis",
1157
 
  "1995-1996",
1158
 
  NULL,
1159
 
  GIMP_INTERNAL,
1160
 
  6,
1161
 
  paintbrush_inargs,
1162
 
  0,
1163
 
  NULL,
1164
 
  { { paintbrush_invoker } }
1165
 
};
1166
 
 
1167
 
static Argument *
1168
 
paintbrush_default_invoker (Gimp         *gimp,
1169
 
                            GimpContext  *context,
1170
 
                            GimpProgress *progress,
1171
 
                            Argument     *args)
1172
 
{
1173
 
  gboolean success = TRUE;
1174
 
  GimpDrawable *drawable;
1175
 
  gint32 num_strokes;
1176
 
  gdouble *strokes;
1177
 
 
1178
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1179
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1180
 
    success = FALSE;
1181
 
 
1182
 
  num_strokes = args[1].value.pdb_int;
1183
 
  if (!(num_strokes < 2))
1184
 
    num_strokes /= 2;
1185
 
  else
1186
 
    success = FALSE;
1187
 
 
1188
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
1189
 
 
1190
 
  if (success)
1191
 
    {
1192
 
      GimpPaintInfo *info = (GimpPaintInfo *)
1193
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpPaintbrush");
1194
 
 
1195
 
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
1196
 
 
1197
 
      if (success)
1198
 
        {
1199
 
          GimpPaintOptions *options = gimp_paint_options_new (info);
1200
 
 
1201
 
          success = paint_tools_stroke (gimp, context, options, drawable,
1202
 
                                        num_strokes, strokes);
1203
 
        }
1204
 
    }
1205
 
 
1206
 
  return procedural_db_return_args (&paintbrush_default_proc, success);
1207
 
}
1208
 
 
1209
 
static ProcArg paintbrush_default_inargs[] =
1210
 
{
1211
 
  {
1212
 
    GIMP_PDB_DRAWABLE,
1213
 
    "drawable",
1214
 
    "The affected drawable"
1215
 
  },
1216
 
  {
1217
 
    GIMP_PDB_INT32,
1218
 
    "num_strokes",
1219
 
    "Number of stroke control points (count each coordinate as 2 points)"
1220
 
  },
1221
 
  {
1222
 
    GIMP_PDB_FLOATARRAY,
1223
 
    "strokes",
1224
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
1225
 
  }
1226
 
};
1227
 
 
1228
 
static ProcRecord paintbrush_default_proc =
1229
 
{
1230
 
  "gimp_paintbrush_default",
1231
 
  "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.",
1232
 
  "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.",
1233
 
  "Andy Thomas",
1234
 
  "Andy Thomas",
1235
 
  "1999",
1236
 
  NULL,
1237
 
  GIMP_INTERNAL,
1238
 
  3,
1239
 
  paintbrush_default_inargs,
1240
 
  0,
1241
 
  NULL,
1242
 
  { { paintbrush_default_invoker } }
1243
 
};
1244
 
 
1245
 
static Argument *
1246
 
pencil_invoker (Gimp         *gimp,
1247
 
                GimpContext  *context,
1248
 
                GimpProgress *progress,
1249
 
                Argument     *args)
1250
 
{
1251
 
  gboolean success = TRUE;
1252
 
  GimpDrawable *drawable;
1253
 
  gint32 num_strokes;
1254
 
  gdouble *strokes;
1255
 
 
1256
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1257
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1258
 
    success = FALSE;
1259
 
 
1260
 
  num_strokes = args[1].value.pdb_int;
1261
 
  if (!(num_strokes < 2))
1262
 
    num_strokes /= 2;
1263
 
  else
1264
 
    success = FALSE;
1265
 
 
1266
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
1267
 
 
1268
 
  if (success)
1269
 
    {
1270
 
      GimpPaintInfo *info = (GimpPaintInfo *)
1271
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpPencil");
1272
 
 
1273
 
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
1274
 
 
1275
 
      if (success)
1276
 
        {
1277
 
          GimpPaintOptions *options = gimp_paint_options_new (info);
1278
 
 
1279
 
          success = paint_tools_stroke (gimp, context, options, drawable,
1280
 
                                        num_strokes, strokes);
1281
 
        }
1282
 
    }
1283
 
 
1284
 
  return procedural_db_return_args (&pencil_proc, success);
1285
 
}
1286
 
 
1287
 
static ProcArg pencil_inargs[] =
1288
 
{
1289
 
  {
1290
 
    GIMP_PDB_DRAWABLE,
1291
 
    "drawable",
1292
 
    "The affected drawable"
1293
 
  },
1294
 
  {
1295
 
    GIMP_PDB_INT32,
1296
 
    "num_strokes",
1297
 
    "Number of stroke control points (count each coordinate as 2 points)"
1298
 
  },
1299
 
  {
1300
 
    GIMP_PDB_FLOATARRAY,
1301
 
    "strokes",
1302
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
1303
 
  }
1304
 
};
1305
 
 
1306
 
static ProcRecord pencil_proc =
1307
 
{
1308
 
  "gimp_pencil",
1309
 
  "Paint in the current brush without sub-pixel sampling.",
1310
 
  "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.",
1311
 
  "Spencer Kimball & Peter Mattis",
1312
 
  "Spencer Kimball & Peter Mattis",
1313
 
  "1995-1996",
1314
 
  NULL,
1315
 
  GIMP_INTERNAL,
1316
 
  3,
1317
 
  pencil_inargs,
1318
 
  0,
1319
 
  NULL,
1320
 
  { { pencil_invoker } }
1321
 
};
1322
 
 
1323
 
static Argument *
1324
 
smudge_invoker (Gimp         *gimp,
1325
 
                GimpContext  *context,
1326
 
                GimpProgress *progress,
1327
 
                Argument     *args)
 
643
                                        num_strokes, strokes,
 
644
                                        "undo-desc", info->blurb,
 
645
                                        NULL);
 
646
        }
 
647
    }
 
648
 
 
649
  return gimp_procedure_get_return_values (procedure, success);
 
650
}
 
651
 
 
652
static GValueArray *
 
653
paintbrush_default_invoker (GimpProcedure     *procedure,
 
654
                            Gimp              *gimp,
 
655
                            GimpContext       *context,
 
656
                            GimpProgress      *progress,
 
657
                            const GValueArray *args)
 
658
{
 
659
  gboolean success = TRUE;
 
660
  GimpDrawable *drawable;
 
661
  gint32 num_strokes;
 
662
  const gdouble *strokes;
 
663
 
 
664
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
665
  num_strokes = g_value_get_int (&args->values[1]);
 
666
  strokes = gimp_value_get_floatarray (&args->values[2]);
 
667
 
 
668
  if (success)
 
669
    {
 
670
      GimpPaintInfo *info = (GimpPaintInfo *)
 
671
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-paintbrush");
 
672
 
 
673
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
 
674
 
 
675
      if (success)
 
676
        {
 
677
          GimpPaintOptions *options = gimp_paint_options_new (info);
 
678
 
 
679
          success = paint_tools_stroke (gimp, context, options, drawable,
 
680
                                        num_strokes, strokes,
 
681
                                        "undo-desc", info->blurb,
 
682
                                        NULL);
 
683
        }
 
684
    }
 
685
 
 
686
  return gimp_procedure_get_return_values (procedure, success);
 
687
}
 
688
 
 
689
static GValueArray *
 
690
pencil_invoker (GimpProcedure     *procedure,
 
691
                Gimp              *gimp,
 
692
                GimpContext       *context,
 
693
                GimpProgress      *progress,
 
694
                const GValueArray *args)
 
695
{
 
696
  gboolean success = TRUE;
 
697
  GimpDrawable *drawable;
 
698
  gint32 num_strokes;
 
699
  const gdouble *strokes;
 
700
 
 
701
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
702
  num_strokes = g_value_get_int (&args->values[1]);
 
703
  strokes = gimp_value_get_floatarray (&args->values[2]);
 
704
 
 
705
  if (success)
 
706
    {
 
707
      GimpPaintInfo *info = (GimpPaintInfo *)
 
708
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-pencil");
 
709
 
 
710
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
 
711
 
 
712
      if (success)
 
713
        {
 
714
          GimpPaintOptions *options = gimp_paint_options_new (info);
 
715
 
 
716
          success = paint_tools_stroke (gimp, context, options, drawable,
 
717
                                        num_strokes, strokes,
 
718
                                        "undo-desc", info->blurb,
 
719
                                        NULL);
 
720
        }
 
721
    }
 
722
 
 
723
  return gimp_procedure_get_return_values (procedure, success);
 
724
}
 
725
 
 
726
static GValueArray *
 
727
smudge_invoker (GimpProcedure     *procedure,
 
728
                Gimp              *gimp,
 
729
                GimpContext       *context,
 
730
                GimpProgress      *progress,
 
731
                const GValueArray *args)
1328
732
{
1329
733
  gboolean success = TRUE;
1330
734
  GimpDrawable *drawable;
1331
735
  gdouble pressure;
1332
736
  gint32 num_strokes;
1333
 
  gdouble *strokes;
1334
 
 
1335
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1336
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1337
 
    success = FALSE;
1338
 
 
1339
 
  pressure = args[1].value.pdb_float;
1340
 
  if (pressure < 0.0 || pressure > 100.0)
1341
 
    success = FALSE;
1342
 
 
1343
 
  num_strokes = args[2].value.pdb_int;
1344
 
  if (!(num_strokes < 2))
1345
 
    num_strokes /= 2;
1346
 
  else
1347
 
    success = FALSE;
1348
 
 
1349
 
  strokes = (gdouble *) args[3].value.pdb_pointer;
 
737
  const gdouble *strokes;
 
738
 
 
739
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
740
  pressure = g_value_get_double (&args->values[1]);
 
741
  num_strokes = g_value_get_int (&args->values[2]);
 
742
  strokes = gimp_value_get_floatarray (&args->values[3]);
1350
743
 
1351
744
  if (success)
1352
745
    {
1353
746
      GimpPaintInfo *info = (GimpPaintInfo *)
1354
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpSmudge");
 
747
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-smudge");
1355
748
 
1356
749
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
1357
750
 
1364
757
                        NULL);
1365
758
 
1366
759
          success = paint_tools_stroke (gimp, context, options, drawable,
1367
 
                                        num_strokes, strokes);
 
760
                                        num_strokes, strokes,
 
761
                                        "undo-desc", info->blurb,
 
762
                                        NULL);
1368
763
        }
1369
764
    }
1370
765
 
1371
 
  return procedural_db_return_args (&smudge_proc, success);
 
766
  return gimp_procedure_get_return_values (procedure, success);
1372
767
}
1373
768
 
1374
 
static ProcArg smudge_inargs[] =
1375
 
{
1376
 
  {
1377
 
    GIMP_PDB_DRAWABLE,
1378
 
    "drawable",
1379
 
    "The affected drawable"
1380
 
  },
1381
 
  {
1382
 
    GIMP_PDB_FLOAT,
1383
 
    "pressure",
1384
 
    "The pressure of the smudge strokes (0 <= pressure <= 100)"
1385
 
  },
1386
 
  {
1387
 
    GIMP_PDB_INT32,
1388
 
    "num_strokes",
1389
 
    "Number of stroke control points (count each coordinate as 2 points)"
1390
 
  },
1391
 
  {
1392
 
    GIMP_PDB_FLOATARRAY,
1393
 
    "strokes",
1394
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
1395
 
  }
1396
 
};
1397
 
 
1398
 
static ProcRecord smudge_proc =
1399
 
{
1400
 
  "gimp_smudge",
1401
 
  "Smudge image with varying pressure.",
1402
 
  "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.",
1403
 
  "Spencer Kimball & Peter Mattis",
1404
 
  "Spencer Kimball & Peter Mattis",
1405
 
  "1995-1996",
1406
 
  NULL,
1407
 
  GIMP_INTERNAL,
1408
 
  4,
1409
 
  smudge_inargs,
1410
 
  0,
1411
 
  NULL,
1412
 
  { { smudge_invoker } }
1413
 
};
1414
 
 
1415
 
static Argument *
1416
 
smudge_default_invoker (Gimp         *gimp,
1417
 
                        GimpContext  *context,
1418
 
                        GimpProgress *progress,
1419
 
                        Argument     *args)
 
769
static GValueArray *
 
770
smudge_default_invoker (GimpProcedure     *procedure,
 
771
                        Gimp              *gimp,
 
772
                        GimpContext       *context,
 
773
                        GimpProgress      *progress,
 
774
                        const GValueArray *args)
1420
775
{
1421
776
  gboolean success = TRUE;
1422
777
  GimpDrawable *drawable;
1423
778
  gint32 num_strokes;
1424
 
  gdouble *strokes;
1425
 
 
1426
 
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
1427
 
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
1428
 
    success = FALSE;
1429
 
 
1430
 
  num_strokes = args[1].value.pdb_int;
1431
 
  if (!(num_strokes < 2))
1432
 
    num_strokes /= 2;
1433
 
  else
1434
 
    success = FALSE;
1435
 
 
1436
 
  strokes = (gdouble *) args[2].value.pdb_pointer;
 
779
  const gdouble *strokes;
 
780
 
 
781
  drawable = gimp_value_get_drawable (&args->values[0], gimp);
 
782
  num_strokes = g_value_get_int (&args->values[1]);
 
783
  strokes = gimp_value_get_floatarray (&args->values[2]);
1437
784
 
1438
785
  if (success)
1439
786
    {
1440
787
      GimpPaintInfo *info = (GimpPaintInfo *)
1441
 
        gimp_container_get_child_by_name (gimp->paint_info_list, "GimpSmudge");
 
788
        gimp_container_get_child_by_name (gimp->paint_info_list, "gimp-smudge");
1442
789
 
1443
790
      success = (info && gimp_item_is_attached (GIMP_ITEM (drawable)));
1444
791
 
1447
794
          GimpPaintOptions *options = gimp_paint_options_new (info);
1448
795
 
1449
796
          success = paint_tools_stroke (gimp, context, options, drawable,
1450
 
                                        num_strokes, strokes);
 
797
                                        num_strokes, strokes,
 
798
                                        "undo-desc", info->blurb,
 
799
                                        NULL);
1451
800
        }
1452
801
    }
1453
802
 
1454
 
  return procedural_db_return_args (&smudge_default_proc, success);
1455
 
}
1456
 
 
1457
 
static ProcArg smudge_default_inargs[] =
1458
 
{
1459
 
  {
1460
 
    GIMP_PDB_DRAWABLE,
1461
 
    "drawable",
1462
 
    "The affected drawable"
1463
 
  },
1464
 
  {
1465
 
    GIMP_PDB_INT32,
1466
 
    "num_strokes",
1467
 
    "Number of stroke control points (count each coordinate as 2 points)"
1468
 
  },
1469
 
  {
1470
 
    GIMP_PDB_FLOATARRAY,
1471
 
    "strokes",
1472
 
    "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }"
1473
 
  }
1474
 
};
1475
 
 
1476
 
static ProcRecord smudge_default_proc =
1477
 
{
1478
 
  "gimp_smudge_default",
1479
 
  "Smudge image with varying pressure.",
1480
 
  "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.",
1481
 
  "Andy Thomas",
1482
 
  "Andy Thomas",
1483
 
  "1999",
1484
 
  NULL,
1485
 
  GIMP_INTERNAL,
1486
 
  3,
1487
 
  smudge_default_inargs,
1488
 
  0,
1489
 
  NULL,
1490
 
  { { smudge_default_invoker } }
1491
 
};
 
803
  return gimp_procedure_get_return_values (procedure, success);
 
804
}
 
805
 
 
806
void
 
807
register_paint_tools_procs (GimpPDB *pdb)
 
808
{
 
809
  GimpProcedure *procedure;
 
810
 
 
811
  /*
 
812
   * gimp-airbrush
 
813
   */
 
814
  procedure = gimp_procedure_new (airbrush_invoker);
 
815
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-airbrush");
 
816
  gimp_procedure_set_static_strings (procedure,
 
817
                                     "gimp-airbrush",
 
818
                                     "Paint in the current brush with varying pressure. Paint application is time-dependent.",
 
819
                                     "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.",
 
820
                                     "Spencer Kimball & Peter Mattis",
 
821
                                     "Spencer Kimball & Peter Mattis",
 
822
                                     "1995-1996",
 
823
                                     NULL);
 
824
  gimp_procedure_add_argument (procedure,
 
825
                               gimp_param_spec_drawable_id ("drawable",
 
826
                                                            "drawable",
 
827
                                                            "The affected drawable",
 
828
                                                            pdb->gimp, FALSE,
 
829
                                                            GIMP_PARAM_READWRITE));
 
830
  gimp_procedure_add_argument (procedure,
 
831
                               g_param_spec_double ("pressure",
 
832
                                                    "pressure",
 
833
                                                    "The pressure of the airbrush strokes",
 
834
                                                    0, 100, 0,
 
835
                                                    GIMP_PARAM_READWRITE));
 
836
  gimp_procedure_add_argument (procedure,
 
837
                               gimp_param_spec_int32 ("num-strokes",
 
838
                                                      "num strokes",
 
839
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
840
                                                      2, G_MAXINT32, 2,
 
841
                                                      GIMP_PARAM_READWRITE));
 
842
  gimp_procedure_add_argument (procedure,
 
843
                               gimp_param_spec_float_array ("strokes",
 
844
                                                            "strokes",
 
845
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
846
                                                            GIMP_PARAM_READWRITE));
 
847
  gimp_pdb_register_procedure (pdb, procedure);
 
848
  g_object_unref (procedure);
 
849
 
 
850
  /*
 
851
   * gimp-airbrush-default
 
852
   */
 
853
  procedure = gimp_procedure_new (airbrush_default_invoker);
 
854
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-airbrush-default");
 
855
  gimp_procedure_set_static_strings (procedure,
 
856
                                     "gimp-airbrush-default",
 
857
                                     "Paint in the current brush with varying pressure. Paint application is time-dependent.",
 
858
                                     "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.",
 
859
                                     "Andy Thomas",
 
860
                                     "Andy Thomas",
 
861
                                     "1999",
 
862
                                     NULL);
 
863
  gimp_procedure_add_argument (procedure,
 
864
                               gimp_param_spec_drawable_id ("drawable",
 
865
                                                            "drawable",
 
866
                                                            "The affected drawable",
 
867
                                                            pdb->gimp, FALSE,
 
868
                                                            GIMP_PARAM_READWRITE));
 
869
  gimp_procedure_add_argument (procedure,
 
870
                               gimp_param_spec_int32 ("num-strokes",
 
871
                                                      "num strokes",
 
872
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
873
                                                      2, G_MAXINT32, 2,
 
874
                                                      GIMP_PARAM_READWRITE));
 
875
  gimp_procedure_add_argument (procedure,
 
876
                               gimp_param_spec_float_array ("strokes",
 
877
                                                            "strokes",
 
878
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
879
                                                            GIMP_PARAM_READWRITE));
 
880
  gimp_pdb_register_procedure (pdb, procedure);
 
881
  g_object_unref (procedure);
 
882
 
 
883
  /*
 
884
   * gimp-clone
 
885
   */
 
886
  procedure = gimp_procedure_new (clone_invoker);
 
887
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-clone");
 
888
  gimp_procedure_set_static_strings (procedure,
 
889
                                     "gimp-clone",
 
890
                                     "Clone from the source to the dest drawable using the current brush",
 
891
                                     "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.",
 
892
                                     "Spencer Kimball & Peter Mattis",
 
893
                                     "Spencer Kimball & Peter Mattis",
 
894
                                     "1995-1996",
 
895
                                     NULL);
 
896
  gimp_procedure_add_argument (procedure,
 
897
                               gimp_param_spec_drawable_id ("drawable",
 
898
                                                            "drawable",
 
899
                                                            "The affected drawable",
 
900
                                                            pdb->gimp, FALSE,
 
901
                                                            GIMP_PARAM_READWRITE));
 
902
  gimp_procedure_add_argument (procedure,
 
903
                               gimp_param_spec_drawable_id ("src-drawable",
 
904
                                                            "src drawable",
 
905
                                                            "The source drawable",
 
906
                                                            pdb->gimp, FALSE,
 
907
                                                            GIMP_PARAM_READWRITE));
 
908
  gimp_procedure_add_argument (procedure,
 
909
                               g_param_spec_enum ("clone-type",
 
910
                                                  "clone type",
 
911
                                                  "The type of clone",
 
912
                                                  GIMP_TYPE_CLONE_TYPE,
 
913
                                                  GIMP_IMAGE_CLONE,
 
914
                                                  GIMP_PARAM_READWRITE));
 
915
  gimp_procedure_add_argument (procedure,
 
916
                               g_param_spec_double ("src-x",
 
917
                                                    "src x",
 
918
                                                    "The x coordinate in the source image",
 
919
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
920
                                                    GIMP_PARAM_READWRITE));
 
921
  gimp_procedure_add_argument (procedure,
 
922
                               g_param_spec_double ("src-y",
 
923
                                                    "src y",
 
924
                                                    "The y coordinate in the source image",
 
925
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
926
                                                    GIMP_PARAM_READWRITE));
 
927
  gimp_procedure_add_argument (procedure,
 
928
                               gimp_param_spec_int32 ("num-strokes",
 
929
                                                      "num strokes",
 
930
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
931
                                                      2, G_MAXINT32, 2,
 
932
                                                      GIMP_PARAM_READWRITE));
 
933
  gimp_procedure_add_argument (procedure,
 
934
                               gimp_param_spec_float_array ("strokes",
 
935
                                                            "strokes",
 
936
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
937
                                                            GIMP_PARAM_READWRITE));
 
938
  gimp_pdb_register_procedure (pdb, procedure);
 
939
  g_object_unref (procedure);
 
940
 
 
941
  /*
 
942
   * gimp-clone-default
 
943
   */
 
944
  procedure = gimp_procedure_new (clone_default_invoker);
 
945
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-clone-default");
 
946
  gimp_procedure_set_static_strings (procedure,
 
947
                                     "gimp-clone-default",
 
948
                                     "Clone from the source to the dest drawable using the current brush",
 
949
                                     "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.",
 
950
                                     "Andy Thomas",
 
951
                                     "Andy Thomas",
 
952
                                     "1999",
 
953
                                     NULL);
 
954
  gimp_procedure_add_argument (procedure,
 
955
                               gimp_param_spec_drawable_id ("drawable",
 
956
                                                            "drawable",
 
957
                                                            "The affected drawable",
 
958
                                                            pdb->gimp, FALSE,
 
959
                                                            GIMP_PARAM_READWRITE));
 
960
  gimp_procedure_add_argument (procedure,
 
961
                               gimp_param_spec_int32 ("num-strokes",
 
962
                                                      "num strokes",
 
963
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
964
                                                      2, G_MAXINT32, 2,
 
965
                                                      GIMP_PARAM_READWRITE));
 
966
  gimp_procedure_add_argument (procedure,
 
967
                               gimp_param_spec_float_array ("strokes",
 
968
                                                            "strokes",
 
969
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
970
                                                            GIMP_PARAM_READWRITE));
 
971
  gimp_pdb_register_procedure (pdb, procedure);
 
972
  g_object_unref (procedure);
 
973
 
 
974
  /*
 
975
   * gimp-convolve
 
976
   */
 
977
  procedure = gimp_procedure_new (convolve_invoker);
 
978
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-convolve");
 
979
  gimp_procedure_set_static_strings (procedure,
 
980
                                     "gimp-convolve",
 
981
                                     "Convolve (Blur, Sharpen) using the current brush.",
 
982
                                     "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.",
 
983
                                     "Spencer Kimball & Peter Mattis",
 
984
                                     "Spencer Kimball & Peter Mattis",
 
985
                                     "1995-1996",
 
986
                                     NULL);
 
987
  gimp_procedure_add_argument (procedure,
 
988
                               gimp_param_spec_drawable_id ("drawable",
 
989
                                                            "drawable",
 
990
                                                            "The affected drawable",
 
991
                                                            pdb->gimp, FALSE,
 
992
                                                            GIMP_PARAM_READWRITE));
 
993
  gimp_procedure_add_argument (procedure,
 
994
                               g_param_spec_double ("pressure",
 
995
                                                    "pressure",
 
996
                                                    "The pressure",
 
997
                                                    0, 100, 0,
 
998
                                                    GIMP_PARAM_READWRITE));
 
999
  gimp_procedure_add_argument (procedure,
 
1000
                               g_param_spec_enum ("convolve-type",
 
1001
                                                  "convolve type",
 
1002
                                                  "Convolve type",
 
1003
                                                  GIMP_TYPE_CONVOLVE_TYPE,
 
1004
                                                  GIMP_BLUR_CONVOLVE,
 
1005
                                                  GIMP_PARAM_READWRITE));
 
1006
  gimp_procedure_add_argument (procedure,
 
1007
                               gimp_param_spec_int32 ("num-strokes",
 
1008
                                                      "num strokes",
 
1009
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1010
                                                      2, G_MAXINT32, 2,
 
1011
                                                      GIMP_PARAM_READWRITE));
 
1012
  gimp_procedure_add_argument (procedure,
 
1013
                               gimp_param_spec_float_array ("strokes",
 
1014
                                                            "strokes",
 
1015
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1016
                                                            GIMP_PARAM_READWRITE));
 
1017
  gimp_pdb_register_procedure (pdb, procedure);
 
1018
  g_object_unref (procedure);
 
1019
 
 
1020
  /*
 
1021
   * gimp-convolve-default
 
1022
   */
 
1023
  procedure = gimp_procedure_new (convolve_default_invoker);
 
1024
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-convolve-default");
 
1025
  gimp_procedure_set_static_strings (procedure,
 
1026
                                     "gimp-convolve-default",
 
1027
                                     "Convolve (Blur, Sharpen) using the current brush.",
 
1028
                                     "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.",
 
1029
                                     "Andy Thomas",
 
1030
                                     "Andy Thomas",
 
1031
                                     "1999",
 
1032
                                     NULL);
 
1033
  gimp_procedure_add_argument (procedure,
 
1034
                               gimp_param_spec_drawable_id ("drawable",
 
1035
                                                            "drawable",
 
1036
                                                            "The affected drawable",
 
1037
                                                            pdb->gimp, FALSE,
 
1038
                                                            GIMP_PARAM_READWRITE));
 
1039
  gimp_procedure_add_argument (procedure,
 
1040
                               gimp_param_spec_int32 ("num-strokes",
 
1041
                                                      "num strokes",
 
1042
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1043
                                                      2, G_MAXINT32, 2,
 
1044
                                                      GIMP_PARAM_READWRITE));
 
1045
  gimp_procedure_add_argument (procedure,
 
1046
                               gimp_param_spec_float_array ("strokes",
 
1047
                                                            "strokes",
 
1048
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1049
                                                            GIMP_PARAM_READWRITE));
 
1050
  gimp_pdb_register_procedure (pdb, procedure);
 
1051
  g_object_unref (procedure);
 
1052
 
 
1053
  /*
 
1054
   * gimp-dodgeburn
 
1055
   */
 
1056
  procedure = gimp_procedure_new (dodgeburn_invoker);
 
1057
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-dodgeburn");
 
1058
  gimp_procedure_set_static_strings (procedure,
 
1059
                                     "gimp-dodgeburn",
 
1060
                                     "Dodgeburn image with varying exposure.",
 
1061
                                     "Dodgeburn. More details here later.",
 
1062
                                     "Andy Thomas",
 
1063
                                     "Andy Thomas",
 
1064
                                     "1999",
 
1065
                                     NULL);
 
1066
  gimp_procedure_add_argument (procedure,
 
1067
                               gimp_param_spec_drawable_id ("drawable",
 
1068
                                                            "drawable",
 
1069
                                                            "The affected drawable",
 
1070
                                                            pdb->gimp, FALSE,
 
1071
                                                            GIMP_PARAM_READWRITE));
 
1072
  gimp_procedure_add_argument (procedure,
 
1073
                               g_param_spec_double ("exposure",
 
1074
                                                    "exposure",
 
1075
                                                    "The exposure of the strokes",
 
1076
                                                    0, 100, 0,
 
1077
                                                    GIMP_PARAM_READWRITE));
 
1078
  gimp_procedure_add_argument (procedure,
 
1079
                               g_param_spec_enum ("dodgeburn-type",
 
1080
                                                  "dodgeburn type",
 
1081
                                                  "The type either dodge or burn",
 
1082
                                                  GIMP_TYPE_DODGE_BURN_TYPE,
 
1083
                                                  GIMP_DODGE,
 
1084
                                                  GIMP_PARAM_READWRITE));
 
1085
  gimp_procedure_add_argument (procedure,
 
1086
                               g_param_spec_enum ("dodgeburn-mode",
 
1087
                                                  "dodgeburn mode",
 
1088
                                                  "The mode",
 
1089
                                                  GIMP_TYPE_TRANSFER_MODE,
 
1090
                                                  GIMP_SHADOWS,
 
1091
                                                  GIMP_PARAM_READWRITE));
 
1092
  gimp_procedure_add_argument (procedure,
 
1093
                               gimp_param_spec_int32 ("num-strokes",
 
1094
                                                      "num strokes",
 
1095
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1096
                                                      2, G_MAXINT32, 2,
 
1097
                                                      GIMP_PARAM_READWRITE));
 
1098
  gimp_procedure_add_argument (procedure,
 
1099
                               gimp_param_spec_float_array ("strokes",
 
1100
                                                            "strokes",
 
1101
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1102
                                                            GIMP_PARAM_READWRITE));
 
1103
  gimp_pdb_register_procedure (pdb, procedure);
 
1104
  g_object_unref (procedure);
 
1105
 
 
1106
  /*
 
1107
   * gimp-dodgeburn-default
 
1108
   */
 
1109
  procedure = gimp_procedure_new (dodgeburn_default_invoker);
 
1110
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-dodgeburn-default");
 
1111
  gimp_procedure_set_static_strings (procedure,
 
1112
                                     "gimp-dodgeburn-default",
 
1113
                                     "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.",
 
1114
                                     "Dodgeburn. More details here later.",
 
1115
                                     "Spencer Kimball & Peter Mattis",
 
1116
                                     "Spencer Kimball & Peter Mattis",
 
1117
                                     "1995-1996",
 
1118
                                     NULL);
 
1119
  gimp_procedure_add_argument (procedure,
 
1120
                               gimp_param_spec_drawable_id ("drawable",
 
1121
                                                            "drawable",
 
1122
                                                            "The affected drawable",
 
1123
                                                            pdb->gimp, FALSE,
 
1124
                                                            GIMP_PARAM_READWRITE));
 
1125
  gimp_procedure_add_argument (procedure,
 
1126
                               gimp_param_spec_int32 ("num-strokes",
 
1127
                                                      "num strokes",
 
1128
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1129
                                                      2, G_MAXINT32, 2,
 
1130
                                                      GIMP_PARAM_READWRITE));
 
1131
  gimp_procedure_add_argument (procedure,
 
1132
                               gimp_param_spec_float_array ("strokes",
 
1133
                                                            "strokes",
 
1134
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1135
                                                            GIMP_PARAM_READWRITE));
 
1136
  gimp_pdb_register_procedure (pdb, procedure);
 
1137
  g_object_unref (procedure);
 
1138
 
 
1139
  /*
 
1140
   * gimp-eraser
 
1141
   */
 
1142
  procedure = gimp_procedure_new (eraser_invoker);
 
1143
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-eraser");
 
1144
  gimp_procedure_set_static_strings (procedure,
 
1145
                                     "gimp-eraser",
 
1146
                                     "Erase using the current brush.",
 
1147
                                     "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.",
 
1148
                                     "Spencer Kimball & Peter Mattis",
 
1149
                                     "Spencer Kimball & Peter Mattis",
 
1150
                                     "1995-1996",
 
1151
                                     NULL);
 
1152
  gimp_procedure_add_argument (procedure,
 
1153
                               gimp_param_spec_drawable_id ("drawable",
 
1154
                                                            "drawable",
 
1155
                                                            "The affected drawable",
 
1156
                                                            pdb->gimp, FALSE,
 
1157
                                                            GIMP_PARAM_READWRITE));
 
1158
  gimp_procedure_add_argument (procedure,
 
1159
                               gimp_param_spec_int32 ("num-strokes",
 
1160
                                                      "num strokes",
 
1161
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1162
                                                      2, G_MAXINT32, 2,
 
1163
                                                      GIMP_PARAM_READWRITE));
 
1164
  gimp_procedure_add_argument (procedure,
 
1165
                               gimp_param_spec_float_array ("strokes",
 
1166
                                                            "strokes",
 
1167
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1168
                                                            GIMP_PARAM_READWRITE));
 
1169
  gimp_procedure_add_argument (procedure,
 
1170
                               g_param_spec_enum ("hardness",
 
1171
                                                  "hardness",
 
1172
                                                  "How to apply the brush",
 
1173
                                                  GIMP_TYPE_BRUSH_APPLICATION_MODE,
 
1174
                                                  GIMP_BRUSH_HARD,
 
1175
                                                  GIMP_PARAM_READWRITE));
 
1176
  gimp_procedure_add_argument (procedure,
 
1177
                               g_param_spec_enum ("method",
 
1178
                                                  "method",
 
1179
                                                  "The paint method to use",
 
1180
                                                  GIMP_TYPE_PAINT_APPLICATION_MODE,
 
1181
                                                  GIMP_PAINT_CONSTANT,
 
1182
                                                  GIMP_PARAM_READWRITE));
 
1183
  gimp_pdb_register_procedure (pdb, procedure);
 
1184
  g_object_unref (procedure);
 
1185
 
 
1186
  /*
 
1187
   * gimp-eraser-default
 
1188
   */
 
1189
  procedure = gimp_procedure_new (eraser_default_invoker);
 
1190
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-eraser-default");
 
1191
  gimp_procedure_set_static_strings (procedure,
 
1192
                                     "gimp-eraser-default",
 
1193
                                     "Erase using the current brush.",
 
1194
                                     "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.",
 
1195
                                     "Andy Thomas",
 
1196
                                     "Andy Thomas",
 
1197
                                     "1999",
 
1198
                                     NULL);
 
1199
  gimp_procedure_add_argument (procedure,
 
1200
                               gimp_param_spec_drawable_id ("drawable",
 
1201
                                                            "drawable",
 
1202
                                                            "The affected drawable",
 
1203
                                                            pdb->gimp, FALSE,
 
1204
                                                            GIMP_PARAM_READWRITE));
 
1205
  gimp_procedure_add_argument (procedure,
 
1206
                               gimp_param_spec_int32 ("num-strokes",
 
1207
                                                      "num strokes",
 
1208
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1209
                                                      2, G_MAXINT32, 2,
 
1210
                                                      GIMP_PARAM_READWRITE));
 
1211
  gimp_procedure_add_argument (procedure,
 
1212
                               gimp_param_spec_float_array ("strokes",
 
1213
                                                            "strokes",
 
1214
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1215
                                                            GIMP_PARAM_READWRITE));
 
1216
  gimp_pdb_register_procedure (pdb, procedure);
 
1217
  g_object_unref (procedure);
 
1218
 
 
1219
  /*
 
1220
   * gimp-heal
 
1221
   */
 
1222
  procedure = gimp_procedure_new (heal_invoker);
 
1223
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-heal");
 
1224
  gimp_procedure_set_static_strings (procedure,
 
1225
                                     "gimp-heal",
 
1226
                                     "Heal from the source to the dest drawable using the current brush",
 
1227
                                     "This tool heals the source drawable starting at the specified source coordinates to the dest drawable. For image healing, if the sum of the src coordinates and subsequent stroke offsets exceeds the extents of the src drawable, then no paint is transferred. The healing tool is capable of transforming between any image types except RGB->Indexed.",
 
1228
                                     "Kevin Sookocheff",
 
1229
                                     "Kevin Sookocheff",
 
1230
                                     "2006",
 
1231
                                     NULL);
 
1232
  gimp_procedure_add_argument (procedure,
 
1233
                               gimp_param_spec_drawable_id ("drawable",
 
1234
                                                            "drawable",
 
1235
                                                            "The affected drawable",
 
1236
                                                            pdb->gimp, FALSE,
 
1237
                                                            GIMP_PARAM_READWRITE));
 
1238
  gimp_procedure_add_argument (procedure,
 
1239
                               gimp_param_spec_drawable_id ("src-drawable",
 
1240
                                                            "src drawable",
 
1241
                                                            "The source drawable",
 
1242
                                                            pdb->gimp, FALSE,
 
1243
                                                            GIMP_PARAM_READWRITE));
 
1244
  gimp_procedure_add_argument (procedure,
 
1245
                               g_param_spec_double ("src-x",
 
1246
                                                    "src x",
 
1247
                                                    "The x coordinate in the source image",
 
1248
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1249
                                                    GIMP_PARAM_READWRITE));
 
1250
  gimp_procedure_add_argument (procedure,
 
1251
                               g_param_spec_double ("src-y",
 
1252
                                                    "src y",
 
1253
                                                    "The y coordinate in the source image",
 
1254
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1255
                                                    GIMP_PARAM_READWRITE));
 
1256
  gimp_procedure_add_argument (procedure,
 
1257
                               gimp_param_spec_int32 ("num-strokes",
 
1258
                                                      "num strokes",
 
1259
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1260
                                                      2, G_MAXINT32, 2,
 
1261
                                                      GIMP_PARAM_READWRITE));
 
1262
  gimp_procedure_add_argument (procedure,
 
1263
                               gimp_param_spec_float_array ("strokes",
 
1264
                                                            "strokes",
 
1265
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1266
                                                            GIMP_PARAM_READWRITE));
 
1267
  gimp_pdb_register_procedure (pdb, procedure);
 
1268
  g_object_unref (procedure);
 
1269
 
 
1270
  /*
 
1271
   * gimp-heal-default
 
1272
   */
 
1273
  procedure = gimp_procedure_new (heal_default_invoker);
 
1274
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-heal-default");
 
1275
  gimp_procedure_set_static_strings (procedure,
 
1276
                                     "gimp-heal-default",
 
1277
                                     "Heal from the source to the dest drawable using the current brush",
 
1278
                                     "This tool heals from the source drawable starting at the specified source coordinates to the dest drawable. This function performs exactly the same as the 'gimp-heal' function except that the tools arguments are obtained from the healing option dialog. It this dialog has not been activated then the dialogs default values will be used.",
 
1279
                                     "Kevin Sookocheff",
 
1280
                                     "Kevin Sookocheff",
 
1281
                                     "2006",
 
1282
                                     NULL);
 
1283
  gimp_procedure_add_argument (procedure,
 
1284
                               gimp_param_spec_drawable_id ("drawable",
 
1285
                                                            "drawable",
 
1286
                                                            "The affected drawable",
 
1287
                                                            pdb->gimp, FALSE,
 
1288
                                                            GIMP_PARAM_READWRITE));
 
1289
  gimp_procedure_add_argument (procedure,
 
1290
                               gimp_param_spec_int32 ("num-strokes",
 
1291
                                                      "num strokes",
 
1292
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1293
                                                      2, G_MAXINT32, 2,
 
1294
                                                      GIMP_PARAM_READWRITE));
 
1295
  gimp_procedure_add_argument (procedure,
 
1296
                               gimp_param_spec_float_array ("strokes",
 
1297
                                                            "strokes",
 
1298
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1299
                                                            GIMP_PARAM_READWRITE));
 
1300
  gimp_pdb_register_procedure (pdb, procedure);
 
1301
  g_object_unref (procedure);
 
1302
 
 
1303
  /*
 
1304
   * gimp-paintbrush
 
1305
   */
 
1306
  procedure = gimp_procedure_new (paintbrush_invoker);
 
1307
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-paintbrush");
 
1308
  gimp_procedure_set_static_strings (procedure,
 
1309
                                     "gimp-paintbrush",
 
1310
                                     "Paint in the current brush with optional fade out parameter and pull colors from a gradient.",
 
1311
                                     "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.",
 
1312
                                     "Spencer Kimball & Peter Mattis",
 
1313
                                     "Spencer Kimball & Peter Mattis",
 
1314
                                     "1995-1996",
 
1315
                                     NULL);
 
1316
  gimp_procedure_add_argument (procedure,
 
1317
                               gimp_param_spec_drawable_id ("drawable",
 
1318
                                                            "drawable",
 
1319
                                                            "The affected drawable",
 
1320
                                                            pdb->gimp, FALSE,
 
1321
                                                            GIMP_PARAM_READWRITE));
 
1322
  gimp_procedure_add_argument (procedure,
 
1323
                               g_param_spec_double ("fade-out",
 
1324
                                                    "fade out",
 
1325
                                                    "Fade out parameter",
 
1326
                                                    0, G_MAXDOUBLE, 0,
 
1327
                                                    GIMP_PARAM_READWRITE));
 
1328
  gimp_procedure_add_argument (procedure,
 
1329
                               gimp_param_spec_int32 ("num-strokes",
 
1330
                                                      "num strokes",
 
1331
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1332
                                                      2, G_MAXINT32, 2,
 
1333
                                                      GIMP_PARAM_READWRITE));
 
1334
  gimp_procedure_add_argument (procedure,
 
1335
                               gimp_param_spec_float_array ("strokes",
 
1336
                                                            "strokes",
 
1337
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1338
                                                            GIMP_PARAM_READWRITE));
 
1339
  gimp_procedure_add_argument (procedure,
 
1340
                               g_param_spec_enum ("method",
 
1341
                                                  "method",
 
1342
                                                  "The paint method to use",
 
1343
                                                  GIMP_TYPE_PAINT_APPLICATION_MODE,
 
1344
                                                  GIMP_PAINT_CONSTANT,
 
1345
                                                  GIMP_PARAM_READWRITE));
 
1346
  gimp_procedure_add_argument (procedure,
 
1347
                               g_param_spec_double ("gradient-length",
 
1348
                                                    "gradient length",
 
1349
                                                    "Length of gradient to draw",
 
1350
                                                    0, G_MAXDOUBLE, 0,
 
1351
                                                    GIMP_PARAM_READWRITE));
 
1352
  gimp_pdb_register_procedure (pdb, procedure);
 
1353
  g_object_unref (procedure);
 
1354
 
 
1355
  /*
 
1356
   * gimp-paintbrush-default
 
1357
   */
 
1358
  procedure = gimp_procedure_new (paintbrush_default_invoker);
 
1359
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-paintbrush-default");
 
1360
  gimp_procedure_set_static_strings (procedure,
 
1361
                                     "gimp-paintbrush-default",
 
1362
                                     "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.",
 
1363
                                     "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.",
 
1364
                                     "Andy Thomas",
 
1365
                                     "Andy Thomas",
 
1366
                                     "1999",
 
1367
                                     NULL);
 
1368
  gimp_procedure_add_argument (procedure,
 
1369
                               gimp_param_spec_drawable_id ("drawable",
 
1370
                                                            "drawable",
 
1371
                                                            "The affected drawable",
 
1372
                                                            pdb->gimp, FALSE,
 
1373
                                                            GIMP_PARAM_READWRITE));
 
1374
  gimp_procedure_add_argument (procedure,
 
1375
                               gimp_param_spec_int32 ("num-strokes",
 
1376
                                                      "num strokes",
 
1377
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1378
                                                      2, G_MAXINT32, 2,
 
1379
                                                      GIMP_PARAM_READWRITE));
 
1380
  gimp_procedure_add_argument (procedure,
 
1381
                               gimp_param_spec_float_array ("strokes",
 
1382
                                                            "strokes",
 
1383
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1384
                                                            GIMP_PARAM_READWRITE));
 
1385
  gimp_pdb_register_procedure (pdb, procedure);
 
1386
  g_object_unref (procedure);
 
1387
 
 
1388
  /*
 
1389
   * gimp-pencil
 
1390
   */
 
1391
  procedure = gimp_procedure_new (pencil_invoker);
 
1392
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-pencil");
 
1393
  gimp_procedure_set_static_strings (procedure,
 
1394
                                     "gimp-pencil",
 
1395
                                     "Paint in the current brush without sub-pixel sampling.",
 
1396
                                     "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.",
 
1397
                                     "Spencer Kimball & Peter Mattis",
 
1398
                                     "Spencer Kimball & Peter Mattis",
 
1399
                                     "1995-1996",
 
1400
                                     NULL);
 
1401
  gimp_procedure_add_argument (procedure,
 
1402
                               gimp_param_spec_drawable_id ("drawable",
 
1403
                                                            "drawable",
 
1404
                                                            "The affected drawable",
 
1405
                                                            pdb->gimp, FALSE,
 
1406
                                                            GIMP_PARAM_READWRITE));
 
1407
  gimp_procedure_add_argument (procedure,
 
1408
                               gimp_param_spec_int32 ("num-strokes",
 
1409
                                                      "num strokes",
 
1410
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1411
                                                      2, G_MAXINT32, 2,
 
1412
                                                      GIMP_PARAM_READWRITE));
 
1413
  gimp_procedure_add_argument (procedure,
 
1414
                               gimp_param_spec_float_array ("strokes",
 
1415
                                                            "strokes",
 
1416
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1417
                                                            GIMP_PARAM_READWRITE));
 
1418
  gimp_pdb_register_procedure (pdb, procedure);
 
1419
  g_object_unref (procedure);
 
1420
 
 
1421
  /*
 
1422
   * gimp-smudge
 
1423
   */
 
1424
  procedure = gimp_procedure_new (smudge_invoker);
 
1425
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-smudge");
 
1426
  gimp_procedure_set_static_strings (procedure,
 
1427
                                     "gimp-smudge",
 
1428
                                     "Smudge image with varying pressure.",
 
1429
                                     "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.",
 
1430
                                     "Spencer Kimball & Peter Mattis",
 
1431
                                     "Spencer Kimball & Peter Mattis",
 
1432
                                     "1995-1996",
 
1433
                                     NULL);
 
1434
  gimp_procedure_add_argument (procedure,
 
1435
                               gimp_param_spec_drawable_id ("drawable",
 
1436
                                                            "drawable",
 
1437
                                                            "The affected drawable",
 
1438
                                                            pdb->gimp, FALSE,
 
1439
                                                            GIMP_PARAM_READWRITE));
 
1440
  gimp_procedure_add_argument (procedure,
 
1441
                               g_param_spec_double ("pressure",
 
1442
                                                    "pressure",
 
1443
                                                    "The pressure of the smudge strokes",
 
1444
                                                    0, 100, 0,
 
1445
                                                    GIMP_PARAM_READWRITE));
 
1446
  gimp_procedure_add_argument (procedure,
 
1447
                               gimp_param_spec_int32 ("num-strokes",
 
1448
                                                      "num strokes",
 
1449
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1450
                                                      2, G_MAXINT32, 2,
 
1451
                                                      GIMP_PARAM_READWRITE));
 
1452
  gimp_procedure_add_argument (procedure,
 
1453
                               gimp_param_spec_float_array ("strokes",
 
1454
                                                            "strokes",
 
1455
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1456
                                                            GIMP_PARAM_READWRITE));
 
1457
  gimp_pdb_register_procedure (pdb, procedure);
 
1458
  g_object_unref (procedure);
 
1459
 
 
1460
  /*
 
1461
   * gimp-smudge-default
 
1462
   */
 
1463
  procedure = gimp_procedure_new (smudge_default_invoker);
 
1464
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-smudge-default");
 
1465
  gimp_procedure_set_static_strings (procedure,
 
1466
                                     "gimp-smudge-default",
 
1467
                                     "Smudge image with varying pressure.",
 
1468
                                     "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.",
 
1469
                                     "Andy Thomas",
 
1470
                                     "Andy Thomas",
 
1471
                                     "1999",
 
1472
                                     NULL);
 
1473
  gimp_procedure_add_argument (procedure,
 
1474
                               gimp_param_spec_drawable_id ("drawable",
 
1475
                                                            "drawable",
 
1476
                                                            "The affected drawable",
 
1477
                                                            pdb->gimp, FALSE,
 
1478
                                                            GIMP_PARAM_READWRITE));
 
1479
  gimp_procedure_add_argument (procedure,
 
1480
                               gimp_param_spec_int32 ("num-strokes",
 
1481
                                                      "num strokes",
 
1482
                                                      "Number of stroke control points (count each coordinate as 2 points)",
 
1483
                                                      2, G_MAXINT32, 2,
 
1484
                                                      GIMP_PARAM_READWRITE));
 
1485
  gimp_procedure_add_argument (procedure,
 
1486
                               gimp_param_spec_float_array ("strokes",
 
1487
                                                            "strokes",
 
1488
                                                            "Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }",
 
1489
                                                            GIMP_PARAM_READWRITE));
 
1490
  gimp_pdb_register_procedure (pdb, procedure);
 
1491
  g_object_unref (procedure);
 
1492
}