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

« back to all changes in this revision

Viewing changes to app/pdb/vectors-cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
#include <string.h>
 
24
 
 
25
#include <glib-object.h>
 
26
 
 
27
#include "pdb-types.h"
 
28
 
 
29
#include "core/gimpchannel-select.h"
 
30
#include "core/gimpimage.h"
 
31
#include "core/gimplayer.h"
 
32
#include "core/gimplist.h"
 
33
#include "core/gimpparamspecs.h"
 
34
#include "text/gimptext-vectors.h"
 
35
#include "text/gimptextlayer.h"
 
36
#include "vectors/gimpanchor.h"
 
37
#include "vectors/gimpbezierstroke.h"
 
38
#include "vectors/gimpstroke-new.h"
 
39
#include "vectors/gimpvectors-export.h"
 
40
#include "vectors/gimpvectors-import.h"
 
41
#include "vectors/gimpvectors.h"
 
42
 
 
43
#include "gimppdb.h"
 
44
#include "gimppdb-utils.h"
 
45
#include "gimpprocedure.h"
 
46
#include "internal-procs.h"
 
47
 
 
48
#include "gimp-intl.h"
 
49
 
 
50
 
 
51
static GValueArray *
 
52
vectors_is_valid_invoker (GimpProcedure      *procedure,
 
53
                          Gimp               *gimp,
 
54
                          GimpContext        *context,
 
55
                          GimpProgress       *progress,
 
56
                          const GValueArray  *args,
 
57
                          GError            **error)
 
58
{
 
59
  GValueArray *return_vals;
 
60
  GimpVectors *vectors;
 
61
  gboolean valid = FALSE;
 
62
 
 
63
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
64
 
 
65
  valid = (GIMP_IS_VECTORS (vectors) &&
 
66
           ! gimp_item_is_removed (GIMP_ITEM (vectors)));
 
67
 
 
68
  return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
 
69
  g_value_set_boolean (&return_vals->values[1], valid);
 
70
 
 
71
  return return_vals;
 
72
}
 
73
 
 
74
static GValueArray *
 
75
vectors_new_invoker (GimpProcedure      *procedure,
 
76
                     Gimp               *gimp,
 
77
                     GimpContext        *context,
 
78
                     GimpProgress       *progress,
 
79
                     const GValueArray  *args,
 
80
                     GError            **error)
 
81
{
 
82
  gboolean success = TRUE;
 
83
  GValueArray *return_vals;
 
84
  GimpImage *image;
 
85
  const gchar *name;
 
86
  GimpVectors *vectors = NULL;
 
87
 
 
88
  image = gimp_value_get_image (&args->values[0], gimp);
 
89
  name = g_value_get_string (&args->values[1]);
 
90
 
 
91
  if (success)
 
92
    {
 
93
      vectors = gimp_vectors_new (image, name);
 
94
    }
 
95
 
 
96
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
97
                                                  error ? *error : NULL);
 
98
 
 
99
  if (success)
 
100
    gimp_value_set_vectors (&return_vals->values[1], vectors);
 
101
 
 
102
  return return_vals;
 
103
}
 
104
 
 
105
static GValueArray *
 
106
vectors_new_from_text_layer_invoker (GimpProcedure      *procedure,
 
107
                                     Gimp               *gimp,
 
108
                                     GimpContext        *context,
 
109
                                     GimpProgress       *progress,
 
110
                                     const GValueArray  *args,
 
111
                                     GError            **error)
 
112
{
 
113
  gboolean success = TRUE;
 
114
  GValueArray *return_vals;
 
115
  GimpImage *image;
 
116
  GimpLayer *layer;
 
117
  GimpVectors *vectors = NULL;
 
118
 
 
119
  image = gimp_value_get_image (&args->values[0], gimp);
 
120
  layer = gimp_value_get_layer (&args->values[1], gimp);
 
121
 
 
122
  if (success)
 
123
    {
 
124
      if (gimp_pdb_layer_is_text_layer (layer, error))
 
125
        {
 
126
          gint x, y;
 
127
 
 
128
          vectors = gimp_text_vectors_new (image,
 
129
                                           gimp_text_layer_get_text (GIMP_TEXT_LAYER (layer)));
 
130
 
 
131
          gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
 
132
          gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
 
133
        }
 
134
      else
 
135
        {
 
136
          success = FALSE;
 
137
        }
 
138
    }
 
139
 
 
140
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
141
                                                  error ? *error : NULL);
 
142
 
 
143
  if (success)
 
144
    gimp_value_set_vectors (&return_vals->values[1], vectors);
 
145
 
 
146
  return return_vals;
 
147
}
 
148
 
 
149
static GValueArray *
 
150
vectors_copy_invoker (GimpProcedure      *procedure,
 
151
                      Gimp               *gimp,
 
152
                      GimpContext        *context,
 
153
                      GimpProgress       *progress,
 
154
                      const GValueArray  *args,
 
155
                      GError            **error)
 
156
{
 
157
  gboolean success = TRUE;
 
158
  GValueArray *return_vals;
 
159
  GimpVectors *vectors;
 
160
  GimpVectors *vectors_copy = NULL;
 
161
 
 
162
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
163
 
 
164
  if (success)
 
165
    {
 
166
      vectors_copy = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
 
167
                                   G_TYPE_FROM_INSTANCE (vectors)));
 
168
 
 
169
      if (! vectors_copy)
 
170
        success = FALSE;
 
171
    }
 
172
 
 
173
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
174
                                                  error ? *error : NULL);
 
175
 
 
176
  if (success)
 
177
    gimp_value_set_vectors (&return_vals->values[1], vectors_copy);
 
178
 
 
179
  return return_vals;
 
180
}
 
181
 
 
182
static GValueArray *
 
183
vectors_get_image_invoker (GimpProcedure      *procedure,
 
184
                           Gimp               *gimp,
 
185
                           GimpContext        *context,
 
186
                           GimpProgress       *progress,
 
187
                           const GValueArray  *args,
 
188
                           GError            **error)
 
189
{
 
190
  gboolean success = TRUE;
 
191
  GValueArray *return_vals;
 
192
  GimpVectors *vectors;
 
193
  GimpImage *image = NULL;
 
194
 
 
195
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
196
 
 
197
  if (success)
 
198
    {
 
199
      image = gimp_item_get_image (GIMP_ITEM (vectors));
 
200
    }
 
201
 
 
202
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
203
                                                  error ? *error : NULL);
 
204
 
 
205
  if (success)
 
206
    gimp_value_set_image (&return_vals->values[1], image);
 
207
 
 
208
  return return_vals;
 
209
}
 
210
 
 
211
static GValueArray *
 
212
vectors_get_name_invoker (GimpProcedure      *procedure,
 
213
                          Gimp               *gimp,
 
214
                          GimpContext        *context,
 
215
                          GimpProgress       *progress,
 
216
                          const GValueArray  *args,
 
217
                          GError            **error)
 
218
{
 
219
  gboolean success = TRUE;
 
220
  GValueArray *return_vals;
 
221
  GimpVectors *vectors;
 
222
  gchar *name = NULL;
 
223
 
 
224
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
225
 
 
226
  if (success)
 
227
    {
 
228
      name = g_strdup (gimp_object_get_name (GIMP_OBJECT (vectors)));
 
229
    }
 
230
 
 
231
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
232
                                                  error ? *error : NULL);
 
233
 
 
234
  if (success)
 
235
    g_value_take_string (&return_vals->values[1], name);
 
236
 
 
237
  return return_vals;
 
238
}
 
239
 
 
240
static GValueArray *
 
241
vectors_set_name_invoker (GimpProcedure      *procedure,
 
242
                          Gimp               *gimp,
 
243
                          GimpContext        *context,
 
244
                          GimpProgress       *progress,
 
245
                          const GValueArray  *args,
 
246
                          GError            **error)
 
247
{
 
248
  gboolean success = TRUE;
 
249
  GimpVectors *vectors;
 
250
  const gchar *name;
 
251
 
 
252
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
253
  name = g_value_get_string (&args->values[1]);
 
254
 
 
255
  if (success)
 
256
    {
 
257
      success = gimp_item_rename (GIMP_ITEM (vectors), name, error);
 
258
    }
 
259
 
 
260
  return gimp_procedure_get_return_values (procedure, success,
 
261
                                           error ? *error : NULL);
 
262
}
 
263
 
 
264
static GValueArray *
 
265
vectors_get_visible_invoker (GimpProcedure      *procedure,
 
266
                             Gimp               *gimp,
 
267
                             GimpContext        *context,
 
268
                             GimpProgress       *progress,
 
269
                             const GValueArray  *args,
 
270
                             GError            **error)
 
271
{
 
272
  gboolean success = TRUE;
 
273
  GValueArray *return_vals;
 
274
  GimpVectors *vectors;
 
275
  gboolean visible = FALSE;
 
276
 
 
277
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
278
 
 
279
  if (success)
 
280
    {
 
281
      visible = gimp_item_get_visible (GIMP_ITEM (vectors));
 
282
    }
 
283
 
 
284
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
285
                                                  error ? *error : NULL);
 
286
 
 
287
  if (success)
 
288
    g_value_set_boolean (&return_vals->values[1], visible);
 
289
 
 
290
  return return_vals;
 
291
}
 
292
 
 
293
static GValueArray *
 
294
vectors_set_visible_invoker (GimpProcedure      *procedure,
 
295
                             Gimp               *gimp,
 
296
                             GimpContext        *context,
 
297
                             GimpProgress       *progress,
 
298
                             const GValueArray  *args,
 
299
                             GError            **error)
 
300
{
 
301
  gboolean success = TRUE;
 
302
  GimpVectors *vectors;
 
303
  gboolean visible;
 
304
 
 
305
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
306
  visible = g_value_get_boolean (&args->values[1]);
 
307
 
 
308
  if (success)
 
309
    {
 
310
      gimp_item_set_visible (GIMP_ITEM (vectors), visible, TRUE);
 
311
    }
 
312
 
 
313
  return gimp_procedure_get_return_values (procedure, success,
 
314
                                           error ? *error : NULL);
 
315
}
 
316
 
 
317
static GValueArray *
 
318
vectors_get_linked_invoker (GimpProcedure      *procedure,
 
319
                            Gimp               *gimp,
 
320
                            GimpContext        *context,
 
321
                            GimpProgress       *progress,
 
322
                            const GValueArray  *args,
 
323
                            GError            **error)
 
324
{
 
325
  gboolean success = TRUE;
 
326
  GValueArray *return_vals;
 
327
  GimpVectors *vectors;
 
328
  gboolean linked = FALSE;
 
329
 
 
330
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
331
 
 
332
  if (success)
 
333
    {
 
334
      linked = gimp_item_get_linked (GIMP_ITEM (vectors));
 
335
    }
 
336
 
 
337
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
338
                                                  error ? *error : NULL);
 
339
 
 
340
  if (success)
 
341
    g_value_set_boolean (&return_vals->values[1], linked);
 
342
 
 
343
  return return_vals;
 
344
}
 
345
 
 
346
static GValueArray *
 
347
vectors_set_linked_invoker (GimpProcedure      *procedure,
 
348
                            Gimp               *gimp,
 
349
                            GimpContext        *context,
 
350
                            GimpProgress       *progress,
 
351
                            const GValueArray  *args,
 
352
                            GError            **error)
 
353
{
 
354
  gboolean success = TRUE;
 
355
  GimpVectors *vectors;
 
356
  gboolean linked;
 
357
 
 
358
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
359
  linked = g_value_get_boolean (&args->values[1]);
 
360
 
 
361
  if (success)
 
362
    {
 
363
      gimp_item_set_linked (GIMP_ITEM (vectors), linked, TRUE);
 
364
    }
 
365
 
 
366
  return gimp_procedure_get_return_values (procedure, success,
 
367
                                           error ? *error : NULL);
 
368
}
 
369
 
 
370
static GValueArray *
 
371
vectors_get_tattoo_invoker (GimpProcedure      *procedure,
 
372
                            Gimp               *gimp,
 
373
                            GimpContext        *context,
 
374
                            GimpProgress       *progress,
 
375
                            const GValueArray  *args,
 
376
                            GError            **error)
 
377
{
 
378
  gboolean success = TRUE;
 
379
  GValueArray *return_vals;
 
380
  GimpVectors *vectors;
 
381
  gint32 tattoo = 0;
 
382
 
 
383
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
384
 
 
385
  if (success)
 
386
    {
 
387
      tattoo = gimp_item_get_tattoo (GIMP_ITEM (vectors));
 
388
    }
 
389
 
 
390
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
391
                                                  error ? *error : NULL);
 
392
 
 
393
  if (success)
 
394
    g_value_set_int (&return_vals->values[1], tattoo);
 
395
 
 
396
  return return_vals;
 
397
}
 
398
 
 
399
static GValueArray *
 
400
vectors_set_tattoo_invoker (GimpProcedure      *procedure,
 
401
                            Gimp               *gimp,
 
402
                            GimpContext        *context,
 
403
                            GimpProgress       *progress,
 
404
                            const GValueArray  *args,
 
405
                            GError            **error)
 
406
{
 
407
  gboolean success = TRUE;
 
408
  GimpVectors *vectors;
 
409
  gint32 tattoo;
 
410
 
 
411
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
412
  tattoo = g_value_get_int (&args->values[1]);
 
413
 
 
414
  if (success)
 
415
    {
 
416
      gimp_item_set_tattoo (GIMP_ITEM (vectors), tattoo);
 
417
    }
 
418
 
 
419
  return gimp_procedure_get_return_values (procedure, success,
 
420
                                           error ? *error : NULL);
 
421
}
 
422
 
 
423
static GValueArray *
 
424
vectors_get_strokes_invoker (GimpProcedure      *procedure,
 
425
                             Gimp               *gimp,
 
426
                             GimpContext        *context,
 
427
                             GimpProgress       *progress,
 
428
                             const GValueArray  *args,
 
429
                             GError            **error)
 
430
{
 
431
  gboolean success = TRUE;
 
432
  GValueArray *return_vals;
 
433
  GimpVectors *vectors;
 
434
  gint32 num_strokes = 0;
 
435
  gint32 *stroke_ids = NULL;
 
436
 
 
437
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
438
 
 
439
  if (success)
 
440
    {
 
441
      num_strokes = gimp_vectors_get_n_strokes (vectors);
 
442
 
 
443
      if (num_strokes)
 
444
        {
 
445
          GimpStroke *cur_stroke;
 
446
          gint        i = 0;
 
447
 
 
448
          stroke_ids = g_new (gint32, num_strokes);
 
449
 
 
450
          for (cur_stroke = gimp_vectors_stroke_get_next (vectors, NULL);
 
451
               cur_stroke;
 
452
               cur_stroke = gimp_vectors_stroke_get_next (vectors, cur_stroke))
 
453
            {
 
454
              stroke_ids[i] = gimp_stroke_get_ID (cur_stroke);
 
455
              i++;
 
456
            }
 
457
        }
 
458
    }
 
459
 
 
460
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
461
                                                  error ? *error : NULL);
 
462
 
 
463
  if (success)
 
464
    {
 
465
      g_value_set_int (&return_vals->values[1], num_strokes);
 
466
      gimp_value_take_int32array (&return_vals->values[2], stroke_ids, num_strokes);
 
467
    }
 
468
 
 
469
  return return_vals;
 
470
}
 
471
 
 
472
static GValueArray *
 
473
vectors_stroke_get_length_invoker (GimpProcedure      *procedure,
 
474
                                   Gimp               *gimp,
 
475
                                   GimpContext        *context,
 
476
                                   GimpProgress       *progress,
 
477
                                   const GValueArray  *args,
 
478
                                   GError            **error)
 
479
{
 
480
  gboolean success = TRUE;
 
481
  GValueArray *return_vals;
 
482
  GimpVectors *vectors;
 
483
  gint32 stroke_id;
 
484
  gdouble precision;
 
485
  gdouble length = 0.0;
 
486
 
 
487
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
488
  stroke_id = g_value_get_int (&args->values[1]);
 
489
  precision = g_value_get_double (&args->values[2]);
 
490
 
 
491
  if (success)
 
492
    {
 
493
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
494
 
 
495
      if (stroke)
 
496
        length = gimp_stroke_get_length (stroke, precision);
 
497
      else
 
498
        success = FALSE;
 
499
    }
 
500
 
 
501
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
502
                                                  error ? *error : NULL);
 
503
 
 
504
  if (success)
 
505
    g_value_set_double (&return_vals->values[1], length);
 
506
 
 
507
  return return_vals;
 
508
}
 
509
 
 
510
static GValueArray *
 
511
vectors_stroke_get_point_at_dist_invoker (GimpProcedure      *procedure,
 
512
                                          Gimp               *gimp,
 
513
                                          GimpContext        *context,
 
514
                                          GimpProgress       *progress,
 
515
                                          const GValueArray  *args,
 
516
                                          GError            **error)
 
517
{
 
518
  gboolean success = TRUE;
 
519
  GValueArray *return_vals;
 
520
  GimpVectors *vectors;
 
521
  gint32 stroke_id;
 
522
  gdouble dist;
 
523
  gdouble precision;
 
524
  gdouble x_point = 0.0;
 
525
  gdouble y_point = 0.0;
 
526
  gdouble slope = 0.0;
 
527
  gboolean valid = FALSE;
 
528
 
 
529
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
530
  stroke_id = g_value_get_int (&args->values[1]);
 
531
  dist = g_value_get_double (&args->values[2]);
 
532
  precision = g_value_get_double (&args->values[3]);
 
533
 
 
534
  if (success)
 
535
    {
 
536
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
537
 
 
538
      if (stroke)
 
539
        {
 
540
          GimpCoords coord;
 
541
 
 
542
          valid = gimp_stroke_get_point_at_dist (stroke, dist, precision,
 
543
                                                 &coord, &slope);
 
544
          x_point = valid ? coord.x : 0;
 
545
          y_point = valid ? coord.y : 0;
 
546
        }
 
547
      else
 
548
        success = FALSE;
 
549
    }
 
550
 
 
551
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
552
                                                  error ? *error : NULL);
 
553
 
 
554
  if (success)
 
555
    {
 
556
      g_value_set_double (&return_vals->values[1], x_point);
 
557
      g_value_set_double (&return_vals->values[2], y_point);
 
558
      g_value_set_double (&return_vals->values[3], slope);
 
559
      g_value_set_boolean (&return_vals->values[4], valid);
 
560
    }
 
561
 
 
562
  return return_vals;
 
563
}
 
564
 
 
565
static GValueArray *
 
566
vectors_remove_stroke_invoker (GimpProcedure      *procedure,
 
567
                               Gimp               *gimp,
 
568
                               GimpContext        *context,
 
569
                               GimpProgress       *progress,
 
570
                               const GValueArray  *args,
 
571
                               GError            **error)
 
572
{
 
573
  gboolean success = TRUE;
 
574
  GimpVectors *vectors;
 
575
  gint32 stroke_id;
 
576
 
 
577
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
578
  stroke_id = g_value_get_int (&args->values[1]);
 
579
 
 
580
  if (success)
 
581
    {
 
582
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
583
 
 
584
      if (stroke)
 
585
        gimp_vectors_stroke_remove (vectors, stroke);
 
586
      else
 
587
        success = FALSE;
 
588
    }
 
589
 
 
590
  return gimp_procedure_get_return_values (procedure, success,
 
591
                                           error ? *error : NULL);
 
592
}
 
593
 
 
594
static GValueArray *
 
595
vectors_stroke_close_invoker (GimpProcedure      *procedure,
 
596
                              Gimp               *gimp,
 
597
                              GimpContext        *context,
 
598
                              GimpProgress       *progress,
 
599
                              const GValueArray  *args,
 
600
                              GError            **error)
 
601
{
 
602
  gboolean success = TRUE;
 
603
  GimpVectors *vectors;
 
604
  gint32 stroke_id;
 
605
 
 
606
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
607
  stroke_id = g_value_get_int (&args->values[1]);
 
608
 
 
609
  if (success)
 
610
    {
 
611
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
612
 
 
613
      if (stroke)
 
614
        gimp_stroke_close (stroke);
 
615
      else
 
616
        success = FALSE;
 
617
    }
 
618
 
 
619
  return gimp_procedure_get_return_values (procedure, success,
 
620
                                           error ? *error : NULL);
 
621
}
 
622
 
 
623
static GValueArray *
 
624
vectors_stroke_translate_invoker (GimpProcedure      *procedure,
 
625
                                  Gimp               *gimp,
 
626
                                  GimpContext        *context,
 
627
                                  GimpProgress       *progress,
 
628
                                  const GValueArray  *args,
 
629
                                  GError            **error)
 
630
{
 
631
  gboolean success = TRUE;
 
632
  GimpVectors *vectors;
 
633
  gint32 stroke_id;
 
634
  gint32 off_x;
 
635
  gint32 off_y;
 
636
 
 
637
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
638
  stroke_id = g_value_get_int (&args->values[1]);
 
639
  off_x = g_value_get_int (&args->values[2]);
 
640
  off_y = g_value_get_int (&args->values[3]);
 
641
 
 
642
  if (success)
 
643
    {
 
644
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
645
 
 
646
      if (stroke)
 
647
        gimp_stroke_translate (stroke, off_x, off_y);
 
648
      else
 
649
        success = FALSE;
 
650
    }
 
651
 
 
652
  return gimp_procedure_get_return_values (procedure, success,
 
653
                                           error ? *error : NULL);
 
654
}
 
655
 
 
656
static GValueArray *
 
657
vectors_stroke_scale_invoker (GimpProcedure      *procedure,
 
658
                              Gimp               *gimp,
 
659
                              GimpContext        *context,
 
660
                              GimpProgress       *progress,
 
661
                              const GValueArray  *args,
 
662
                              GError            **error)
 
663
{
 
664
  gboolean success = TRUE;
 
665
  GimpVectors *vectors;
 
666
  gint32 stroke_id;
 
667
  gdouble scale_x;
 
668
  gdouble scale_y;
 
669
 
 
670
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
671
  stroke_id = g_value_get_int (&args->values[1]);
 
672
  scale_x = g_value_get_double (&args->values[2]);
 
673
  scale_y = g_value_get_double (&args->values[3]);
 
674
 
 
675
  if (success)
 
676
    {
 
677
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
678
 
 
679
      if (stroke)
 
680
        gimp_stroke_scale (stroke, scale_x, scale_y);
 
681
      else
 
682
        success = FALSE;
 
683
    }
 
684
 
 
685
  return gimp_procedure_get_return_values (procedure, success,
 
686
                                           error ? *error : NULL);
 
687
}
 
688
 
 
689
static GValueArray *
 
690
vectors_stroke_rotate_invoker (GimpProcedure      *procedure,
 
691
                               Gimp               *gimp,
 
692
                               GimpContext        *context,
 
693
                               GimpProgress       *progress,
 
694
                               const GValueArray  *args,
 
695
                               GError            **error)
 
696
{
 
697
  gboolean success = TRUE;
 
698
  GimpVectors *vectors;
 
699
  gint32 stroke_id;
 
700
  gdouble center_x;
 
701
  gdouble center_y;
 
702
  gdouble angle;
 
703
 
 
704
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
705
  stroke_id = g_value_get_int (&args->values[1]);
 
706
  center_x = g_value_get_double (&args->values[2]);
 
707
  center_y = g_value_get_double (&args->values[3]);
 
708
  angle = g_value_get_double (&args->values[4]);
 
709
 
 
710
  if (success)
 
711
    {
 
712
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
713
 
 
714
      if (stroke)
 
715
        gimp_stroke_rotate (stroke, center_x, center_y, angle);
 
716
      else
 
717
        success = FALSE;
 
718
    }
 
719
 
 
720
  return gimp_procedure_get_return_values (procedure, success,
 
721
                                           error ? *error : NULL);
 
722
}
 
723
 
 
724
static GValueArray *
 
725
vectors_stroke_flip_invoker (GimpProcedure      *procedure,
 
726
                             Gimp               *gimp,
 
727
                             GimpContext        *context,
 
728
                             GimpProgress       *progress,
 
729
                             const GValueArray  *args,
 
730
                             GError            **error)
 
731
{
 
732
  gboolean success = TRUE;
 
733
  GimpVectors *vectors;
 
734
  gint32 stroke_id;
 
735
  gint32 flip_type;
 
736
  gdouble axis;
 
737
 
 
738
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
739
  stroke_id = g_value_get_int (&args->values[1]);
 
740
  flip_type = g_value_get_enum (&args->values[2]);
 
741
  axis = g_value_get_double (&args->values[3]);
 
742
 
 
743
  if (success)
 
744
    {
 
745
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
746
 
 
747
      if (stroke)
 
748
        gimp_stroke_flip (stroke, flip_type, axis);
 
749
      else
 
750
        success = FALSE;
 
751
    }
 
752
 
 
753
  return gimp_procedure_get_return_values (procedure, success,
 
754
                                           error ? *error : NULL);
 
755
}
 
756
 
 
757
static GValueArray *
 
758
vectors_stroke_flip_free_invoker (GimpProcedure      *procedure,
 
759
                                  Gimp               *gimp,
 
760
                                  GimpContext        *context,
 
761
                                  GimpProgress       *progress,
 
762
                                  const GValueArray  *args,
 
763
                                  GError            **error)
 
764
{
 
765
  gboolean success = TRUE;
 
766
  GimpVectors *vectors;
 
767
  gint32 stroke_id;
 
768
  gdouble x1;
 
769
  gdouble y1;
 
770
  gdouble x2;
 
771
  gdouble y2;
 
772
 
 
773
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
774
  stroke_id = g_value_get_int (&args->values[1]);
 
775
  x1 = g_value_get_double (&args->values[2]);
 
776
  y1 = g_value_get_double (&args->values[3]);
 
777
  x2 = g_value_get_double (&args->values[4]);
 
778
  y2 = g_value_get_double (&args->values[5]);
 
779
 
 
780
  if (success)
 
781
    {
 
782
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
783
 
 
784
      if (stroke)
 
785
        gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
 
786
      else
 
787
        success = FALSE;
 
788
    }
 
789
 
 
790
  return gimp_procedure_get_return_values (procedure, success,
 
791
                                           error ? *error : NULL);
 
792
}
 
793
 
 
794
static GValueArray *
 
795
vectors_stroke_get_points_invoker (GimpProcedure      *procedure,
 
796
                                   Gimp               *gimp,
 
797
                                   GimpContext        *context,
 
798
                                   GimpProgress       *progress,
 
799
                                   const GValueArray  *args,
 
800
                                   GError            **error)
 
801
{
 
802
  gboolean success = TRUE;
 
803
  GValueArray *return_vals;
 
804
  GimpVectors *vectors;
 
805
  gint32 stroke_id;
 
806
  gint32 type = 0;
 
807
  gint32 num_points = 0;
 
808
  gdouble *controlpoints = NULL;
 
809
  gboolean closed = FALSE;
 
810
 
 
811
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
812
  stroke_id = g_value_get_int (&args->values[1]);
 
813
 
 
814
  if (success)
 
815
    {
 
816
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
817
 
 
818
      if (GIMP_IS_BEZIER_STROKE (stroke))
 
819
        {
 
820
          GArray *points_array;
 
821
          gint    i;
 
822
 
 
823
          points_array = gimp_stroke_control_points_get (stroke, &closed);
 
824
 
 
825
          if (points_array)
 
826
            {
 
827
              num_points = points_array->len;
 
828
              controlpoints = g_new (gdouble, num_points * 2);
 
829
 
 
830
              type = GIMP_VECTORS_STROKE_TYPE_BEZIER;
 
831
              for (i = 0; i < num_points; i++)
 
832
                {
 
833
                  controlpoints[2*i]   = g_array_index (points_array,
 
834
                                                        GimpAnchor, i).position.x;
 
835
                  controlpoints[2*i+1] = g_array_index (points_array,
 
836
                                                        GimpAnchor, i).position.y;
 
837
                }
 
838
              g_array_free (points_array, TRUE);
 
839
              num_points *= 2;
 
840
            }
 
841
          else
 
842
            success = FALSE;
 
843
        }
 
844
      else
 
845
        success = FALSE;
 
846
    }
 
847
 
 
848
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
849
                                                  error ? *error : NULL);
 
850
 
 
851
  if (success)
 
852
    {
 
853
      g_value_set_enum (&return_vals->values[1], type);
 
854
      g_value_set_int (&return_vals->values[2], num_points);
 
855
      gimp_value_take_floatarray (&return_vals->values[3], controlpoints, num_points);
 
856
      g_value_set_boolean (&return_vals->values[4], closed);
 
857
    }
 
858
 
 
859
  return return_vals;
 
860
}
 
861
 
 
862
static GValueArray *
 
863
vectors_stroke_new_from_points_invoker (GimpProcedure      *procedure,
 
864
                                        Gimp               *gimp,
 
865
                                        GimpContext        *context,
 
866
                                        GimpProgress       *progress,
 
867
                                        const GValueArray  *args,
 
868
                                        GError            **error)
 
869
{
 
870
  gboolean success = TRUE;
 
871
  GValueArray *return_vals;
 
872
  GimpVectors *vectors;
 
873
  gint32 type;
 
874
  gint32 num_points;
 
875
  const gdouble *controlpoints;
 
876
  gboolean closed;
 
877
  gint32 stroke_id = 0;
 
878
 
 
879
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
880
  type = g_value_get_enum (&args->values[1]);
 
881
  num_points = g_value_get_int (&args->values[2]);
 
882
  controlpoints = gimp_value_get_floatarray (&args->values[3]);
 
883
  closed = g_value_get_boolean (&args->values[4]);
 
884
 
 
885
  if (success)
 
886
    {
 
887
      GimpStroke *stroke;
 
888
      GimpCoords *coords;
 
889
      GimpCoords  default_coords = GIMP_COORDS_DEFAULT_VALUES;
 
890
      gint i;
 
891
 
 
892
      success = FALSE;
 
893
 
 
894
      if (type == GIMP_VECTORS_STROKE_TYPE_BEZIER &&
 
895
          num_points % 6 == 0)
 
896
        {
 
897
          coords = g_new (GimpCoords, num_points/2);
 
898
          for (i = 0; i < num_points/2; i++)
 
899
            {
 
900
              coords[i] = default_coords;
 
901
              coords[i].x = controlpoints[i*2];
 
902
              coords[i].y = controlpoints[i*2+1];
 
903
            }
 
904
 
 
905
          stroke = gimp_stroke_new_from_coords (type, coords, num_points/2, closed);
 
906
          if (stroke)
 
907
            {
 
908
              gimp_vectors_stroke_add (vectors, stroke);
 
909
              stroke_id = gimp_stroke_get_ID (stroke);
 
910
 
 
911
              success = TRUE;
 
912
            }
 
913
 
 
914
          g_free (coords);
 
915
        }
 
916
    }
 
917
 
 
918
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
919
                                                  error ? *error : NULL);
 
920
 
 
921
  if (success)
 
922
    g_value_set_int (&return_vals->values[1], stroke_id);
 
923
 
 
924
  return return_vals;
 
925
}
 
926
 
 
927
static GValueArray *
 
928
vectors_stroke_interpolate_invoker (GimpProcedure      *procedure,
 
929
                                    Gimp               *gimp,
 
930
                                    GimpContext        *context,
 
931
                                    GimpProgress       *progress,
 
932
                                    const GValueArray  *args,
 
933
                                    GError            **error)
 
934
{
 
935
  gboolean success = TRUE;
 
936
  GValueArray *return_vals;
 
937
  GimpVectors *vectors;
 
938
  gint32 stroke_id;
 
939
  gdouble precision;
 
940
  gint32 num_coords = 0;
 
941
  gdouble *coords = NULL;
 
942
  gboolean closed = FALSE;
 
943
 
 
944
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
945
  stroke_id = g_value_get_int (&args->values[1]);
 
946
  precision = g_value_get_double (&args->values[2]);
 
947
 
 
948
  if (success)
 
949
    {
 
950
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
951
 
 
952
      if (stroke)
 
953
        {
 
954
          GArray *coords_array;
 
955
          gint    i;
 
956
 
 
957
          coords_array = gimp_stroke_interpolate (stroke, precision, &closed);
 
958
 
 
959
          if (coords_array)
 
960
            {
 
961
              num_coords = coords_array->len;
 
962
              coords = g_new (gdouble, num_coords * 2);
 
963
 
 
964
              for (i = 0; i < num_coords; i++)
 
965
                {
 
966
                  coords[2*i]   = g_array_index (coords_array, GimpCoords, i).x;
 
967
                  coords[2*i+1] = g_array_index (coords_array, GimpCoords, i).y;
 
968
                }
 
969
              g_array_free (coords_array, TRUE);
 
970
              num_coords *= 2;
 
971
            }
 
972
          else
 
973
            success = FALSE;
 
974
        }
 
975
      else
 
976
        success = FALSE;
 
977
    }
 
978
 
 
979
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
980
                                                  error ? *error : NULL);
 
981
 
 
982
  if (success)
 
983
    {
 
984
      g_value_set_int (&return_vals->values[1], num_coords);
 
985
      gimp_value_take_floatarray (&return_vals->values[2], coords, num_coords);
 
986
      g_value_set_boolean (&return_vals->values[3], closed);
 
987
    }
 
988
 
 
989
  return return_vals;
 
990
}
 
991
 
 
992
static GValueArray *
 
993
vectors_bezier_stroke_new_moveto_invoker (GimpProcedure      *procedure,
 
994
                                          Gimp               *gimp,
 
995
                                          GimpContext        *context,
 
996
                                          GimpProgress       *progress,
 
997
                                          const GValueArray  *args,
 
998
                                          GError            **error)
 
999
{
 
1000
  gboolean success = TRUE;
 
1001
  GValueArray *return_vals;
 
1002
  GimpVectors *vectors;
 
1003
  gdouble x0;
 
1004
  gdouble y0;
 
1005
  gint32 stroke_id = 0;
 
1006
 
 
1007
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
1008
  x0 = g_value_get_double (&args->values[1]);
 
1009
  y0 = g_value_get_double (&args->values[2]);
 
1010
 
 
1011
  if (success)
 
1012
    {
 
1013
      GimpStroke *stroke;
 
1014
      GimpCoords  coord0 = GIMP_COORDS_DEFAULT_VALUES;
 
1015
 
 
1016
      coord0.x = x0;
 
1017
      coord0.y = y0;
 
1018
 
 
1019
      stroke = gimp_bezier_stroke_new_moveto (&coord0);
 
1020
      gimp_vectors_stroke_add (vectors, stroke);
 
1021
      stroke_id = gimp_stroke_get_ID (stroke);
 
1022
    }
 
1023
 
 
1024
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
1025
                                                  error ? *error : NULL);
 
1026
 
 
1027
  if (success)
 
1028
    g_value_set_int (&return_vals->values[1], stroke_id);
 
1029
 
 
1030
  return return_vals;
 
1031
}
 
1032
 
 
1033
static GValueArray *
 
1034
vectors_bezier_stroke_lineto_invoker (GimpProcedure      *procedure,
 
1035
                                      Gimp               *gimp,
 
1036
                                      GimpContext        *context,
 
1037
                                      GimpProgress       *progress,
 
1038
                                      const GValueArray  *args,
 
1039
                                      GError            **error)
 
1040
{
 
1041
  gboolean success = TRUE;
 
1042
  GimpVectors *vectors;
 
1043
  gint32 stroke_id;
 
1044
  gdouble x0;
 
1045
  gdouble y0;
 
1046
 
 
1047
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
1048
  stroke_id = g_value_get_int (&args->values[1]);
 
1049
  x0 = g_value_get_double (&args->values[2]);
 
1050
  y0 = g_value_get_double (&args->values[3]);
 
1051
 
 
1052
  if (success)
 
1053
    {
 
1054
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
1055
 
 
1056
      if (stroke)
 
1057
        {
 
1058
          GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
 
1059
 
 
1060
          coord0.x = x0;
 
1061
          coord0.y = y0;
 
1062
 
 
1063
          gimp_bezier_stroke_lineto (stroke, &coord0);
 
1064
        }
 
1065
      else
 
1066
        success = FALSE;
 
1067
    }
 
1068
 
 
1069
  return gimp_procedure_get_return_values (procedure, success,
 
1070
                                           error ? *error : NULL);
 
1071
}
 
1072
 
 
1073
static GValueArray *
 
1074
vectors_bezier_stroke_conicto_invoker (GimpProcedure      *procedure,
 
1075
                                       Gimp               *gimp,
 
1076
                                       GimpContext        *context,
 
1077
                                       GimpProgress       *progress,
 
1078
                                       const GValueArray  *args,
 
1079
                                       GError            **error)
 
1080
{
 
1081
  gboolean success = TRUE;
 
1082
  GimpVectors *vectors;
 
1083
  gint32 stroke_id;
 
1084
  gdouble x0;
 
1085
  gdouble y0;
 
1086
  gdouble x1;
 
1087
  gdouble y1;
 
1088
 
 
1089
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
1090
  stroke_id = g_value_get_int (&args->values[1]);
 
1091
  x0 = g_value_get_double (&args->values[2]);
 
1092
  y0 = g_value_get_double (&args->values[3]);
 
1093
  x1 = g_value_get_double (&args->values[4]);
 
1094
  y1 = g_value_get_double (&args->values[5]);
 
1095
 
 
1096
  if (success)
 
1097
    {
 
1098
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
1099
 
 
1100
      if (stroke)
 
1101
        {
 
1102
          GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
 
1103
          GimpCoords coord1 = GIMP_COORDS_DEFAULT_VALUES;
 
1104
 
 
1105
          coord0.x = x0;
 
1106
          coord0.y = y0;
 
1107
 
 
1108
          coord1.x = x1;
 
1109
          coord1.y = y1;
 
1110
 
 
1111
          gimp_bezier_stroke_conicto (stroke, &coord0, &coord1);
 
1112
        }
 
1113
      else
 
1114
        success = FALSE;
 
1115
    }
 
1116
 
 
1117
  return gimp_procedure_get_return_values (procedure, success,
 
1118
                                           error ? *error : NULL);
 
1119
}
 
1120
 
 
1121
static GValueArray *
 
1122
vectors_bezier_stroke_cubicto_invoker (GimpProcedure      *procedure,
 
1123
                                       Gimp               *gimp,
 
1124
                                       GimpContext        *context,
 
1125
                                       GimpProgress       *progress,
 
1126
                                       const GValueArray  *args,
 
1127
                                       GError            **error)
 
1128
{
 
1129
  gboolean success = TRUE;
 
1130
  GimpVectors *vectors;
 
1131
  gint32 stroke_id;
 
1132
  gdouble x0;
 
1133
  gdouble y0;
 
1134
  gdouble x1;
 
1135
  gdouble y1;
 
1136
  gdouble x2;
 
1137
  gdouble y2;
 
1138
 
 
1139
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
1140
  stroke_id = g_value_get_int (&args->values[1]);
 
1141
  x0 = g_value_get_double (&args->values[2]);
 
1142
  y0 = g_value_get_double (&args->values[3]);
 
1143
  x1 = g_value_get_double (&args->values[4]);
 
1144
  y1 = g_value_get_double (&args->values[5]);
 
1145
  x2 = g_value_get_double (&args->values[6]);
 
1146
  y2 = g_value_get_double (&args->values[7]);
 
1147
 
 
1148
  if (success)
 
1149
    {
 
1150
      GimpStroke *stroke = gimp_pdb_get_vectors_stroke (vectors, stroke_id, error);
 
1151
 
 
1152
      if (stroke)
 
1153
        {
 
1154
          GimpCoords coord0 = GIMP_COORDS_DEFAULT_VALUES;
 
1155
          GimpCoords coord1 = GIMP_COORDS_DEFAULT_VALUES;
 
1156
          GimpCoords coord2 = GIMP_COORDS_DEFAULT_VALUES;
 
1157
 
 
1158
          coord0.x = x0;
 
1159
          coord0.y = y0;
 
1160
 
 
1161
          coord1.x = x1;
 
1162
          coord1.y = y1;
 
1163
 
 
1164
          coord2.x = x2;
 
1165
          coord2.y = y2;
 
1166
 
 
1167
          gimp_bezier_stroke_cubicto (stroke, &coord0, &coord1, &coord2);
 
1168
        }
 
1169
      else
 
1170
        success = FALSE;
 
1171
    }
 
1172
 
 
1173
  return gimp_procedure_get_return_values (procedure, success,
 
1174
                                           error ? *error : NULL);
 
1175
}
 
1176
 
 
1177
static GValueArray *
 
1178
vectors_bezier_stroke_new_ellipse_invoker (GimpProcedure      *procedure,
 
1179
                                           Gimp               *gimp,
 
1180
                                           GimpContext        *context,
 
1181
                                           GimpProgress       *progress,
 
1182
                                           const GValueArray  *args,
 
1183
                                           GError            **error)
 
1184
{
 
1185
  gboolean success = TRUE;
 
1186
  GValueArray *return_vals;
 
1187
  GimpVectors *vectors;
 
1188
  gdouble x0;
 
1189
  gdouble y0;
 
1190
  gdouble radius_x;
 
1191
  gdouble radius_y;
 
1192
  gdouble angle;
 
1193
  gint32 stroke_id = 0;
 
1194
 
 
1195
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
1196
  x0 = g_value_get_double (&args->values[1]);
 
1197
  y0 = g_value_get_double (&args->values[2]);
 
1198
  radius_x = g_value_get_double (&args->values[3]);
 
1199
  radius_y = g_value_get_double (&args->values[4]);
 
1200
  angle = g_value_get_double (&args->values[5]);
 
1201
 
 
1202
  if (success)
 
1203
    {
 
1204
      GimpStroke *stroke;
 
1205
      GimpCoords  coord0 = GIMP_COORDS_DEFAULT_VALUES;
 
1206
 
 
1207
      coord0.x = x0;
 
1208
      coord0.y = y0;
 
1209
 
 
1210
      stroke = gimp_bezier_stroke_new_ellipse (&coord0, radius_x, radius_y, angle);
 
1211
      gimp_vectors_stroke_add (vectors, stroke);
 
1212
      stroke_id = gimp_stroke_get_ID (stroke);
 
1213
    }
 
1214
 
 
1215
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
1216
                                                  error ? *error : NULL);
 
1217
 
 
1218
  if (success)
 
1219
    g_value_set_int (&return_vals->values[1], stroke_id);
 
1220
 
 
1221
  return return_vals;
 
1222
}
 
1223
 
 
1224
static GValueArray *
 
1225
vectors_to_selection_invoker (GimpProcedure      *procedure,
 
1226
                              Gimp               *gimp,
 
1227
                              GimpContext        *context,
 
1228
                              GimpProgress       *progress,
 
1229
                              const GValueArray  *args,
 
1230
                              GError            **error)
 
1231
{
 
1232
  gboolean success = TRUE;
 
1233
  GimpVectors *vectors;
 
1234
  gint32 operation;
 
1235
  gboolean antialias;
 
1236
  gboolean feather;
 
1237
  gdouble feather_radius_x;
 
1238
  gdouble feather_radius_y;
 
1239
 
 
1240
  vectors = gimp_value_get_vectors (&args->values[0], gimp);
 
1241
  operation = g_value_get_enum (&args->values[1]);
 
1242
  antialias = g_value_get_boolean (&args->values[2]);
 
1243
  feather = g_value_get_boolean (&args->values[3]);
 
1244
  feather_radius_x = g_value_get_double (&args->values[4]);
 
1245
  feather_radius_y = g_value_get_double (&args->values[5]);
 
1246
 
 
1247
  if (success)
 
1248
    {
 
1249
      GimpImage *image = gimp_item_get_image (GIMP_ITEM (vectors));
 
1250
 
 
1251
      if (image)
 
1252
        gimp_channel_select_vectors (gimp_image_get_mask (image),
 
1253
                                     _("Path to Selection"),
 
1254
                                     vectors,
 
1255
                                     operation,
 
1256
                                     antialias,
 
1257
                                     feather,
 
1258
                                     feather_radius_x,
 
1259
                                     feather_radius_y,
 
1260
                                     TRUE);
 
1261
      else
 
1262
        success = FALSE;
 
1263
    }
 
1264
 
 
1265
  return gimp_procedure_get_return_values (procedure, success,
 
1266
                                           error ? *error : NULL);
 
1267
}
 
1268
 
 
1269
static GValueArray *
 
1270
vectors_import_from_file_invoker (GimpProcedure      *procedure,
 
1271
                                  Gimp               *gimp,
 
1272
                                  GimpContext        *context,
 
1273
                                  GimpProgress       *progress,
 
1274
                                  const GValueArray  *args,
 
1275
                                  GError            **error)
 
1276
{
 
1277
  gboolean success = TRUE;
 
1278
  GValueArray *return_vals;
 
1279
  GimpImage *image;
 
1280
  const gchar *filename;
 
1281
  gboolean merge;
 
1282
  gboolean scale;
 
1283
  gint32 num_vectors = 0;
 
1284
  gint32 *vectors_ids = NULL;
 
1285
 
 
1286
  image = gimp_value_get_image (&args->values[0], gimp);
 
1287
  filename = g_value_get_string (&args->values[1]);
 
1288
  merge = g_value_get_boolean (&args->values[2]);
 
1289
  scale = g_value_get_boolean (&args->values[3]);
 
1290
 
 
1291
  if (success)
 
1292
    {
 
1293
      GList *list, *vectors_list = NULL;
 
1294
 
 
1295
      success = gimp_vectors_import_file (image, filename,
 
1296
                                          merge, scale, -1, &vectors_list, error);
 
1297
 
 
1298
      if (success)
 
1299
        {
 
1300
          num_vectors = g_list_length (vectors_list);
 
1301
 
 
1302
          if (num_vectors)
 
1303
            {
 
1304
              gint i;
 
1305
 
 
1306
              vectors_ids = g_new (gint32, num_vectors);
 
1307
 
 
1308
              list = vectors_list;
 
1309
              for (i = 0; i < num_vectors; i++, list = g_list_next (list))
 
1310
                vectors_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
 
1311
 
 
1312
              g_list_free (vectors_list);
 
1313
            }
 
1314
        }
 
1315
    }
 
1316
 
 
1317
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
1318
                                                  error ? *error : NULL);
 
1319
 
 
1320
  if (success)
 
1321
    {
 
1322
      g_value_set_int (&return_vals->values[1], num_vectors);
 
1323
      gimp_value_take_int32array (&return_vals->values[2], vectors_ids, num_vectors);
 
1324
    }
 
1325
 
 
1326
  return return_vals;
 
1327
}
 
1328
 
 
1329
static GValueArray *
 
1330
vectors_import_from_string_invoker (GimpProcedure      *procedure,
 
1331
                                    Gimp               *gimp,
 
1332
                                    GimpContext        *context,
 
1333
                                    GimpProgress       *progress,
 
1334
                                    const GValueArray  *args,
 
1335
                                    GError            **error)
 
1336
{
 
1337
  gboolean success = TRUE;
 
1338
  GValueArray *return_vals;
 
1339
  GimpImage *image;
 
1340
  const gchar *string;
 
1341
  gint32 length;
 
1342
  gboolean merge;
 
1343
  gboolean scale;
 
1344
  gint32 num_vectors = 0;
 
1345
  gint32 *vectors_ids = NULL;
 
1346
 
 
1347
  image = gimp_value_get_image (&args->values[0], gimp);
 
1348
  string = g_value_get_string (&args->values[1]);
 
1349
  length = g_value_get_int (&args->values[2]);
 
1350
  merge = g_value_get_boolean (&args->values[3]);
 
1351
  scale = g_value_get_boolean (&args->values[4]);
 
1352
 
 
1353
  if (success)
 
1354
    {
 
1355
      GList *list, *vectors_list = NULL;
 
1356
 
 
1357
      success = gimp_vectors_import_buffer (image, string, length,
 
1358
                                            merge, scale, -1, &vectors_list, error);
 
1359
 
 
1360
      if (success)
 
1361
        {
 
1362
          num_vectors = g_list_length (vectors_list);
 
1363
 
 
1364
          if (num_vectors)
 
1365
            {
 
1366
              gint i;
 
1367
 
 
1368
              vectors_ids = g_new (gint32, num_vectors);
 
1369
 
 
1370
              list = vectors_list;
 
1371
              for (i = 0; i < num_vectors; i++, list = g_list_next (list))
 
1372
                vectors_ids[i] = gimp_item_get_ID (GIMP_ITEM (list->data));
 
1373
 
 
1374
              g_list_free (vectors_list);
 
1375
            }
 
1376
        }
 
1377
    }
 
1378
 
 
1379
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
1380
                                                  error ? *error : NULL);
 
1381
 
 
1382
  if (success)
 
1383
    {
 
1384
      g_value_set_int (&return_vals->values[1], num_vectors);
 
1385
      gimp_value_take_int32array (&return_vals->values[2], vectors_ids, num_vectors);
 
1386
    }
 
1387
 
 
1388
  return return_vals;
 
1389
}
 
1390
 
 
1391
static GValueArray *
 
1392
vectors_export_to_file_invoker (GimpProcedure      *procedure,
 
1393
                                Gimp               *gimp,
 
1394
                                GimpContext        *context,
 
1395
                                GimpProgress       *progress,
 
1396
                                const GValueArray  *args,
 
1397
                                GError            **error)
 
1398
{
 
1399
  gboolean success = TRUE;
 
1400
  GimpImage *image;
 
1401
  const gchar *filename;
 
1402
  GimpVectors *vectors;
 
1403
 
 
1404
  image = gimp_value_get_image (&args->values[0], gimp);
 
1405
  filename = g_value_get_string (&args->values[1]);
 
1406
  vectors = gimp_value_get_vectors (&args->values[2], gimp);
 
1407
 
 
1408
  if (success)
 
1409
    {
 
1410
      success = gimp_vectors_export_file (image, vectors, filename, error);
 
1411
    }
 
1412
 
 
1413
  return gimp_procedure_get_return_values (procedure, success,
 
1414
                                           error ? *error : NULL);
 
1415
}
 
1416
 
 
1417
static GValueArray *
 
1418
vectors_export_to_string_invoker (GimpProcedure      *procedure,
 
1419
                                  Gimp               *gimp,
 
1420
                                  GimpContext        *context,
 
1421
                                  GimpProgress       *progress,
 
1422
                                  const GValueArray  *args,
 
1423
                                  GError            **error)
 
1424
{
 
1425
  gboolean success = TRUE;
 
1426
  GValueArray *return_vals;
 
1427
  GimpImage *image;
 
1428
  GimpVectors *vectors;
 
1429
  gchar *string = NULL;
 
1430
 
 
1431
  image = gimp_value_get_image (&args->values[0], gimp);
 
1432
  vectors = gimp_value_get_vectors (&args->values[1], gimp);
 
1433
 
 
1434
  if (success)
 
1435
    {
 
1436
      string = gimp_vectors_export_string (image, vectors);
 
1437
 
 
1438
      success = (string != NULL);
 
1439
    }
 
1440
 
 
1441
  return_vals = gimp_procedure_get_return_values (procedure, success,
 
1442
                                                  error ? *error : NULL);
 
1443
 
 
1444
  if (success)
 
1445
    g_value_take_string (&return_vals->values[1], string);
 
1446
 
 
1447
  return return_vals;
 
1448
}
 
1449
 
 
1450
void
 
1451
register_vectors_procs (GimpPDB *pdb)
 
1452
{
 
1453
  GimpProcedure *procedure;
 
1454
 
 
1455
  /*
 
1456
   * gimp-vectors-is-valid
 
1457
   */
 
1458
  procedure = gimp_procedure_new (vectors_is_valid_invoker);
 
1459
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1460
                               "gimp-vectors-is-valid");
 
1461
  gimp_procedure_set_static_strings (procedure,
 
1462
                                     "gimp-vectors-is-valid",
 
1463
                                     "Returns TRUE if the vectors object is valid.",
 
1464
                                     "This procedure checks if the given vectors ID is valid and refers to an existing vectors object.",
 
1465
                                     "Sven Neumann <sven@gimp.org>",
 
1466
                                     "Sven Neumann",
 
1467
                                     "2007",
 
1468
                                     NULL);
 
1469
  gimp_procedure_add_argument (procedure,
 
1470
                               gimp_param_spec_vectors_id ("vectors",
 
1471
                                                           "vectors",
 
1472
                                                           "The vectors object to check",
 
1473
                                                           pdb->gimp, FALSE,
 
1474
                                                           GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
 
1475
  gimp_procedure_add_return_value (procedure,
 
1476
                                   g_param_spec_boolean ("valid",
 
1477
                                                         "valid",
 
1478
                                                         "Whether the vectors ID is valid",
 
1479
                                                         FALSE,
 
1480
                                                         GIMP_PARAM_READWRITE));
 
1481
  gimp_pdb_register_procedure (pdb, procedure);
 
1482
  g_object_unref (procedure);
 
1483
 
 
1484
  /*
 
1485
   * gimp-vectors-new
 
1486
   */
 
1487
  procedure = gimp_procedure_new (vectors_new_invoker);
 
1488
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1489
                               "gimp-vectors-new");
 
1490
  gimp_procedure_set_static_strings (procedure,
 
1491
                                     "gimp-vectors-new",
 
1492
                                     "Creates a new empty vectors object.",
 
1493
                                     "Creates a new empty vectors object. The vectors object needs to be added to the image using 'gimp-image-add-vectors'.",
 
1494
                                     "Simon Budig",
 
1495
                                     "Simon Budig",
 
1496
                                     "2005",
 
1497
                                     NULL);
 
1498
  gimp_procedure_add_argument (procedure,
 
1499
                               gimp_param_spec_image_id ("image",
 
1500
                                                         "image",
 
1501
                                                         "The image",
 
1502
                                                         pdb->gimp, FALSE,
 
1503
                                                         GIMP_PARAM_READWRITE));
 
1504
  gimp_procedure_add_argument (procedure,
 
1505
                               gimp_param_spec_string ("name",
 
1506
                                                       "name",
 
1507
                                                       "the name of the new vector object.",
 
1508
                                                       FALSE, FALSE, FALSE,
 
1509
                                                       NULL,
 
1510
                                                       GIMP_PARAM_READWRITE));
 
1511
  gimp_procedure_add_return_value (procedure,
 
1512
                                   gimp_param_spec_vectors_id ("vectors",
 
1513
                                                               "vectors",
 
1514
                                                               "the current vector object, 0 if no vector exists in the image.",
 
1515
                                                               pdb->gimp, FALSE,
 
1516
                                                               GIMP_PARAM_READWRITE));
 
1517
  gimp_pdb_register_procedure (pdb, procedure);
 
1518
  g_object_unref (procedure);
 
1519
 
 
1520
  /*
 
1521
   * gimp-vectors-new-from-text-layer
 
1522
   */
 
1523
  procedure = gimp_procedure_new (vectors_new_from_text_layer_invoker);
 
1524
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1525
                               "gimp-vectors-new-from-text-layer");
 
1526
  gimp_procedure_set_static_strings (procedure,
 
1527
                                     "gimp-vectors-new-from-text-layer",
 
1528
                                     "Creates a new vectors object from a text layer.",
 
1529
                                     "Creates a new vectors object from a text layer. The vectors object needs to be added to the image using 'gimp-image-add-vectors'.",
 
1530
                                     "Marcus Heese <heese@cip.ifi.lmu.de>",
 
1531
                                     "Marcus Heese",
 
1532
                                     "2008",
 
1533
                                     NULL);
 
1534
  gimp_procedure_add_argument (procedure,
 
1535
                               gimp_param_spec_image_id ("image",
 
1536
                                                         "image",
 
1537
                                                         "The image.",
 
1538
                                                         pdb->gimp, FALSE,
 
1539
                                                         GIMP_PARAM_READWRITE));
 
1540
  gimp_procedure_add_argument (procedure,
 
1541
                               gimp_param_spec_layer_id ("layer",
 
1542
                                                         "layer",
 
1543
                                                         "The text layer.",
 
1544
                                                         pdb->gimp, FALSE,
 
1545
                                                         GIMP_PARAM_READWRITE));
 
1546
  gimp_procedure_add_return_value (procedure,
 
1547
                                   gimp_param_spec_vectors_id ("vectors",
 
1548
                                                               "vectors",
 
1549
                                                               "The vectors of the text layer.",
 
1550
                                                               pdb->gimp, FALSE,
 
1551
                                                               GIMP_PARAM_READWRITE));
 
1552
  gimp_pdb_register_procedure (pdb, procedure);
 
1553
  g_object_unref (procedure);
 
1554
 
 
1555
  /*
 
1556
   * gimp-vectors-copy
 
1557
   */
 
1558
  procedure = gimp_procedure_new (vectors_copy_invoker);
 
1559
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1560
                               "gimp-vectors-copy");
 
1561
  gimp_procedure_set_static_strings (procedure,
 
1562
                                     "gimp-vectors-copy",
 
1563
                                     "Copy a vectors object.",
 
1564
                                     "This procedure copies the specified vectors object and returns the copy.",
 
1565
                                     "Barak Itkin <lightningismyname@gmail.com>",
 
1566
                                     "Barak Itkin",
 
1567
                                     "2008",
 
1568
                                     NULL);
 
1569
  gimp_procedure_add_argument (procedure,
 
1570
                               gimp_param_spec_vectors_id ("vectors",
 
1571
                                                           "vectors",
 
1572
                                                           "The vectors object to copy",
 
1573
                                                           pdb->gimp, FALSE,
 
1574
                                                           GIMP_PARAM_READWRITE));
 
1575
  gimp_procedure_add_return_value (procedure,
 
1576
                                   gimp_param_spec_vectors_id ("vectors-copy",
 
1577
                                                               "vectors copy",
 
1578
                                                               "The newly copied vectors object",
 
1579
                                                               pdb->gimp, FALSE,
 
1580
                                                               GIMP_PARAM_READWRITE));
 
1581
  gimp_pdb_register_procedure (pdb, procedure);
 
1582
  g_object_unref (procedure);
 
1583
 
 
1584
  /*
 
1585
   * gimp-vectors-get-image
 
1586
   */
 
1587
  procedure = gimp_procedure_new (vectors_get_image_invoker);
 
1588
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1589
                               "gimp-vectors-get-image");
 
1590
  gimp_procedure_set_static_strings (procedure,
 
1591
                                     "gimp-vectors-get-image",
 
1592
                                     "Returns the vectors objects image.",
 
1593
                                     "Returns the vectors objects image.",
 
1594
                                     "Simon Budig",
 
1595
                                     "Simon Budig",
 
1596
                                     "2005",
 
1597
                                     NULL);
 
1598
  gimp_procedure_add_argument (procedure,
 
1599
                               gimp_param_spec_vectors_id ("vectors",
 
1600
                                                           "vectors",
 
1601
                                                           "The vectors object",
 
1602
                                                           pdb->gimp, FALSE,
 
1603
                                                           GIMP_PARAM_READWRITE));
 
1604
  gimp_procedure_add_return_value (procedure,
 
1605
                                   gimp_param_spec_image_id ("image",
 
1606
                                                             "image",
 
1607
                                                             "The vectors image",
 
1608
                                                             pdb->gimp, FALSE,
 
1609
                                                             GIMP_PARAM_READWRITE));
 
1610
  gimp_pdb_register_procedure (pdb, procedure);
 
1611
  g_object_unref (procedure);
 
1612
 
 
1613
  /*
 
1614
   * gimp-vectors-get-name
 
1615
   */
 
1616
  procedure = gimp_procedure_new (vectors_get_name_invoker);
 
1617
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1618
                               "gimp-vectors-get-name");
 
1619
  gimp_procedure_set_static_strings (procedure,
 
1620
                                     "gimp-vectors-get-name",
 
1621
                                     "Gets the name of the vectors object.",
 
1622
                                     "Gets the name of the vectors object.",
 
1623
                                     "Simon Budig",
 
1624
                                     "Simon Budig",
 
1625
                                     "2005",
 
1626
                                     NULL);
 
1627
  gimp_procedure_add_argument (procedure,
 
1628
                               gimp_param_spec_vectors_id ("vectors",
 
1629
                                                           "vectors",
 
1630
                                                           "The vectors object",
 
1631
                                                           pdb->gimp, FALSE,
 
1632
                                                           GIMP_PARAM_READWRITE));
 
1633
  gimp_procedure_add_return_value (procedure,
 
1634
                                   gimp_param_spec_string ("name",
 
1635
                                                           "name",
 
1636
                                                           "The name of the vectors object",
 
1637
                                                           FALSE, FALSE, FALSE,
 
1638
                                                           NULL,
 
1639
                                                           GIMP_PARAM_READWRITE));
 
1640
  gimp_pdb_register_procedure (pdb, procedure);
 
1641
  g_object_unref (procedure);
 
1642
 
 
1643
  /*
 
1644
   * gimp-vectors-set-name
 
1645
   */
 
1646
  procedure = gimp_procedure_new (vectors_set_name_invoker);
 
1647
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1648
                               "gimp-vectors-set-name");
 
1649
  gimp_procedure_set_static_strings (procedure,
 
1650
                                     "gimp-vectors-set-name",
 
1651
                                     "Sets the name of the vectors object.",
 
1652
                                     "Sets the name of the vectors object.",
 
1653
                                     "Simon Budig",
 
1654
                                     "Simon Budig",
 
1655
                                     "2005",
 
1656
                                     NULL);
 
1657
  gimp_procedure_add_argument (procedure,
 
1658
                               gimp_param_spec_vectors_id ("vectors",
 
1659
                                                           "vectors",
 
1660
                                                           "The vectors object",
 
1661
                                                           pdb->gimp, FALSE,
 
1662
                                                           GIMP_PARAM_READWRITE));
 
1663
  gimp_procedure_add_argument (procedure,
 
1664
                               gimp_param_spec_string ("name",
 
1665
                                                       "name",
 
1666
                                                       "the new name of the path",
 
1667
                                                       FALSE, FALSE, FALSE,
 
1668
                                                       NULL,
 
1669
                                                       GIMP_PARAM_READWRITE));
 
1670
  gimp_pdb_register_procedure (pdb, procedure);
 
1671
  g_object_unref (procedure);
 
1672
 
 
1673
  /*
 
1674
   * gimp-vectors-get-visible
 
1675
   */
 
1676
  procedure = gimp_procedure_new (vectors_get_visible_invoker);
 
1677
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1678
                               "gimp-vectors-get-visible");
 
1679
  gimp_procedure_set_static_strings (procedure,
 
1680
                                     "gimp-vectors-get-visible",
 
1681
                                     "Gets the visibility of the vectors object.",
 
1682
                                     "Gets the visibility of the vectors object.",
 
1683
                                     "Simon Budig",
 
1684
                                     "Simon Budig",
 
1685
                                     "2005",
 
1686
                                     NULL);
 
1687
  gimp_procedure_add_argument (procedure,
 
1688
                               gimp_param_spec_vectors_id ("vectors",
 
1689
                                                           "vectors",
 
1690
                                                           "The vectors object",
 
1691
                                                           pdb->gimp, FALSE,
 
1692
                                                           GIMP_PARAM_READWRITE));
 
1693
  gimp_procedure_add_return_value (procedure,
 
1694
                                   g_param_spec_boolean ("visible",
 
1695
                                                         "visible",
 
1696
                                                         "TRUE if the path is visible, FALSE otherwise",
 
1697
                                                         FALSE,
 
1698
                                                         GIMP_PARAM_READWRITE));
 
1699
  gimp_pdb_register_procedure (pdb, procedure);
 
1700
  g_object_unref (procedure);
 
1701
 
 
1702
  /*
 
1703
   * gimp-vectors-set-visible
 
1704
   */
 
1705
  procedure = gimp_procedure_new (vectors_set_visible_invoker);
 
1706
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1707
                               "gimp-vectors-set-visible");
 
1708
  gimp_procedure_set_static_strings (procedure,
 
1709
                                     "gimp-vectors-set-visible",
 
1710
                                     "Sets the visibility of the vectors object.",
 
1711
                                     "Sets the visibility of the vectors object.",
 
1712
                                     "Simon Budig",
 
1713
                                     "Simon Budig",
 
1714
                                     "2005",
 
1715
                                     NULL);
 
1716
  gimp_procedure_add_argument (procedure,
 
1717
                               gimp_param_spec_vectors_id ("vectors",
 
1718
                                                           "vectors",
 
1719
                                                           "The vectors object",
 
1720
                                                           pdb->gimp, FALSE,
 
1721
                                                           GIMP_PARAM_READWRITE));
 
1722
  gimp_procedure_add_argument (procedure,
 
1723
                               g_param_spec_boolean ("visible",
 
1724
                                                     "visible",
 
1725
                                                     "Whether the path is visible",
 
1726
                                                     FALSE,
 
1727
                                                     GIMP_PARAM_READWRITE));
 
1728
  gimp_pdb_register_procedure (pdb, procedure);
 
1729
  g_object_unref (procedure);
 
1730
 
 
1731
  /*
 
1732
   * gimp-vectors-get-linked
 
1733
   */
 
1734
  procedure = gimp_procedure_new (vectors_get_linked_invoker);
 
1735
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1736
                               "gimp-vectors-get-linked");
 
1737
  gimp_procedure_set_static_strings (procedure,
 
1738
                                     "gimp-vectors-get-linked",
 
1739
                                     "Gets the linked state of the vectors object.",
 
1740
                                     "Gets the linked state of the vectors object.",
 
1741
                                     "Simon Budig",
 
1742
                                     "Simon Budig",
 
1743
                                     "2005",
 
1744
                                     NULL);
 
1745
  gimp_procedure_add_argument (procedure,
 
1746
                               gimp_param_spec_vectors_id ("vectors",
 
1747
                                                           "vectors",
 
1748
                                                           "The vectors object",
 
1749
                                                           pdb->gimp, FALSE,
 
1750
                                                           GIMP_PARAM_READWRITE));
 
1751
  gimp_procedure_add_return_value (procedure,
 
1752
                                   g_param_spec_boolean ("linked",
 
1753
                                                         "linked",
 
1754
                                                         "TRUE if the path is linked, FALSE otherwise",
 
1755
                                                         FALSE,
 
1756
                                                         GIMP_PARAM_READWRITE));
 
1757
  gimp_pdb_register_procedure (pdb, procedure);
 
1758
  g_object_unref (procedure);
 
1759
 
 
1760
  /*
 
1761
   * gimp-vectors-set-linked
 
1762
   */
 
1763
  procedure = gimp_procedure_new (vectors_set_linked_invoker);
 
1764
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1765
                               "gimp-vectors-set-linked");
 
1766
  gimp_procedure_set_static_strings (procedure,
 
1767
                                     "gimp-vectors-set-linked",
 
1768
                                     "Sets the linked state of the vectors object.",
 
1769
                                     "Sets the linked state of the vectors object.",
 
1770
                                     "Simon Budig",
 
1771
                                     "Simon Budig",
 
1772
                                     "2005",
 
1773
                                     NULL);
 
1774
  gimp_procedure_add_argument (procedure,
 
1775
                               gimp_param_spec_vectors_id ("vectors",
 
1776
                                                           "vectors",
 
1777
                                                           "The vectors object",
 
1778
                                                           pdb->gimp, FALSE,
 
1779
                                                           GIMP_PARAM_READWRITE));
 
1780
  gimp_procedure_add_argument (procedure,
 
1781
                               g_param_spec_boolean ("linked",
 
1782
                                                     "linked",
 
1783
                                                     "Whether the path is linked",
 
1784
                                                     FALSE,
 
1785
                                                     GIMP_PARAM_READWRITE));
 
1786
  gimp_pdb_register_procedure (pdb, procedure);
 
1787
  g_object_unref (procedure);
 
1788
 
 
1789
  /*
 
1790
   * gimp-vectors-get-tattoo
 
1791
   */
 
1792
  procedure = gimp_procedure_new (vectors_get_tattoo_invoker);
 
1793
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1794
                               "gimp-vectors-get-tattoo");
 
1795
  gimp_procedure_set_static_strings (procedure,
 
1796
                                     "gimp-vectors-get-tattoo",
 
1797
                                     "Get the tattoo of the vectors object.",
 
1798
                                     "Get the tattoo state of the vectors object.",
 
1799
                                     "Simon Budig",
 
1800
                                     "Simon Budig",
 
1801
                                     "2005",
 
1802
                                     NULL);
 
1803
  gimp_procedure_add_argument (procedure,
 
1804
                               gimp_param_spec_vectors_id ("vectors",
 
1805
                                                           "vectors",
 
1806
                                                           "The vectors object",
 
1807
                                                           pdb->gimp, FALSE,
 
1808
                                                           GIMP_PARAM_READWRITE));
 
1809
  gimp_procedure_add_return_value (procedure,
 
1810
                                   gimp_param_spec_int32 ("tattoo",
 
1811
                                                          "tattoo",
 
1812
                                                          "The vectors tattoo",
 
1813
                                                          G_MININT32, G_MAXINT32, 0,
 
1814
                                                          GIMP_PARAM_READWRITE));
 
1815
  gimp_pdb_register_procedure (pdb, procedure);
 
1816
  g_object_unref (procedure);
 
1817
 
 
1818
  /*
 
1819
   * gimp-vectors-set-tattoo
 
1820
   */
 
1821
  procedure = gimp_procedure_new (vectors_set_tattoo_invoker);
 
1822
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1823
                               "gimp-vectors-set-tattoo");
 
1824
  gimp_procedure_set_static_strings (procedure,
 
1825
                                     "gimp-vectors-set-tattoo",
 
1826
                                     "Set the tattoo of the vectors object.",
 
1827
                                     "Set the tattoo of the vectors object.",
 
1828
                                     "Simon Budig",
 
1829
                                     "Simon Budig",
 
1830
                                     "2005",
 
1831
                                     NULL);
 
1832
  gimp_procedure_add_argument (procedure,
 
1833
                               gimp_param_spec_vectors_id ("vectors",
 
1834
                                                           "vectors",
 
1835
                                                           "The vectors object",
 
1836
                                                           pdb->gimp, FALSE,
 
1837
                                                           GIMP_PARAM_READWRITE));
 
1838
  gimp_procedure_add_argument (procedure,
 
1839
                               gimp_param_spec_int32 ("tattoo",
 
1840
                                                      "tattoo",
 
1841
                                                      "the new tattoo",
 
1842
                                                      G_MININT32, G_MAXINT32, 0,
 
1843
                                                      GIMP_PARAM_READWRITE));
 
1844
  gimp_pdb_register_procedure (pdb, procedure);
 
1845
  g_object_unref (procedure);
 
1846
 
 
1847
  /*
 
1848
   * gimp-vectors-get-strokes
 
1849
   */
 
1850
  procedure = gimp_procedure_new (vectors_get_strokes_invoker);
 
1851
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1852
                               "gimp-vectors-get-strokes");
 
1853
  gimp_procedure_set_static_strings (procedure,
 
1854
                                     "gimp-vectors-get-strokes",
 
1855
                                     "List the strokes associated with the passed path.",
 
1856
                                     "Returns an Array with the stroke-IDs associated with the passed path.",
 
1857
                                     "Simon Budig",
 
1858
                                     "Simon Budig",
 
1859
                                     "2005",
 
1860
                                     NULL);
 
1861
  gimp_procedure_add_argument (procedure,
 
1862
                               gimp_param_spec_vectors_id ("vectors",
 
1863
                                                           "vectors",
 
1864
                                                           "The vectors object",
 
1865
                                                           pdb->gimp, FALSE,
 
1866
                                                           GIMP_PARAM_READWRITE));
 
1867
  gimp_procedure_add_return_value (procedure,
 
1868
                                   gimp_param_spec_int32 ("num-strokes",
 
1869
                                                          "num strokes",
 
1870
                                                          "The number of strokes returned.",
 
1871
                                                          0, G_MAXINT32, 0,
 
1872
                                                          GIMP_PARAM_READWRITE));
 
1873
  gimp_procedure_add_return_value (procedure,
 
1874
                                   gimp_param_spec_int32_array ("stroke-ids",
 
1875
                                                                "stroke ids",
 
1876
                                                                "List of the strokes belonging to the path.",
 
1877
                                                                GIMP_PARAM_READWRITE));
 
1878
  gimp_pdb_register_procedure (pdb, procedure);
 
1879
  g_object_unref (procedure);
 
1880
 
 
1881
  /*
 
1882
   * gimp-vectors-stroke-get-length
 
1883
   */
 
1884
  procedure = gimp_procedure_new (vectors_stroke_get_length_invoker);
 
1885
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1886
                               "gimp-vectors-stroke-get-length");
 
1887
  gimp_procedure_set_static_strings (procedure,
 
1888
                                     "gimp-vectors-stroke-get-length",
 
1889
                                     "Measure the length of the given stroke.",
 
1890
                                     "Measure the length of the given stroke.",
 
1891
                                     "Simon Budig",
 
1892
                                     "Simon Budig",
 
1893
                                     "2005",
 
1894
                                     NULL);
 
1895
  gimp_procedure_add_argument (procedure,
 
1896
                               gimp_param_spec_vectors_id ("vectors",
 
1897
                                                           "vectors",
 
1898
                                                           "The vectors object",
 
1899
                                                           pdb->gimp, FALSE,
 
1900
                                                           GIMP_PARAM_READWRITE));
 
1901
  gimp_procedure_add_argument (procedure,
 
1902
                               gimp_param_spec_int32 ("stroke-id",
 
1903
                                                      "stroke id",
 
1904
                                                      "The stroke ID",
 
1905
                                                      G_MININT32, G_MAXINT32, 0,
 
1906
                                                      GIMP_PARAM_READWRITE));
 
1907
  gimp_procedure_add_argument (procedure,
 
1908
                               g_param_spec_double ("precision",
 
1909
                                                    "precision",
 
1910
                                                    "The precision used for the approximation",
 
1911
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1912
                                                    GIMP_PARAM_READWRITE));
 
1913
  gimp_procedure_add_return_value (procedure,
 
1914
                                   g_param_spec_double ("length",
 
1915
                                                        "length",
 
1916
                                                        "The length (in pixels) of the given stroke.",
 
1917
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1918
                                                        GIMP_PARAM_READWRITE));
 
1919
  gimp_pdb_register_procedure (pdb, procedure);
 
1920
  g_object_unref (procedure);
 
1921
 
 
1922
  /*
 
1923
   * gimp-vectors-stroke-get-point-at-dist
 
1924
   */
 
1925
  procedure = gimp_procedure_new (vectors_stroke_get_point_at_dist_invoker);
 
1926
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1927
                               "gimp-vectors-stroke-get-point-at-dist");
 
1928
  gimp_procedure_set_static_strings (procedure,
 
1929
                                     "gimp-vectors-stroke-get-point-at-dist",
 
1930
                                     "Get point at a specified distance along the stroke.",
 
1931
                                     "This will return the x,y position of a point at a given distance along the stroke. The distance will be obtained by first digitizing the curve internally and then walking along the curve. For a closed stroke the start of the path is the first point on the path that was created. This might not be obvious. If the stroke is not long enough, a \"valid\" flag will be FALSE.",
 
1932
                                     "Simon Budig",
 
1933
                                     "Simon Budig",
 
1934
                                     "2005",
 
1935
                                     NULL);
 
1936
  gimp_procedure_add_argument (procedure,
 
1937
                               gimp_param_spec_vectors_id ("vectors",
 
1938
                                                           "vectors",
 
1939
                                                           "The vectors object",
 
1940
                                                           pdb->gimp, FALSE,
 
1941
                                                           GIMP_PARAM_READWRITE));
 
1942
  gimp_procedure_add_argument (procedure,
 
1943
                               gimp_param_spec_int32 ("stroke-id",
 
1944
                                                      "stroke id",
 
1945
                                                      "The stroke ID",
 
1946
                                                      G_MININT32, G_MAXINT32, 0,
 
1947
                                                      GIMP_PARAM_READWRITE));
 
1948
  gimp_procedure_add_argument (procedure,
 
1949
                               g_param_spec_double ("dist",
 
1950
                                                    "dist",
 
1951
                                                    "The given distance.",
 
1952
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1953
                                                    GIMP_PARAM_READWRITE));
 
1954
  gimp_procedure_add_argument (procedure,
 
1955
                               g_param_spec_double ("precision",
 
1956
                                                    "precision",
 
1957
                                                    "The precision used for the approximation",
 
1958
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1959
                                                    GIMP_PARAM_READWRITE));
 
1960
  gimp_procedure_add_return_value (procedure,
 
1961
                                   g_param_spec_double ("x-point",
 
1962
                                                        "x point",
 
1963
                                                        "The x position of the point.",
 
1964
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1965
                                                        GIMP_PARAM_READWRITE));
 
1966
  gimp_procedure_add_return_value (procedure,
 
1967
                                   g_param_spec_double ("y-point",
 
1968
                                                        "y point",
 
1969
                                                        "The y position of the point.",
 
1970
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1971
                                                        GIMP_PARAM_READWRITE));
 
1972
  gimp_procedure_add_return_value (procedure,
 
1973
                                   g_param_spec_double ("slope",
 
1974
                                                        "slope",
 
1975
                                                        "The slope (dy / dx) at the specified point.",
 
1976
                                                        -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
1977
                                                        GIMP_PARAM_READWRITE));
 
1978
  gimp_procedure_add_return_value (procedure,
 
1979
                                   g_param_spec_boolean ("valid",
 
1980
                                                         "valid",
 
1981
                                                         "Indicator for the validity of the returned data.",
 
1982
                                                         FALSE,
 
1983
                                                         GIMP_PARAM_READWRITE));
 
1984
  gimp_pdb_register_procedure (pdb, procedure);
 
1985
  g_object_unref (procedure);
 
1986
 
 
1987
  /*
 
1988
   * gimp-vectors-remove-stroke
 
1989
   */
 
1990
  procedure = gimp_procedure_new (vectors_remove_stroke_invoker);
 
1991
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
1992
                               "gimp-vectors-remove-stroke");
 
1993
  gimp_procedure_set_static_strings (procedure,
 
1994
                                     "gimp-vectors-remove-stroke",
 
1995
                                     "remove the stroke from a vectors object.",
 
1996
                                     "Remove the stroke from a vectors object.",
 
1997
                                     "Simon Budig",
 
1998
                                     "Simon Budig",
 
1999
                                     "2005",
 
2000
                                     NULL);
 
2001
  gimp_procedure_add_argument (procedure,
 
2002
                               gimp_param_spec_vectors_id ("vectors",
 
2003
                                                           "vectors",
 
2004
                                                           "The vectors object",
 
2005
                                                           pdb->gimp, FALSE,
 
2006
                                                           GIMP_PARAM_READWRITE));
 
2007
  gimp_procedure_add_argument (procedure,
 
2008
                               gimp_param_spec_int32 ("stroke-id",
 
2009
                                                      "stroke id",
 
2010
                                                      "The stroke ID",
 
2011
                                                      G_MININT32, G_MAXINT32, 0,
 
2012
                                                      GIMP_PARAM_READWRITE));
 
2013
  gimp_pdb_register_procedure (pdb, procedure);
 
2014
  g_object_unref (procedure);
 
2015
 
 
2016
  /*
 
2017
   * gimp-vectors-stroke-close
 
2018
   */
 
2019
  procedure = gimp_procedure_new (vectors_stroke_close_invoker);
 
2020
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2021
                               "gimp-vectors-stroke-close");
 
2022
  gimp_procedure_set_static_strings (procedure,
 
2023
                                     "gimp-vectors-stroke-close",
 
2024
                                     "closes the specified stroke.",
 
2025
                                     "Closes the specified stroke.",
 
2026
                                     "Simon Budig",
 
2027
                                     "Simon Budig",
 
2028
                                     "2005",
 
2029
                                     NULL);
 
2030
  gimp_procedure_add_argument (procedure,
 
2031
                               gimp_param_spec_vectors_id ("vectors",
 
2032
                                                           "vectors",
 
2033
                                                           "The vectors object",
 
2034
                                                           pdb->gimp, FALSE,
 
2035
                                                           GIMP_PARAM_READWRITE));
 
2036
  gimp_procedure_add_argument (procedure,
 
2037
                               gimp_param_spec_int32 ("stroke-id",
 
2038
                                                      "stroke id",
 
2039
                                                      "The stroke ID",
 
2040
                                                      G_MININT32, G_MAXINT32, 0,
 
2041
                                                      GIMP_PARAM_READWRITE));
 
2042
  gimp_pdb_register_procedure (pdb, procedure);
 
2043
  g_object_unref (procedure);
 
2044
 
 
2045
  /*
 
2046
   * gimp-vectors-stroke-translate
 
2047
   */
 
2048
  procedure = gimp_procedure_new (vectors_stroke_translate_invoker);
 
2049
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2050
                               "gimp-vectors-stroke-translate");
 
2051
  gimp_procedure_set_static_strings (procedure,
 
2052
                                     "gimp-vectors-stroke-translate",
 
2053
                                     "translate the given stroke.",
 
2054
                                     "Translate the given stroke.",
 
2055
                                     "Simon Budig",
 
2056
                                     "Simon Budig",
 
2057
                                     "2005",
 
2058
                                     NULL);
 
2059
  gimp_procedure_add_argument (procedure,
 
2060
                               gimp_param_spec_vectors_id ("vectors",
 
2061
                                                           "vectors",
 
2062
                                                           "The vectors object",
 
2063
                                                           pdb->gimp, FALSE,
 
2064
                                                           GIMP_PARAM_READWRITE));
 
2065
  gimp_procedure_add_argument (procedure,
 
2066
                               gimp_param_spec_int32 ("stroke-id",
 
2067
                                                      "stroke id",
 
2068
                                                      "The stroke ID",
 
2069
                                                      G_MININT32, G_MAXINT32, 0,
 
2070
                                                      GIMP_PARAM_READWRITE));
 
2071
  gimp_procedure_add_argument (procedure,
 
2072
                               gimp_param_spec_int32 ("off-x",
 
2073
                                                      "off x",
 
2074
                                                      "Offset in x direction",
 
2075
                                                      G_MININT32, G_MAXINT32, 0,
 
2076
                                                      GIMP_PARAM_READWRITE));
 
2077
  gimp_procedure_add_argument (procedure,
 
2078
                               gimp_param_spec_int32 ("off-y",
 
2079
                                                      "off y",
 
2080
                                                      "Offset in y direction",
 
2081
                                                      G_MININT32, G_MAXINT32, 0,
 
2082
                                                      GIMP_PARAM_READWRITE));
 
2083
  gimp_pdb_register_procedure (pdb, procedure);
 
2084
  g_object_unref (procedure);
 
2085
 
 
2086
  /*
 
2087
   * gimp-vectors-stroke-scale
 
2088
   */
 
2089
  procedure = gimp_procedure_new (vectors_stroke_scale_invoker);
 
2090
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2091
                               "gimp-vectors-stroke-scale");
 
2092
  gimp_procedure_set_static_strings (procedure,
 
2093
                                     "gimp-vectors-stroke-scale",
 
2094
                                     "scales the given stroke.",
 
2095
                                     "Scale the given stroke.",
 
2096
                                     "Simon Budig",
 
2097
                                     "Simon Budig",
 
2098
                                     "2005",
 
2099
                                     NULL);
 
2100
  gimp_procedure_add_argument (procedure,
 
2101
                               gimp_param_spec_vectors_id ("vectors",
 
2102
                                                           "vectors",
 
2103
                                                           "The vectors object",
 
2104
                                                           pdb->gimp, FALSE,
 
2105
                                                           GIMP_PARAM_READWRITE));
 
2106
  gimp_procedure_add_argument (procedure,
 
2107
                               gimp_param_spec_int32 ("stroke-id",
 
2108
                                                      "stroke id",
 
2109
                                                      "The stroke ID",
 
2110
                                                      G_MININT32, G_MAXINT32, 0,
 
2111
                                                      GIMP_PARAM_READWRITE));
 
2112
  gimp_procedure_add_argument (procedure,
 
2113
                               g_param_spec_double ("scale-x",
 
2114
                                                    "scale x",
 
2115
                                                    "Scale factor in x direction",
 
2116
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2117
                                                    GIMP_PARAM_READWRITE));
 
2118
  gimp_procedure_add_argument (procedure,
 
2119
                               g_param_spec_double ("scale-y",
 
2120
                                                    "scale y",
 
2121
                                                    "Scale factor in y direction",
 
2122
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2123
                                                    GIMP_PARAM_READWRITE));
 
2124
  gimp_pdb_register_procedure (pdb, procedure);
 
2125
  g_object_unref (procedure);
 
2126
 
 
2127
  /*
 
2128
   * gimp-vectors-stroke-rotate
 
2129
   */
 
2130
  procedure = gimp_procedure_new (vectors_stroke_rotate_invoker);
 
2131
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2132
                               "gimp-vectors-stroke-rotate");
 
2133
  gimp_procedure_set_static_strings (procedure,
 
2134
                                     "gimp-vectors-stroke-rotate",
 
2135
                                     "rotates the given stroke.",
 
2136
                                     "Rotates the given stroke around given center by angle (in degrees).",
 
2137
                                     "Jo\xc3\xa3o S. O. Bueno",
 
2138
                                     "Jo\xc3\xa3o S. O. Bueno",
 
2139
                                     "2006",
 
2140
                                     NULL);
 
2141
  gimp_procedure_add_argument (procedure,
 
2142
                               gimp_param_spec_vectors_id ("vectors",
 
2143
                                                           "vectors",
 
2144
                                                           "The vectors object",
 
2145
                                                           pdb->gimp, FALSE,
 
2146
                                                           GIMP_PARAM_READWRITE));
 
2147
  gimp_procedure_add_argument (procedure,
 
2148
                               gimp_param_spec_int32 ("stroke-id",
 
2149
                                                      "stroke id",
 
2150
                                                      "The stroke ID",
 
2151
                                                      G_MININT32, G_MAXINT32, 0,
 
2152
                                                      GIMP_PARAM_READWRITE));
 
2153
  gimp_procedure_add_argument (procedure,
 
2154
                               g_param_spec_double ("center-x",
 
2155
                                                    "center x",
 
2156
                                                    "X coordinate of the rotation center",
 
2157
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2158
                                                    GIMP_PARAM_READWRITE));
 
2159
  gimp_procedure_add_argument (procedure,
 
2160
                               g_param_spec_double ("center-y",
 
2161
                                                    "center y",
 
2162
                                                    "Y coordinate of the rotation center",
 
2163
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2164
                                                    GIMP_PARAM_READWRITE));
 
2165
  gimp_procedure_add_argument (procedure,
 
2166
                               g_param_spec_double ("angle",
 
2167
                                                    "angle",
 
2168
                                                    "angle to rotate about",
 
2169
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2170
                                                    GIMP_PARAM_READWRITE));
 
2171
  gimp_pdb_register_procedure (pdb, procedure);
 
2172
  g_object_unref (procedure);
 
2173
 
 
2174
  /*
 
2175
   * gimp-vectors-stroke-flip
 
2176
   */
 
2177
  procedure = gimp_procedure_new (vectors_stroke_flip_invoker);
 
2178
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2179
                               "gimp-vectors-stroke-flip");
 
2180
  gimp_procedure_set_static_strings (procedure,
 
2181
                                     "gimp-vectors-stroke-flip",
 
2182
                                     "flips the given stroke.",
 
2183
                                     "Rotates the given stroke around given center by angle (in degrees).",
 
2184
                                     "Jo\xc3\xa3o S. O. Bueno",
 
2185
                                     "Jo\xc3\xa3o S. O. Bueno",
 
2186
                                     "2006",
 
2187
                                     NULL);
 
2188
  gimp_procedure_add_argument (procedure,
 
2189
                               gimp_param_spec_vectors_id ("vectors",
 
2190
                                                           "vectors",
 
2191
                                                           "The vectors object",
 
2192
                                                           pdb->gimp, FALSE,
 
2193
                                                           GIMP_PARAM_READWRITE));
 
2194
  gimp_procedure_add_argument (procedure,
 
2195
                               gimp_param_spec_int32 ("stroke-id",
 
2196
                                                      "stroke id",
 
2197
                                                      "The stroke ID",
 
2198
                                                      G_MININT32, G_MAXINT32, 0,
 
2199
                                                      GIMP_PARAM_READWRITE));
 
2200
  gimp_procedure_add_argument (procedure,
 
2201
                               gimp_param_spec_enum ("flip-type",
 
2202
                                                     "flip type",
 
2203
                                                     "Flip orientation, either vertical or horizontal",
 
2204
                                                     GIMP_TYPE_ORIENTATION_TYPE,
 
2205
                                                     GIMP_ORIENTATION_HORIZONTAL,
 
2206
                                                     GIMP_PARAM_READWRITE));
 
2207
  gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->args[2]),
 
2208
                                      GIMP_ORIENTATION_UNKNOWN);
 
2209
  gimp_procedure_add_argument (procedure,
 
2210
                               g_param_spec_double ("axis",
 
2211
                                                    "axis",
 
2212
                                                    "axis coordinate about which to flip, in pixels",
 
2213
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2214
                                                    GIMP_PARAM_READWRITE));
 
2215
  gimp_pdb_register_procedure (pdb, procedure);
 
2216
  g_object_unref (procedure);
 
2217
 
 
2218
  /*
 
2219
   * gimp-vectors-stroke-flip-free
 
2220
   */
 
2221
  procedure = gimp_procedure_new (vectors_stroke_flip_free_invoker);
 
2222
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2223
                               "gimp-vectors-stroke-flip-free");
 
2224
  gimp_procedure_set_static_strings (procedure,
 
2225
                                     "gimp-vectors-stroke-flip-free",
 
2226
                                     "flips the given stroke about an arbitrary axis.",
 
2227
                                     "Flips the given stroke about an arbitrary axis. Axis is defined by two coordinates in the image (in pixels), through which the flipping axis passes.",
 
2228
                                     "Jo\xc3\xa3o S. O. Bueno",
 
2229
                                     "Jo\xc3\xa3o S. O. Bueno",
 
2230
                                     "2006",
 
2231
                                     NULL);
 
2232
  gimp_procedure_add_argument (procedure,
 
2233
                               gimp_param_spec_vectors_id ("vectors",
 
2234
                                                           "vectors",
 
2235
                                                           "The vectors object",
 
2236
                                                           pdb->gimp, FALSE,
 
2237
                                                           GIMP_PARAM_READWRITE));
 
2238
  gimp_procedure_add_argument (procedure,
 
2239
                               gimp_param_spec_int32 ("stroke-id",
 
2240
                                                      "stroke id",
 
2241
                                                      "The stroke ID",
 
2242
                                                      G_MININT32, G_MAXINT32, 0,
 
2243
                                                      GIMP_PARAM_READWRITE));
 
2244
  gimp_procedure_add_argument (procedure,
 
2245
                               g_param_spec_double ("x1",
 
2246
                                                    "x1",
 
2247
                                                    "X coordinate of the first point of the flipping axis",
 
2248
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2249
                                                    GIMP_PARAM_READWRITE));
 
2250
  gimp_procedure_add_argument (procedure,
 
2251
                               g_param_spec_double ("y1",
 
2252
                                                    "y1",
 
2253
                                                    "Y coordinate of the first point of the flipping axis",
 
2254
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2255
                                                    GIMP_PARAM_READWRITE));
 
2256
  gimp_procedure_add_argument (procedure,
 
2257
                               g_param_spec_double ("x2",
 
2258
                                                    "x2",
 
2259
                                                    "X coordinate of the second point of the flipping axis",
 
2260
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2261
                                                    GIMP_PARAM_READWRITE));
 
2262
  gimp_procedure_add_argument (procedure,
 
2263
                               g_param_spec_double ("y2",
 
2264
                                                    "y2",
 
2265
                                                    "Y coordinate of the second point of the flipping axis",
 
2266
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2267
                                                    GIMP_PARAM_READWRITE));
 
2268
  gimp_pdb_register_procedure (pdb, procedure);
 
2269
  g_object_unref (procedure);
 
2270
 
 
2271
  /*
 
2272
   * gimp-vectors-stroke-get-points
 
2273
   */
 
2274
  procedure = gimp_procedure_new (vectors_stroke_get_points_invoker);
 
2275
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2276
                               "gimp-vectors-stroke-get-points");
 
2277
  gimp_procedure_set_static_strings (procedure,
 
2278
                                     "gimp-vectors-stroke-get-points",
 
2279
                                     "returns the control points of a stroke.",
 
2280
                                     "returns the control points of a stroke. The interpretation of the coordinates returned depends on the type of the stroke. For Gimp 2.4 this is always a bezier stroke, where the coordinates are the control points.",
 
2281
                                     "Simon Budig",
 
2282
                                     "Simon Budig",
 
2283
                                     "2006",
 
2284
                                     NULL);
 
2285
  gimp_procedure_add_argument (procedure,
 
2286
                               gimp_param_spec_vectors_id ("vectors",
 
2287
                                                           "vectors",
 
2288
                                                           "The vectors object",
 
2289
                                                           pdb->gimp, FALSE,
 
2290
                                                           GIMP_PARAM_READWRITE));
 
2291
  gimp_procedure_add_argument (procedure,
 
2292
                               gimp_param_spec_int32 ("stroke-id",
 
2293
                                                      "stroke id",
 
2294
                                                      "The stroke ID",
 
2295
                                                      G_MININT32, G_MAXINT32, 0,
 
2296
                                                      GIMP_PARAM_READWRITE));
 
2297
  gimp_procedure_add_return_value (procedure,
 
2298
                                   g_param_spec_enum ("type",
 
2299
                                                      "type",
 
2300
                                                      "type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).",
 
2301
                                                      GIMP_TYPE_VECTORS_STROKE_TYPE,
 
2302
                                                      GIMP_VECTORS_STROKE_TYPE_BEZIER,
 
2303
                                                      GIMP_PARAM_READWRITE));
 
2304
  gimp_procedure_add_return_value (procedure,
 
2305
                                   gimp_param_spec_int32 ("num-points",
 
2306
                                                          "num points",
 
2307
                                                          "The number of floats returned.",
 
2308
                                                          0, G_MAXINT32, 0,
 
2309
                                                          GIMP_PARAM_READWRITE));
 
2310
  gimp_procedure_add_return_value (procedure,
 
2311
                                   gimp_param_spec_float_array ("controlpoints",
 
2312
                                                                "controlpoints",
 
2313
                                                                "List of the control points for the stroke (x0, y0, x1, y1, ...).",
 
2314
                                                                GIMP_PARAM_READWRITE));
 
2315
  gimp_procedure_add_return_value (procedure,
 
2316
                                   g_param_spec_boolean ("closed",
 
2317
                                                         "closed",
 
2318
                                                         "Whether the stroke is closed or not.",
 
2319
                                                         FALSE,
 
2320
                                                         GIMP_PARAM_READWRITE));
 
2321
  gimp_pdb_register_procedure (pdb, procedure);
 
2322
  g_object_unref (procedure);
 
2323
 
 
2324
  /*
 
2325
   * gimp-vectors-stroke-new-from-points
 
2326
   */
 
2327
  procedure = gimp_procedure_new (vectors_stroke_new_from_points_invoker);
 
2328
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2329
                               "gimp-vectors-stroke-new-from-points");
 
2330
  gimp_procedure_set_static_strings (procedure,
 
2331
                                     "gimp-vectors-stroke-new-from-points",
 
2332
                                     "Adds a stroke of a given type to the vectors object.",
 
2333
                                     "Adds a stroke of a given type to the vectors object. The coordinates of the control points can be specified. For now only strokes of the type GIMP_VECTORS_STROKE_TYPE_BEZIER are supported. The control points are specified as a pair of float values for the x- and y-coordinate. The Bezier stroke type needs a multiple of three control points. Each Bezier segment endpoint (anchor, A) has two additional control points (C) associated. They are specified in the order CACCACCAC...",
 
2334
                                     "Simon Budig",
 
2335
                                     "Simon Budig",
 
2336
                                     "2006",
 
2337
                                     NULL);
 
2338
  gimp_procedure_add_argument (procedure,
 
2339
                               gimp_param_spec_vectors_id ("vectors",
 
2340
                                                           "vectors",
 
2341
                                                           "The vectors object",
 
2342
                                                           pdb->gimp, FALSE,
 
2343
                                                           GIMP_PARAM_READWRITE));
 
2344
  gimp_procedure_add_argument (procedure,
 
2345
                               g_param_spec_enum ("type",
 
2346
                                                  "type",
 
2347
                                                  "type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).",
 
2348
                                                  GIMP_TYPE_VECTORS_STROKE_TYPE,
 
2349
                                                  GIMP_VECTORS_STROKE_TYPE_BEZIER,
 
2350
                                                  GIMP_PARAM_READWRITE));
 
2351
  gimp_procedure_add_argument (procedure,
 
2352
                               gimp_param_spec_int32 ("num-points",
 
2353
                                                      "num points",
 
2354
                                                      "The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- and y-coordinate).",
 
2355
                                                      0, G_MAXINT32, 0,
 
2356
                                                      GIMP_PARAM_READWRITE));
 
2357
  gimp_procedure_add_argument (procedure,
 
2358
                               gimp_param_spec_float_array ("controlpoints",
 
2359
                                                            "controlpoints",
 
2360
                                                            "List of the x- and y-coordinates of the control points.",
 
2361
                                                            GIMP_PARAM_READWRITE));
 
2362
  gimp_procedure_add_argument (procedure,
 
2363
                               g_param_spec_boolean ("closed",
 
2364
                                                     "closed",
 
2365
                                                     "Whether the stroke is to be closed or not.",
 
2366
                                                     FALSE,
 
2367
                                                     GIMP_PARAM_READWRITE));
 
2368
  gimp_procedure_add_return_value (procedure,
 
2369
                                   gimp_param_spec_int32 ("stroke-id",
 
2370
                                                          "stroke id",
 
2371
                                                          "The stroke ID of the newly created stroke.",
 
2372
                                                          G_MININT32, G_MAXINT32, 0,
 
2373
                                                          GIMP_PARAM_READWRITE));
 
2374
  gimp_pdb_register_procedure (pdb, procedure);
 
2375
  g_object_unref (procedure);
 
2376
 
 
2377
  /*
 
2378
   * gimp-vectors-stroke-interpolate
 
2379
   */
 
2380
  procedure = gimp_procedure_new (vectors_stroke_interpolate_invoker);
 
2381
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2382
                               "gimp-vectors-stroke-interpolate");
 
2383
  gimp_procedure_set_static_strings (procedure,
 
2384
                                     "gimp-vectors-stroke-interpolate",
 
2385
                                     "returns polygonal approximation of the stroke.",
 
2386
                                     "returns polygonal approximation of the stroke.",
 
2387
                                     "Simon Budig",
 
2388
                                     "Simon Budig",
 
2389
                                     "2005",
 
2390
                                     NULL);
 
2391
  gimp_procedure_add_argument (procedure,
 
2392
                               gimp_param_spec_vectors_id ("vectors",
 
2393
                                                           "vectors",
 
2394
                                                           "The vectors object",
 
2395
                                                           pdb->gimp, FALSE,
 
2396
                                                           GIMP_PARAM_READWRITE));
 
2397
  gimp_procedure_add_argument (procedure,
 
2398
                               gimp_param_spec_int32 ("stroke-id",
 
2399
                                                      "stroke id",
 
2400
                                                      "The stroke ID",
 
2401
                                                      G_MININT32, G_MAXINT32, 0,
 
2402
                                                      GIMP_PARAM_READWRITE));
 
2403
  gimp_procedure_add_argument (procedure,
 
2404
                               g_param_spec_double ("precision",
 
2405
                                                    "precision",
 
2406
                                                    "The precision used for the approximation",
 
2407
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2408
                                                    GIMP_PARAM_READWRITE));
 
2409
  gimp_procedure_add_return_value (procedure,
 
2410
                                   gimp_param_spec_int32 ("num-coords",
 
2411
                                                          "num coords",
 
2412
                                                          "The number of floats returned.",
 
2413
                                                          0, G_MAXINT32, 0,
 
2414
                                                          GIMP_PARAM_READWRITE));
 
2415
  gimp_procedure_add_return_value (procedure,
 
2416
                                   gimp_param_spec_float_array ("coords",
 
2417
                                                                "coords",
 
2418
                                                                "List of the coords along the path (x0, y0, x1, y1, ...).",
 
2419
                                                                GIMP_PARAM_READWRITE));
 
2420
  gimp_procedure_add_return_value (procedure,
 
2421
                                   g_param_spec_boolean ("closed",
 
2422
                                                         "closed",
 
2423
                                                         "Whether the stroke is closed or not.",
 
2424
                                                         FALSE,
 
2425
                                                         GIMP_PARAM_READWRITE));
 
2426
  gimp_pdb_register_procedure (pdb, procedure);
 
2427
  g_object_unref (procedure);
 
2428
 
 
2429
  /*
 
2430
   * gimp-vectors-bezier-stroke-new-moveto
 
2431
   */
 
2432
  procedure = gimp_procedure_new (vectors_bezier_stroke_new_moveto_invoker);
 
2433
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2434
                               "gimp-vectors-bezier-stroke-new-moveto");
 
2435
  gimp_procedure_set_static_strings (procedure,
 
2436
                                     "gimp-vectors-bezier-stroke-new-moveto",
 
2437
                                     "Adds a bezier stroke with a single moveto to the vectors object.",
 
2438
                                     "Adds a bezier stroke with a single moveto to the vectors object.",
 
2439
                                     "Simon Budig",
 
2440
                                     "Simon Budig",
 
2441
                                     "2005",
 
2442
                                     NULL);
 
2443
  gimp_procedure_add_argument (procedure,
 
2444
                               gimp_param_spec_vectors_id ("vectors",
 
2445
                                                           "vectors",
 
2446
                                                           "The vectors object",
 
2447
                                                           pdb->gimp, FALSE,
 
2448
                                                           GIMP_PARAM_READWRITE));
 
2449
  gimp_procedure_add_argument (procedure,
 
2450
                               g_param_spec_double ("x0",
 
2451
                                                    "x0",
 
2452
                                                    "The x-coordinate of the moveto",
 
2453
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2454
                                                    GIMP_PARAM_READWRITE));
 
2455
  gimp_procedure_add_argument (procedure,
 
2456
                               g_param_spec_double ("y0",
 
2457
                                                    "y0",
 
2458
                                                    "The y-coordinate of the moveto",
 
2459
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2460
                                                    GIMP_PARAM_READWRITE));
 
2461
  gimp_procedure_add_return_value (procedure,
 
2462
                                   gimp_param_spec_int32 ("stroke-id",
 
2463
                                                          "stroke id",
 
2464
                                                          "The resulting stroke",
 
2465
                                                          G_MININT32, G_MAXINT32, 0,
 
2466
                                                          GIMP_PARAM_READWRITE));
 
2467
  gimp_pdb_register_procedure (pdb, procedure);
 
2468
  g_object_unref (procedure);
 
2469
 
 
2470
  /*
 
2471
   * gimp-vectors-bezier-stroke-lineto
 
2472
   */
 
2473
  procedure = gimp_procedure_new (vectors_bezier_stroke_lineto_invoker);
 
2474
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2475
                               "gimp-vectors-bezier-stroke-lineto");
 
2476
  gimp_procedure_set_static_strings (procedure,
 
2477
                                     "gimp-vectors-bezier-stroke-lineto",
 
2478
                                     "Extends a bezier stroke with a lineto.",
 
2479
                                     "Extends a bezier stroke with a lineto.",
 
2480
                                     "Simon Budig",
 
2481
                                     "Simon Budig",
 
2482
                                     "2005",
 
2483
                                     NULL);
 
2484
  gimp_procedure_add_argument (procedure,
 
2485
                               gimp_param_spec_vectors_id ("vectors",
 
2486
                                                           "vectors",
 
2487
                                                           "The vectors object",
 
2488
                                                           pdb->gimp, FALSE,
 
2489
                                                           GIMP_PARAM_READWRITE));
 
2490
  gimp_procedure_add_argument (procedure,
 
2491
                               gimp_param_spec_int32 ("stroke-id",
 
2492
                                                      "stroke id",
 
2493
                                                      "The stroke ID",
 
2494
                                                      G_MININT32, G_MAXINT32, 0,
 
2495
                                                      GIMP_PARAM_READWRITE));
 
2496
  gimp_procedure_add_argument (procedure,
 
2497
                               g_param_spec_double ("x0",
 
2498
                                                    "x0",
 
2499
                                                    "The x-coordinate of the lineto",
 
2500
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2501
                                                    GIMP_PARAM_READWRITE));
 
2502
  gimp_procedure_add_argument (procedure,
 
2503
                               g_param_spec_double ("y0",
 
2504
                                                    "y0",
 
2505
                                                    "The y-coordinate of the lineto",
 
2506
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2507
                                                    GIMP_PARAM_READWRITE));
 
2508
  gimp_pdb_register_procedure (pdb, procedure);
 
2509
  g_object_unref (procedure);
 
2510
 
 
2511
  /*
 
2512
   * gimp-vectors-bezier-stroke-conicto
 
2513
   */
 
2514
  procedure = gimp_procedure_new (vectors_bezier_stroke_conicto_invoker);
 
2515
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2516
                               "gimp-vectors-bezier-stroke-conicto");
 
2517
  gimp_procedure_set_static_strings (procedure,
 
2518
                                     "gimp-vectors-bezier-stroke-conicto",
 
2519
                                     "Extends a bezier stroke with a conic bezier spline.",
 
2520
                                     "Extends a bezier stroke with a conic bezier spline. Actually a cubic bezier spline gets added that realizes the shape of a conic bezier spline.",
 
2521
                                     "Simon Budig",
 
2522
                                     "Simon Budig",
 
2523
                                     "2005",
 
2524
                                     NULL);
 
2525
  gimp_procedure_add_argument (procedure,
 
2526
                               gimp_param_spec_vectors_id ("vectors",
 
2527
                                                           "vectors",
 
2528
                                                           "The vectors object",
 
2529
                                                           pdb->gimp, FALSE,
 
2530
                                                           GIMP_PARAM_READWRITE));
 
2531
  gimp_procedure_add_argument (procedure,
 
2532
                               gimp_param_spec_int32 ("stroke-id",
 
2533
                                                      "stroke id",
 
2534
                                                      "The stroke ID",
 
2535
                                                      G_MININT32, G_MAXINT32, 0,
 
2536
                                                      GIMP_PARAM_READWRITE));
 
2537
  gimp_procedure_add_argument (procedure,
 
2538
                               g_param_spec_double ("x0",
 
2539
                                                    "x0",
 
2540
                                                    "The x-coordinate of the control point",
 
2541
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2542
                                                    GIMP_PARAM_READWRITE));
 
2543
  gimp_procedure_add_argument (procedure,
 
2544
                               g_param_spec_double ("y0",
 
2545
                                                    "y0",
 
2546
                                                    "The y-coordinate of the control point",
 
2547
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2548
                                                    GIMP_PARAM_READWRITE));
 
2549
  gimp_procedure_add_argument (procedure,
 
2550
                               g_param_spec_double ("x1",
 
2551
                                                    "x1",
 
2552
                                                    "The x-coordinate of the end point",
 
2553
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2554
                                                    GIMP_PARAM_READWRITE));
 
2555
  gimp_procedure_add_argument (procedure,
 
2556
                               g_param_spec_double ("y1",
 
2557
                                                    "y1",
 
2558
                                                    "The y-coordinate of the end point",
 
2559
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2560
                                                    GIMP_PARAM_READWRITE));
 
2561
  gimp_pdb_register_procedure (pdb, procedure);
 
2562
  g_object_unref (procedure);
 
2563
 
 
2564
  /*
 
2565
   * gimp-vectors-bezier-stroke-cubicto
 
2566
   */
 
2567
  procedure = gimp_procedure_new (vectors_bezier_stroke_cubicto_invoker);
 
2568
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2569
                               "gimp-vectors-bezier-stroke-cubicto");
 
2570
  gimp_procedure_set_static_strings (procedure,
 
2571
                                     "gimp-vectors-bezier-stroke-cubicto",
 
2572
                                     "Extends a bezier stroke with a cubic bezier spline.",
 
2573
                                     "Extends a bezier stroke with a cubic bezier spline.",
 
2574
                                     "Simon Budig",
 
2575
                                     "Simon Budig",
 
2576
                                     "2005",
 
2577
                                     NULL);
 
2578
  gimp_procedure_add_argument (procedure,
 
2579
                               gimp_param_spec_vectors_id ("vectors",
 
2580
                                                           "vectors",
 
2581
                                                           "The vectors object",
 
2582
                                                           pdb->gimp, FALSE,
 
2583
                                                           GIMP_PARAM_READWRITE));
 
2584
  gimp_procedure_add_argument (procedure,
 
2585
                               gimp_param_spec_int32 ("stroke-id",
 
2586
                                                      "stroke id",
 
2587
                                                      "The stroke ID",
 
2588
                                                      G_MININT32, G_MAXINT32, 0,
 
2589
                                                      GIMP_PARAM_READWRITE));
 
2590
  gimp_procedure_add_argument (procedure,
 
2591
                               g_param_spec_double ("x0",
 
2592
                                                    "x0",
 
2593
                                                    "The x-coordinate of the first control point",
 
2594
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2595
                                                    GIMP_PARAM_READWRITE));
 
2596
  gimp_procedure_add_argument (procedure,
 
2597
                               g_param_spec_double ("y0",
 
2598
                                                    "y0",
 
2599
                                                    "The y-coordinate of the first control point",
 
2600
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2601
                                                    GIMP_PARAM_READWRITE));
 
2602
  gimp_procedure_add_argument (procedure,
 
2603
                               g_param_spec_double ("x1",
 
2604
                                                    "x1",
 
2605
                                                    "The x-coordinate of the second control point",
 
2606
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2607
                                                    GIMP_PARAM_READWRITE));
 
2608
  gimp_procedure_add_argument (procedure,
 
2609
                               g_param_spec_double ("y1",
 
2610
                                                    "y1",
 
2611
                                                    "The y-coordinate of the second control point",
 
2612
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2613
                                                    GIMP_PARAM_READWRITE));
 
2614
  gimp_procedure_add_argument (procedure,
 
2615
                               g_param_spec_double ("x2",
 
2616
                                                    "x2",
 
2617
                                                    "The x-coordinate of the end point",
 
2618
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2619
                                                    GIMP_PARAM_READWRITE));
 
2620
  gimp_procedure_add_argument (procedure,
 
2621
                               g_param_spec_double ("y2",
 
2622
                                                    "y2",
 
2623
                                                    "The y-coordinate of the end point",
 
2624
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2625
                                                    GIMP_PARAM_READWRITE));
 
2626
  gimp_pdb_register_procedure (pdb, procedure);
 
2627
  g_object_unref (procedure);
 
2628
 
 
2629
  /*
 
2630
   * gimp-vectors-bezier-stroke-new-ellipse
 
2631
   */
 
2632
  procedure = gimp_procedure_new (vectors_bezier_stroke_new_ellipse_invoker);
 
2633
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2634
                               "gimp-vectors-bezier-stroke-new-ellipse");
 
2635
  gimp_procedure_set_static_strings (procedure,
 
2636
                                     "gimp-vectors-bezier-stroke-new-ellipse",
 
2637
                                     "Adds a bezier stroke describing an ellipse the vectors object.",
 
2638
                                     "Adds a bezier stroke describing an ellipse the vectors object.",
 
2639
                                     "Simon Budig",
 
2640
                                     "Simon Budig",
 
2641
                                     "2005",
 
2642
                                     NULL);
 
2643
  gimp_procedure_add_argument (procedure,
 
2644
                               gimp_param_spec_vectors_id ("vectors",
 
2645
                                                           "vectors",
 
2646
                                                           "The vectors object",
 
2647
                                                           pdb->gimp, FALSE,
 
2648
                                                           GIMP_PARAM_READWRITE));
 
2649
  gimp_procedure_add_argument (procedure,
 
2650
                               g_param_spec_double ("x0",
 
2651
                                                    "x0",
 
2652
                                                    "The x-coordinate of the center",
 
2653
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2654
                                                    GIMP_PARAM_READWRITE));
 
2655
  gimp_procedure_add_argument (procedure,
 
2656
                               g_param_spec_double ("y0",
 
2657
                                                    "y0",
 
2658
                                                    "The y-coordinate of the center",
 
2659
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2660
                                                    GIMP_PARAM_READWRITE));
 
2661
  gimp_procedure_add_argument (procedure,
 
2662
                               g_param_spec_double ("radius-x",
 
2663
                                                    "radius x",
 
2664
                                                    "The radius in x direction",
 
2665
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2666
                                                    GIMP_PARAM_READWRITE));
 
2667
  gimp_procedure_add_argument (procedure,
 
2668
                               g_param_spec_double ("radius-y",
 
2669
                                                    "radius y",
 
2670
                                                    "The radius in y direction",
 
2671
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2672
                                                    GIMP_PARAM_READWRITE));
 
2673
  gimp_procedure_add_argument (procedure,
 
2674
                               g_param_spec_double ("angle",
 
2675
                                                    "angle",
 
2676
                                                    "The angle the x-axis of the ellipse (radians, counterclockwise)",
 
2677
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2678
                                                    GIMP_PARAM_READWRITE));
 
2679
  gimp_procedure_add_return_value (procedure,
 
2680
                                   gimp_param_spec_int32 ("stroke-id",
 
2681
                                                          "stroke id",
 
2682
                                                          "The resulting stroke",
 
2683
                                                          G_MININT32, G_MAXINT32, 0,
 
2684
                                                          GIMP_PARAM_READWRITE));
 
2685
  gimp_pdb_register_procedure (pdb, procedure);
 
2686
  g_object_unref (procedure);
 
2687
 
 
2688
  /*
 
2689
   * gimp-vectors-to-selection
 
2690
   */
 
2691
  procedure = gimp_procedure_new (vectors_to_selection_invoker);
 
2692
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2693
                               "gimp-vectors-to-selection");
 
2694
  gimp_procedure_set_static_strings (procedure,
 
2695
                                     "gimp-vectors-to-selection",
 
2696
                                     "Transforms the specified vectors object into a selection",
 
2697
                                     "This procedure renders the desired vectors object into the current selection of the image the vectors object belongs to.",
 
2698
                                     "Simon Budig",
 
2699
                                     "Simon Budig",
 
2700
                                     "2006",
 
2701
                                     NULL);
 
2702
  gimp_procedure_add_argument (procedure,
 
2703
                               gimp_param_spec_vectors_id ("vectors",
 
2704
                                                           "vectors",
 
2705
                                                           "The vectors object to render to the selection",
 
2706
                                                           pdb->gimp, FALSE,
 
2707
                                                           GIMP_PARAM_READWRITE));
 
2708
  gimp_procedure_add_argument (procedure,
 
2709
                               g_param_spec_enum ("operation",
 
2710
                                                  "operation",
 
2711
                                                  "The desired operation with current selection",
 
2712
                                                  GIMP_TYPE_CHANNEL_OPS,
 
2713
                                                  GIMP_CHANNEL_OP_ADD,
 
2714
                                                  GIMP_PARAM_READWRITE));
 
2715
  gimp_procedure_add_argument (procedure,
 
2716
                               g_param_spec_boolean ("antialias",
 
2717
                                                     "antialias",
 
2718
                                                     "Antialias selection.",
 
2719
                                                     FALSE,
 
2720
                                                     GIMP_PARAM_READWRITE));
 
2721
  gimp_procedure_add_argument (procedure,
 
2722
                               g_param_spec_boolean ("feather",
 
2723
                                                     "feather",
 
2724
                                                     "Feather selection.",
 
2725
                                                     FALSE,
 
2726
                                                     GIMP_PARAM_READWRITE));
 
2727
  gimp_procedure_add_argument (procedure,
 
2728
                               g_param_spec_double ("feather-radius-x",
 
2729
                                                    "feather radius x",
 
2730
                                                    "Feather radius x.",
 
2731
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2732
                                                    GIMP_PARAM_READWRITE));
 
2733
  gimp_procedure_add_argument (procedure,
 
2734
                               g_param_spec_double ("feather-radius-y",
 
2735
                                                    "feather radius y",
 
2736
                                                    "Feather radius y.",
 
2737
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
2738
                                                    GIMP_PARAM_READWRITE));
 
2739
  gimp_pdb_register_procedure (pdb, procedure);
 
2740
  g_object_unref (procedure);
 
2741
 
 
2742
  /*
 
2743
   * gimp-vectors-import-from-file
 
2744
   */
 
2745
  procedure = gimp_procedure_new (vectors_import_from_file_invoker);
 
2746
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2747
                               "gimp-vectors-import-from-file");
 
2748
  gimp_procedure_set_static_strings (procedure,
 
2749
                                     "gimp-vectors-import-from-file",
 
2750
                                     "Import paths from an SVG file.",
 
2751
                                     "This procedure imports paths from an SVG file. SVG elements other than paths and basic shapes are ignored.",
 
2752
                                     "Simon Budig",
 
2753
                                     "Simon Budig",
 
2754
                                     "2006",
 
2755
                                     NULL);
 
2756
  gimp_procedure_add_argument (procedure,
 
2757
                               gimp_param_spec_image_id ("image",
 
2758
                                                         "image",
 
2759
                                                         "The image",
 
2760
                                                         pdb->gimp, FALSE,
 
2761
                                                         GIMP_PARAM_READWRITE));
 
2762
  gimp_procedure_add_argument (procedure,
 
2763
                               gimp_param_spec_string ("filename",
 
2764
                                                       "filename",
 
2765
                                                       "The name of the SVG file to import.",
 
2766
                                                       TRUE, FALSE, TRUE,
 
2767
                                                       NULL,
 
2768
                                                       GIMP_PARAM_READWRITE));
 
2769
  gimp_procedure_add_argument (procedure,
 
2770
                               g_param_spec_boolean ("merge",
 
2771
                                                     "merge",
 
2772
                                                     "Merge paths into a single vectors object.",
 
2773
                                                     FALSE,
 
2774
                                                     GIMP_PARAM_READWRITE));
 
2775
  gimp_procedure_add_argument (procedure,
 
2776
                               g_param_spec_boolean ("scale",
 
2777
                                                     "scale",
 
2778
                                                     "Scale the SVG to image dimensions.",
 
2779
                                                     FALSE,
 
2780
                                                     GIMP_PARAM_READWRITE));
 
2781
  gimp_procedure_add_return_value (procedure,
 
2782
                                   gimp_param_spec_int32 ("num-vectors",
 
2783
                                                          "num vectors",
 
2784
                                                          "The number of newly created vectors",
 
2785
                                                          0, G_MAXINT32, 0,
 
2786
                                                          GIMP_PARAM_READWRITE));
 
2787
  gimp_procedure_add_return_value (procedure,
 
2788
                                   gimp_param_spec_int32_array ("vectors-ids",
 
2789
                                                                "vectors ids",
 
2790
                                                                "The list of newly created vectors",
 
2791
                                                                GIMP_PARAM_READWRITE));
 
2792
  gimp_pdb_register_procedure (pdb, procedure);
 
2793
  g_object_unref (procedure);
 
2794
 
 
2795
  /*
 
2796
   * gimp-vectors-import-from-string
 
2797
   */
 
2798
  procedure = gimp_procedure_new (vectors_import_from_string_invoker);
 
2799
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2800
                               "gimp-vectors-import-from-string");
 
2801
  gimp_procedure_set_static_strings (procedure,
 
2802
                                     "gimp-vectors-import-from-string",
 
2803
                                     "Import paths from an SVG string.",
 
2804
                                     "This procedure works like 'gimp-vectors-import-from-file' but takes a string rather than reading the SVG from a file. This allows you to write scripts that generate SVG and feed it to GIMP.",
 
2805
                                     "Simon Budig",
 
2806
                                     "Simon Budig",
 
2807
                                     "2006",
 
2808
                                     NULL);
 
2809
  gimp_procedure_add_argument (procedure,
 
2810
                               gimp_param_spec_image_id ("image",
 
2811
                                                         "image",
 
2812
                                                         "The image",
 
2813
                                                         pdb->gimp, FALSE,
 
2814
                                                         GIMP_PARAM_READWRITE));
 
2815
  gimp_procedure_add_argument (procedure,
 
2816
                               gimp_param_spec_string ("string",
 
2817
                                                       "string",
 
2818
                                                       "A string that must be a complete and valid SVG document.",
 
2819
                                                       TRUE, FALSE, FALSE,
 
2820
                                                       NULL,
 
2821
                                                       GIMP_PARAM_READWRITE));
 
2822
  gimp_procedure_add_argument (procedure,
 
2823
                               gimp_param_spec_int32 ("length",
 
2824
                                                      "length",
 
2825
                                                      "Number of bytes in string or -1 if the string is NULL terminated.",
 
2826
                                                      G_MININT32, G_MAXINT32, 0,
 
2827
                                                      GIMP_PARAM_READWRITE));
 
2828
  gimp_procedure_add_argument (procedure,
 
2829
                               g_param_spec_boolean ("merge",
 
2830
                                                     "merge",
 
2831
                                                     "Merge paths into a single vectors object.",
 
2832
                                                     FALSE,
 
2833
                                                     GIMP_PARAM_READWRITE));
 
2834
  gimp_procedure_add_argument (procedure,
 
2835
                               g_param_spec_boolean ("scale",
 
2836
                                                     "scale",
 
2837
                                                     "Scale the SVG to image dimensions.",
 
2838
                                                     FALSE,
 
2839
                                                     GIMP_PARAM_READWRITE));
 
2840
  gimp_procedure_add_return_value (procedure,
 
2841
                                   gimp_param_spec_int32 ("num-vectors",
 
2842
                                                          "num vectors",
 
2843
                                                          "The number of newly created vectors",
 
2844
                                                          0, G_MAXINT32, 0,
 
2845
                                                          GIMP_PARAM_READWRITE));
 
2846
  gimp_procedure_add_return_value (procedure,
 
2847
                                   gimp_param_spec_int32_array ("vectors-ids",
 
2848
                                                                "vectors ids",
 
2849
                                                                "The list of newly created vectors",
 
2850
                                                                GIMP_PARAM_READWRITE));
 
2851
  gimp_pdb_register_procedure (pdb, procedure);
 
2852
  g_object_unref (procedure);
 
2853
 
 
2854
  /*
 
2855
   * gimp-vectors-export-to-file
 
2856
   */
 
2857
  procedure = gimp_procedure_new (vectors_export_to_file_invoker);
 
2858
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2859
                               "gimp-vectors-export-to-file");
 
2860
  gimp_procedure_set_static_strings (procedure,
 
2861
                                     "gimp-vectors-export-to-file",
 
2862
                                     "save a path as an SVG file.",
 
2863
                                     "This procedure creates an SVG file to save a Vectors object, that is, a path. The resulting file can be edited using a vector graphics application, or later reloaded into GIMP. If you pass 0 as the 'vectors' argument, then all paths in the image will be exported.",
 
2864
                                     "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
 
2865
                                     "Bill Skaggs",
 
2866
                                     "2007",
 
2867
                                     NULL);
 
2868
  gimp_procedure_add_argument (procedure,
 
2869
                               gimp_param_spec_image_id ("image",
 
2870
                                                         "image",
 
2871
                                                         "The image",
 
2872
                                                         pdb->gimp, FALSE,
 
2873
                                                         GIMP_PARAM_READWRITE));
 
2874
  gimp_procedure_add_argument (procedure,
 
2875
                               gimp_param_spec_string ("filename",
 
2876
                                                       "filename",
 
2877
                                                       "The name of the SVG file to create.",
 
2878
                                                       TRUE, FALSE, TRUE,
 
2879
                                                       NULL,
 
2880
                                                       GIMP_PARAM_READWRITE));
 
2881
  gimp_procedure_add_argument (procedure,
 
2882
                               gimp_param_spec_vectors_id ("vectors",
 
2883
                                                           "vectors",
 
2884
                                                           "The vectors object to be saved, or 0 for all in the image",
 
2885
                                                           pdb->gimp, FALSE,
 
2886
                                                           GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
 
2887
  gimp_pdb_register_procedure (pdb, procedure);
 
2888
  g_object_unref (procedure);
 
2889
 
 
2890
  /*
 
2891
   * gimp-vectors-export-to-string
 
2892
   */
 
2893
  procedure = gimp_procedure_new (vectors_export_to_string_invoker);
 
2894
  gimp_object_set_static_name (GIMP_OBJECT (procedure),
 
2895
                               "gimp-vectors-export-to-string");
 
2896
  gimp_procedure_set_static_strings (procedure,
 
2897
                                     "gimp-vectors-export-to-string",
 
2898
                                     "Save a path as an SVG string.",
 
2899
                                     "This procedure works like 'gimp-vectors-export-to-file' but creates a string rather than a file. The contents are a %NUL-terminated string that holds a complete XML document. If you pass 0 as the 'vectors' argument, then all paths in the image will be exported.",
 
2900
                                     "Bill Skaggs <weskaggs@primate.ucdavis.edu>",
 
2901
                                     "Bill Skaggs",
 
2902
                                     "2007",
 
2903
                                     NULL);
 
2904
  gimp_procedure_add_argument (procedure,
 
2905
                               gimp_param_spec_image_id ("image",
 
2906
                                                         "image",
 
2907
                                                         "The image",
 
2908
                                                         pdb->gimp, FALSE,
 
2909
                                                         GIMP_PARAM_READWRITE));
 
2910
  gimp_procedure_add_argument (procedure,
 
2911
                               gimp_param_spec_vectors_id ("vectors",
 
2912
                                                           "vectors",
 
2913
                                                           "The vectors object to save, or 0 for all in the image",
 
2914
                                                           pdb->gimp, FALSE,
 
2915
                                                           GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
 
2916
  gimp_procedure_add_return_value (procedure,
 
2917
                                   gimp_param_spec_string ("string",
 
2918
                                                           "string",
 
2919
                                                           "A string whose contents are a complete SVG document.",
 
2920
                                                           FALSE, FALSE, FALSE,
 
2921
                                                           NULL,
 
2922
                                                           GIMP_PARAM_READWRITE));
 
2923
  gimp_pdb_register_procedure (pdb, procedure);
 
2924
  g_object_unref (procedure);
 
2925
}