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

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/brush.pdb

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# The GIMP -- an image manipulation program
 
1
# GIMP - The GNU Image Manipulation Program
2
2
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 
4
4
# This program is free software; you can redistribute it and/or modify
17
17
 
18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
19
19
 
20
 
sub mitch_misc {
21
 
    $author = 'Michael Natterer <mitch@gimp.org>';
22
 
    $copyright = 'Michael Natterer';
23
 
    $date = '2004';
24
 
    $since = '2.2';
25
 
}
26
 
 
27
 
sub brush_arg () {{
28
 
    name => 'name',
29
 
    type => 'string',
30
 
    desc => 'The brush name'
31
 
}}
32
 
 
33
 
sub spacing_arg () {{
34
 
    name => 'spacing',
35
 
    type => '0 <= int32 <= 1000',
36
 
    desc => 'The brush spacing: %%desc%%'
37
 
}}
38
 
 
39
 
 
40
 
# The defs
41
 
 
42
20
sub brush_new {
43
21
    $blurb = "Creates a new brush";
44
22
    $help  = "This procedure creates a new, uninitialized brush";
45
23
 
46
 
    &mitch_misc;
 
24
    &mitch_pdb_misc('2004', '2.2');
47
25
 
48
26
    @inargs = (
49
27
        { name => 'name', type => 'string',
51
29
    );
52
30
 
53
31
    @outargs = (
54
 
        { name => 'name', type => 'string',
55
 
          desc => 'The actual new brush name',
56
 
          alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 },
 
32
        { name => 'actual_name', type => 'string',
 
33
          desc => 'The actual new brush name' }
57
34
    );
58
35
 
59
36
    %invoke = (
60
 
        vars => [ 'GimpData *data = NULL'],
61
37
        code => <<'CODE'
62
38
{
63
39
  if (strlen (name))
64
 
    data = gimp_data_factory_data_new (gimp->brush_factory, name);
 
40
    {
 
41
      GimpData *data = gimp_data_factory_data_new (gimp->brush_factory, name);
65
42
 
66
 
  success = (data != NULL);
 
43
      if (data)
 
44
        actual_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (data)));
 
45
      else
 
46
        success = FALSE;
 
47
    }
 
48
  else
 
49
    success = FALSE;
67
50
}
68
51
CODE
69
52
    );
73
56
    $blurb = "Duplicates a brush";
74
57
    $help  = "This procedure creates an identical brush by a different name";
75
58
 
76
 
    &mitch_misc;
 
59
    &mitch_pdb_misc('2004', '2.2');
77
60
 
78
61
    @inargs = (
79
 
        &brush_arg
 
62
        { name => 'name', type => 'string',
 
63
          desc => 'The brush name' }
80
64
    );
81
65
 
82
66
    @outargs = (
83
 
        { name => 'name', type => 'string',
84
 
          desc => "The name of the brush's copy",
85
 
          alias => 'g_strdup (GIMP_OBJECT (brush_copy)->name)',
86
 
          no_declare => 1 }
 
67
        { name => 'copy_name', type => 'string',
 
68
          desc => "The name of the brush's copy" }
87
69
    );
88
70
 
89
71
    %invoke = (
90
 
        vars => [ 'GimpBrush *brush = NULL',
91
 
                  'GimpBrush *brush_copy = NULL' ],
92
72
        code => <<'CODE'
93
73
{
94
 
  brush = (GimpBrush *)
 
74
  GimpBrush *brush = (GimpBrush *)
95
75
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
96
76
 
97
77
  if (brush)
98
78
    {
99
 
      brush_copy = (GimpBrush *)
 
79
      GimpBrush *brush_copy = (GimpBrush *)
100
80
        gimp_data_factory_data_duplicate (gimp->brush_factory,
101
81
                                          GIMP_DATA (brush));
102
82
 
103
 
      success = (brush_copy != NULL);
 
83
      if (brush_copy)
 
84
        copy_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush_copy)));
 
85
      else
 
86
        success = FALSE;
104
87
    }
105
88
  else
106
89
    success = FALSE;
109
92
    );
110
93
}
111
94
 
 
95
sub brush_is_generated {
 
96
    $blurb = "Tests if brush is generated";
 
97
    $help  = "Returns TRUE if this brush is parametric, FALSE for other types";
 
98
 
 
99
    &bill_pdb_misc('2004', '2.4');
 
100
 
 
101
    @inargs = (
 
102
        { name => 'name', type => 'string',
 
103
          desc => 'The brush name' }
 
104
    );
 
105
 
 
106
    @outargs = (
 
107
        { name => 'generated', type => 'boolean',
 
108
          desc => 'TRUE if the brush is generated' }
 
109
    );
 
110
 
 
111
    %invoke = (
 
112
        code => <<'CODE'
 
113
{
 
114
  GimpBrush *brush = (GimpBrush *)
 
115
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
116
 
 
117
  if (brush)
 
118
    generated = GIMP_IS_BRUSH_GENERATED (brush);
 
119
  else
 
120
    success = FALSE;
 
121
}
 
122
CODE
 
123
    );
 
124
}
 
125
 
 
126
sub brush_is_editable {
 
127
    $blurb = "Tests if brush can be edited";
 
128
    $help  = "Returns TRUE if you have permission to change the brush";
 
129
 
 
130
    &bill_pdb_misc('2004', '2.4');
 
131
 
 
132
    @inargs = (
 
133
        { name => 'name', type => 'string',
 
134
          desc => 'The brush name' }
 
135
    );
 
136
 
 
137
    @outargs = (
 
138
        { name => 'editable', type => 'boolean',
 
139
          desc => 'TRUE if the brush can be edited' }
 
140
    );
 
141
 
 
142
    %invoke = (
 
143
        code => <<'CODE'
 
144
{
 
145
  GimpBrush *brush = (GimpBrush *)
 
146
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
147
 
 
148
  if (brush)
 
149
    editable = GIMP_DATA (brush)->writable;
 
150
  else
 
151
    success = FALSE;
 
152
}
 
153
CODE
 
154
    );
 
155
}
 
156
 
112
157
sub brush_rename {
113
158
    $blurb = "Rename a brush";
114
159
    $help  = "This procedure renames a brush";
115
160
 
116
 
    &mitch_misc;
 
161
    &mitch_pdb_misc('2004', '2.2');
117
162
 
118
163
    @inargs = (
119
 
        &brush_arg,
 
164
        { name => 'name', type => 'string',
 
165
          desc => 'The brush name' },
120
166
        { name => 'new_name', type => 'string',
121
 
          desc => "The new name of the brush" }
 
167
          desc => 'The new name of the brush' }
122
168
    );
123
169
 
124
170
    @outargs = (
125
 
        { name => 'name', type => 'string',
126
 
          desc => "The actual new name of the brush",
127
 
          alias => 'g_strdup (GIMP_OBJECT (brush)->name)', no_declare => 1 },
 
171
        { name => 'actual_name', type => 'string',
 
172
          desc => 'The actual new name of the brush' }
128
173
    );
129
174
 
130
175
    %invoke = (
131
 
        vars => [ 'GimpBrush *brush = NULL' ],
132
176
        code => <<'CODE'
133
177
{
134
 
  brush = (GimpBrush *)
 
178
  GimpBrush *brush = (GimpBrush *)
135
179
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
136
180
 
137
 
  if (brush && GIMP_DATA (brush)->writable)
138
 
    gimp_object_set_name (GIMP_OBJECT (brush), new_name);
 
181
  if (brush && GIMP_DATA (brush)->writable && strlen (new_name))
 
182
    {
 
183
      gimp_object_set_name (GIMP_OBJECT (brush), new_name);
 
184
      actual_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
 
185
    }
139
186
  else
140
187
    success = FALSE;
141
188
}
147
194
    $blurb = "Deletes a brush";
148
195
    $help  = "This procedure deletes a brush";
149
196
 
150
 
    &mitch_misc;
 
197
    &mitch_pdb_misc('2004', '2.2');
151
198
 
152
199
    @inargs = (
153
 
        &brush_arg
 
200
        { name => 'name', type => 'string',
 
201
          desc => 'The brush name' }
154
202
    );
155
203
 
156
204
    %invoke = (
157
 
        vars => [ 'GimpBrush *brush = NULL' ],
158
205
        code => <<'CODE'
159
206
{
160
 
  brush = (GimpBrush *)
 
207
  GimpBrush *brush = (GimpBrush *)
161
208
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
162
209
 
163
210
  if (brush && GIMP_DATA (brush)->deletable)
170
217
 
171
218
      if (! success)
172
219
        {
173
 
          g_message (error->message);
 
220
          gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
 
221
                        "%s", error->message);
174
222
          g_clear_error (&error);
175
223
        }
176
224
    }
183
231
 
184
232
sub brush_get_info {
185
233
    $blurb = "Retrieve information about the specified brush.";
 
234
 
186
235
    $help = <<'HELP';
187
236
This procedure retrieves information about the specified brush. This
188
237
includes the brush name, and the brush extents (width and height).
189
238
HELP
190
239
 
191
 
    &mitch_misc;
 
240
    &mitch_pdb_misc('2004', '2.2');
192
241
 
193
242
    @inargs = (
194
 
        &brush_arg
 
243
        { name => 'name', type => 'string',
 
244
          desc => 'The brush name' }
195
245
    );
196
246
 
197
247
    @outargs = (
198
 
        { name => 'width', type => 'int32', no_declare => '1',
199
 
          alias => 'brush->mask->width', void_ret => '1',
200
 
          desc => "The brush width" },
201
 
        { name => 'height', type => 'int32', no_declare => '1',
202
 
          alias => 'brush->mask->height',
203
 
          desc => "The brush height" },
204
 
        { name => 'mask_bpp', type => 'int32', no_declare => '1',
205
 
          alias => 'brush->mask->bytes',
206
 
          desc => "The brush mask bpp" },
207
 
        { name => 'color_bpp', type => 'int32', no_declare => '1',
208
 
          alias => 'brush->pixmap ? brush->pixmap->bytes : 0',
209
 
          desc => "The brush color bpp" }
 
248
        { name => 'width', type => 'int32', void_ret => 1,
 
249
          desc => 'The brush width' },
 
250
        { name => 'height', type => 'int32',
 
251
          desc => 'The brush height' },
 
252
        { name => 'mask_bpp', type => 'int32',
 
253
          desc => 'The brush mask bpp' },
 
254
        { name => 'color_bpp', type => 'int32',
 
255
          desc => 'The brush color bpp' }
210
256
    );
211
257
 
212
258
    %invoke = (
213
 
        vars => [ 'GimpBrush *brush = NULL' ],
214
259
        code => <<'CODE'
215
260
{
216
 
  brush = (GimpBrush *)
 
261
  GimpBrush *brush = (GimpBrush *)
217
262
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
218
263
 
219
 
  success = (brush != NULL);
 
264
  if (brush)
 
265
    {
 
266
      width     = brush->mask->width;
 
267
      height    = brush->mask->height;
 
268
      mask_bpp  = brush->mask->bytes;
 
269
      color_bpp = brush->pixmap ? brush->pixmap->bytes : 0;
 
270
    }
 
271
  else
 
272
    success = FALSE;
220
273
}
221
274
CODE
222
275
    );
223
276
}
224
277
 
225
278
sub brush_get_pixels {
226
 
    $blurb = <<'BLURB';
227
 
Retrieve information about the specified brush.
228
 
BLURB
 
279
    $blurb = 'Retrieve information about the specified brush.';
229
280
 
230
281
    $help = <<'HELP';
231
282
This procedure retrieves information about the specified brush. This
232
283
includes the brush extents (width and height) and its pixels data.
233
284
HELP
234
285
 
235
 
    &mitch_misc;
 
286
    &mitch_pdb_misc('2004', '2.2');
236
287
 
237
288
    @inargs = (
238
 
        &brush_arg
 
289
        { name => 'name', type => 'string',
 
290
          desc => 'The brush name' }
239
291
    );
240
292
 
241
293
    @outargs = (
242
 
        { name => 'width', type => 'int32', no_declare => '1',
243
 
          alias => 'brush->mask->width', void_ret => '1',
244
 
          desc => "The brush width" },
245
 
        { name => 'height', type => 'int32', no_declare => '1',
246
 
          alias => 'brush->mask->height',
247
 
          desc => "The brush height" },
248
 
        { name => 'mask_bpp', type => 'int32', init => '1',
249
 
          desc => "The brush mask bpp" },
250
 
        { name => 'mask_bytes', type => 'int8array', init => '1',
 
294
        { name => 'width', type => 'int32', void_ret => '1',
 
295
          desc => 'The brush width' },
 
296
        { name => 'height', type => 'int32',
 
297
          desc => 'The brush height' },
 
298
        { name => 'mask_bpp', type => 'int32',
 
299
          desc => 'The brush mask bpp' },
 
300
        { name => 'mask_bytes', type => 'int8array',
251
301
          desc => 'The brush mask data',
252
 
          array => { init => '1',
253
 
                     desc => 'Length of brush mask data' } },
254
 
        { name => 'color_bpp', type => 'int32', init => '1',
255
 
          desc => "The brush color bpp" },
256
 
        { name => 'color_bytes', type => 'int8array', init => '1',
 
302
          array => { desc => 'Length of brush mask data' } },
 
303
        { name => 'color_bpp', type => 'int32',
 
304
          desc => 'The brush color bpp' },
 
305
        { name => 'color_bytes', type => 'int8array',
257
306
          desc => 'The brush color data',
258
 
          array => { init => '1',
259
 
                     desc => 'Length of brush color data' } }
 
307
          array => { desc => 'Length of brush color data' } }
260
308
    );
261
309
 
262
310
    %invoke = (
263
 
        vars => [ 'GimpBrush *brush = NULL' ],
264
311
        code => <<'CODE'
265
312
{
266
 
  brush = (GimpBrush *)
 
313
  GimpBrush *brush = (GimpBrush *)
267
314
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
268
315
 
269
316
  if (brush)
270
317
    {
 
318
      width          = brush->mask->width;
 
319
      height         = brush->mask->height;
271
320
      mask_bpp       = brush->mask->bytes;
272
 
      num_mask_bytes = brush->mask->height * brush->mask->width;
 
321
      num_mask_bytes = brush->mask->height * brush->mask->width *
 
322
                       brush->mask->bytes;
273
323
      mask_bytes     = g_memdup (temp_buf_data (brush->mask), num_mask_bytes);
274
324
 
275
325
      if (brush->pixmap)
276
326
        {
277
327
          color_bpp       = brush->pixmap->bytes;
278
 
          num_color_bytes = brush->pixmap->height * brush->pixmap->width;
 
328
          num_color_bytes = brush->pixmap->height * brush->pixmap->width *
 
329
                            brush->pixmap->bytes;
279
330
          color_bytes     = g_memdup (temp_buf_data (brush->pixmap),
280
331
                                      num_color_bytes);
281
332
        }
296
347
percentage of the maximum of the width and height of the mask.
297
348
HELP
298
349
 
299
 
    &mitch_misc;
300
 
 
301
 
    @inargs = (
302
 
        &brush_arg
303
 
    );
304
 
 
305
 
    @outargs = (
306
 
        &spacing_arg
307
 
    );
308
 
    $outargs[0]->{alias} = 'gimp_brush_get_spacing (brush)';
309
 
    $outargs[0]->{no_declare} = 1;
310
 
    $outargs[0]->{void_ret} = 1;
311
 
 
312
 
    %invoke = (
313
 
        vars => [ 'GimpBrush *brush = NULL' ],
314
 
        code => <<'CODE'
315
 
{
316
 
  brush = (GimpBrush *)
317
 
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
318
 
 
319
 
  success = (brush != NULL);
 
350
    &mitch_pdb_misc('2004', '2.2');
 
351
 
 
352
    @inargs = (
 
353
        { name => 'name', type => 'string',
 
354
          desc => 'The brush name' }
 
355
    );
 
356
 
 
357
    @outargs = (
 
358
        { name => 'spacing', type => '0 <= int32 <= 1000',
 
359
          desc => 'The brush spacing',
 
360
          void_ret => 1 }
 
361
    );
 
362
 
 
363
    %invoke = (
 
364
        code => <<'CODE'
 
365
{
 
366
  GimpBrush *brush = (GimpBrush *)
 
367
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
368
 
 
369
  if (brush)
 
370
    spacing = gimp_brush_get_spacing (brush);
 
371
  else
 
372
    success = FALSE;
 
373
}
 
374
CODE
 
375
    );
 
376
}
 
377
 
 
378
sub brush_get_shape {
 
379
    $blurb = 'Get the shape of a generated brush.';
 
380
 
 
381
    $help = <<'HELP';
 
382
This procedure gets the shape value for a generated brush. If
 
383
called for any other type of brush, it does not succeed.  The
 
384
current possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE),
 
385
Square (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
 
386
(GIMP_BRUSH_GENERATED_DIAMOND).  Other shapes are likely to be
 
387
added in the future. 
 
388
HELP
 
389
 
 
390
    &bill_pdb_misc('2004', '2.4');
 
391
 
 
392
    @inargs = (
 
393
        { name => 'name', type => 'string',
 
394
          desc => 'The brush name' }
 
395
    );
 
396
 
 
397
    @outargs = (
 
398
        { name => 'shape', type => 'enum GimpBrushGeneratedShape',
 
399
          desc => 'The brush shape' }
 
400
    );
 
401
 
 
402
    %invoke = (
 
403
        code => <<'CODE'
 
404
{
 
405
  GimpBrush *brush = (GimpBrush *)
 
406
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
407
 
 
408
  if (GIMP_IS_BRUSH_GENERATED (brush))
 
409
    shape = GIMP_BRUSH_GENERATED (brush)->shape;
 
410
  else
 
411
    success = FALSE;
 
412
}
 
413
CODE
 
414
    );
 
415
}
 
416
 
 
417
sub brush_get_radius {
 
418
    $blurb = 'Get the radius of a generated brush.';
 
419
 
 
420
    $help = <<'HELP';
 
421
This procedure gets the radius value for a generated brush. If
 
422
called for any other type of brush, it does not succeed.
 
423
HELP
 
424
 
 
425
    &bill_pdb_misc('2004', '2.4');
 
426
 
 
427
    @inargs = (
 
428
        { name => 'name', type => 'string',
 
429
          desc => 'The brush name' }
 
430
    );
 
431
 
 
432
    @outargs = (
 
433
        { name => 'radius', type => 'float',
 
434
          desc => 'The radius of the brush in pixels' }
 
435
    );
 
436
 
 
437
    %invoke = (
 
438
        code => <<'CODE'
 
439
{
 
440
  GimpBrush *brush = (GimpBrush *)
 
441
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
442
 
 
443
  if (GIMP_IS_BRUSH_GENERATED (brush))
 
444
    radius = GIMP_BRUSH_GENERATED (brush)->radius;
 
445
  else
 
446
    success = FALSE;
 
447
}
 
448
CODE
 
449
    );
 
450
}
 
451
 
 
452
sub brush_get_spikes {
 
453
    $blurb = 'Get the number of spikes for a generated brush.';
 
454
 
 
455
    $help = <<'HELP';
 
456
This procedure gets the number of spikes for a generated brush.  
 
457
If called for any other type of brush, it does not succeed.
 
458
HELP
 
459
 
 
460
    &bill_pdb_misc('2004', '2.4');
 
461
 
 
462
    @inargs = (
 
463
        { name => 'name', type => 'string',
 
464
          desc => 'The brush name' }
 
465
    );
 
466
 
 
467
    @outargs = (
 
468
        { name => 'spikes', type => 'int32',
 
469
          desc => 'The number of spikes on the brush.' }
 
470
    );
 
471
 
 
472
    %invoke = (
 
473
        code => <<'CODE'
 
474
{
 
475
  GimpBrush *brush = (GimpBrush *)
 
476
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
477
 
 
478
  if (GIMP_IS_BRUSH_GENERATED (brush))
 
479
    spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
 
480
  else
 
481
    success = FALSE;
 
482
}
 
483
CODE
 
484
    );
 
485
}
 
486
 
 
487
sub brush_get_hardness {
 
488
    $blurb = 'Get the hardness of a generated brush.';
 
489
 
 
490
    $help = <<'HELP';
 
491
This procedure gets the hardness of a generated brush. The
 
492
hardness of a brush is the amount its intensity fades at the
 
493
outside edge. If called for any other type of brush, the function
 
494
does not succeed.
 
495
HELP
 
496
 
 
497
    &bill_pdb_misc('2004', '2.4');
 
498
 
 
499
    @inargs = (
 
500
        { name => 'name', type => 'string',
 
501
          desc => 'The brush name' }
 
502
    );
 
503
 
 
504
    @outargs = (
 
505
        { name => 'hardness', type => 'float',
 
506
          desc => 'The hardness of the brush.' }
 
507
    );
 
508
 
 
509
    %invoke = (
 
510
        code => <<'CODE'
 
511
{
 
512
  GimpBrush *brush = (GimpBrush *)
 
513
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
514
 
 
515
  if (GIMP_IS_BRUSH_GENERATED (brush))
 
516
    hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
 
517
  else
 
518
    success = FALSE;
 
519
}
 
520
CODE
 
521
    );
 
522
}
 
523
 
 
524
sub brush_get_aspect_ratio {
 
525
    $blurb = 'Get the aspect ratio of a generated brush.';
 
526
 
 
527
    $help = <<'HELP';
 
528
This procedure gets the aspect ratio of a generated brush. 
 
529
If called for any other type of brush, it does not succeed.
 
530
HELP
 
531
 
 
532
    &bill_pdb_misc('2004', '2.4');
 
533
 
 
534
    @inargs = (
 
535
        { name => 'name', type => 'string',
 
536
          desc => 'The brush name' }
 
537
    );
 
538
 
 
539
    @outargs = (
 
540
        { name => 'aspect_ratio', type => 'float',
 
541
          desc => 'The aspect ratio of the brush.' }
 
542
    );
 
543
 
 
544
    %invoke = (
 
545
        code => <<'CODE'
 
546
{
 
547
  GimpBrush *brush = (GimpBrush *)
 
548
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
549
 
 
550
  if (GIMP_IS_BRUSH_GENERATED (brush))
 
551
    aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
 
552
  else
 
553
    success = FALSE;
 
554
}
 
555
CODE
 
556
    );
 
557
}
 
558
 
 
559
sub brush_get_angle {
 
560
    $blurb = 'Get the rotation angle of a generated brush.';
 
561
 
 
562
    $help = <<'HELP';
 
563
This procedure gets the angle of rotation for a generated brush. 
 
564
If called for any other type of brush, it does not succeed.
 
565
HELP
 
566
 
 
567
    &bill_pdb_misc('2004', '2.4');
 
568
 
 
569
    @inargs = (
 
570
        { name => 'name', type => 'string',
 
571
          desc => 'The brush name' }
 
572
    );
 
573
 
 
574
    @outargs = (
 
575
        { name => 'angle', type => 'float',
 
576
          desc => 'The rotation angle of the brush.' }
 
577
    );
 
578
 
 
579
    %invoke = (
 
580
        code => <<'CODE'
 
581
{
 
582
  GimpBrush *brush = (GimpBrush *)
 
583
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
584
 
 
585
  if (GIMP_IS_BRUSH_GENERATED (brush))
 
586
    angle = GIMP_BRUSH_GENERATED (brush)->angle;
 
587
  else
 
588
    success = FALSE;
320
589
}
321
590
CODE
322
591
    );
330
599
The value should be a integer between 0 and 1000.
331
600
HELP
332
601
 
333
 
    &mitch_misc;
 
602
    &bill_pdb_misc('2004', '2.4');
334
603
 
335
604
    @inargs = (
336
 
        &brush_arg,
337
 
        &spacing_arg
 
605
        { name => 'name', type => 'string',
 
606
          desc => 'The brush name' },
 
607
        { name => 'spacing', type => '0 <= int32 <= 1000',
 
608
          desc => 'The brush spacing' }
338
609
    );
339
610
 
340
611
    %invoke = (
341
 
        vars => [ 'GimpBrush *brush = NULL' ],
342
612
        code => <<'CODE'
343
613
{
344
 
  brush = (GimpBrush *)
 
614
  GimpBrush *brush = (GimpBrush *)
345
615
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
346
616
 
347
617
  if (brush)
353
623
    );
354
624
}
355
625
 
 
626
sub brush_set_shape {
 
627
    $blurb = 'Set the shape of a generated brush.';
 
628
 
 
629
    $help = <<'HELP';
 
630
This procedure sets the shape value for a generated brush. If
 
631
called for any other type of brush, it does not succeed. The
 
632
current possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE),
 
633
Square (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
 
634
(GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be
 
635
added in the future. 
 
636
HELP
 
637
 
 
638
    &bill_pdb_misc('2004', '2.4');
 
639
 
 
640
    @inargs = (
 
641
        { name => 'name', type => 'string',
 
642
          desc => 'The brush name' },
 
643
        { name => 'shape_in', type => 'enum GimpBrushGeneratedShape',
 
644
          desc => 'The brush shape' }
 
645
    );
 
646
 
 
647
    @outargs = (
 
648
        { name => 'shape_out', type => 'enum GimpBrushGeneratedShape',
 
649
          desc => 'The brush shape actually assigned' }
 
650
    );
 
651
 
 
652
    %invoke = (
 
653
        code => <<'CODE'
 
654
{
 
655
  GimpBrush *brush = (GimpBrush *)
 
656
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
657
 
 
658
  if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
 
659
    {
 
660
      gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush),
 
661
                                      shape_in);
 
662
      shape_out = GIMP_BRUSH_GENERATED (brush)->shape;
 
663
    }
 
664
  else
 
665
    success = FALSE;
 
666
}
 
667
CODE
 
668
    );
 
669
}
 
670
 
 
671
sub brush_set_radius {
 
672
    $blurb = 'Set the radius of a generated brush.';
 
673
 
 
674
    $help = <<'HELP';
 
675
This procedure sets the radius for a generated brush. If
 
676
called for any other type of brush, it does not succeed.
 
677
HELP
 
678
 
 
679
    &bill_pdb_misc('2004', '2.4');
 
680
 
 
681
    @inargs = (
 
682
        { name => 'name', type => 'string',
 
683
          desc => 'The brush name' },
 
684
        { name => 'radius_in', type => 'float',
 
685
          desc => 'The desired brush radius' }
 
686
    );
 
687
 
 
688
    @outargs = (
 
689
        { name => 'radius_out', type => 'float',
 
690
          desc => 'The brush radius actually assigned' }
 
691
    );
 
692
 
 
693
    %invoke = (
 
694
        code => <<'CODE'
 
695
{
 
696
  GimpBrush *brush = (GimpBrush *)
 
697
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
698
 
 
699
  if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
 
700
    {
 
701
      gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush),
 
702
                                       radius_in);
 
703
      radius_out = GIMP_BRUSH_GENERATED (brush)->radius;
 
704
    }
 
705
  else
 
706
    success = FALSE;
 
707
}
 
708
CODE
 
709
    );
 
710
}
 
711
 
 
712
sub brush_set_spikes {
 
713
    $blurb = 'Set the number of spikes for a generated brush.';
 
714
 
 
715
    $help = <<'HELP';
 
716
This procedure sets the number of spikes for a generated brush. If
 
717
called for any other type of brush, it does not succeed.
 
718
HELP
 
719
 
 
720
    &bill_pdb_misc('2004', '2.4');
 
721
 
 
722
    @inargs = (
 
723
        { name => 'name', type => 'string',
 
724
          desc => 'The brush name' },
 
725
        { name => 'spikes_in', type => 'int32',
 
726
          desc => 'The desired number of spikes' }
 
727
    );
 
728
 
 
729
    @outargs = (
 
730
        { name => 'spikes_out', type => 'int32',
 
731
          desc => 'The number of spikes actually assigned' }
 
732
    );
 
733
 
 
734
    %invoke = (
 
735
        code => <<'CODE'
 
736
{
 
737
  GimpBrush *brush = (GimpBrush *)
 
738
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
739
 
 
740
  if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
 
741
    {
 
742
      gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush),
 
743
                                       spikes_in);
 
744
      spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes;
 
745
    }
 
746
  else
 
747
    success = FALSE;
 
748
}
 
749
CODE
 
750
    );
 
751
}
 
752
 
 
753
sub brush_set_hardness {
 
754
    $blurb = 'Set the hardness of a generated brush.';
 
755
 
 
756
    $help = <<'HELP';
 
757
This procedure sets the hardness for a generated brush. If
 
758
called for any other type of brush, it does not succeed.
 
759
HELP
 
760
 
 
761
    &bill_pdb_misc('2004', '2.4');
 
762
 
 
763
    @inargs = (
 
764
        { name => 'name', type => 'string',
 
765
          desc => 'The brush name' },
 
766
        { name => 'hardness_in', type => 'float',
 
767
          desc => 'The desired brush hardness' }
 
768
    );
 
769
 
 
770
    @outargs = (
 
771
        { name => 'hardness_out', type => 'float',
 
772
          desc => 'The brush hardness actually assigned' }
 
773
    );
 
774
 
 
775
    %invoke = (
 
776
        code => <<'CODE'
 
777
{
 
778
  GimpBrush *brush = (GimpBrush *)
 
779
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
780
 
 
781
  if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
 
782
    {
 
783
      gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush),
 
784
                                         hardness_in);
 
785
      hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness;
 
786
    }
 
787
  else
 
788
    success = FALSE;
 
789
}
 
790
CODE
 
791
    );
 
792
}
 
793
 
 
794
sub brush_set_aspect_ratio {
 
795
    $blurb = 'Set the aspect ratio of a generated brush.';
 
796
 
 
797
    $help = <<'HELP';
 
798
This procedure sets the aspect ratio for a generated brush. If
 
799
called for any other type of brush, it does not succeed.
 
800
HELP
 
801
 
 
802
    &bill_pdb_misc('2004', '2.4');
 
803
 
 
804
    @inargs = (
 
805
        { name => 'name', type => 'string',
 
806
          desc => 'The brush name' },
 
807
        { name => 'aspect_ratio_in', type => 'float',
 
808
          desc => 'The desired brush aspect ratio' }
 
809
    );
 
810
 
 
811
    @outargs = (
 
812
        { name => 'aspect_ratio_out', type => 'float',
 
813
          desc => 'The brush aspect ratio actually assigned' }
 
814
    );
 
815
 
 
816
    %invoke = (
 
817
        code => <<'CODE'
 
818
{
 
819
  GimpBrush *brush = (GimpBrush *)
 
820
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
821
 
 
822
  if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
 
823
    {
 
824
      gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush),
 
825
                                             aspect_ratio_in);
 
826
      aspect_ratio_out = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
 
827
    }
 
828
  else
 
829
    success = FALSE;
 
830
}
 
831
CODE
 
832
    );
 
833
}
 
834
 
 
835
sub brush_set_angle {
 
836
    $blurb = 'Set the rotation angle of a generated brush.';
 
837
 
 
838
    $help = <<'HELP';
 
839
This procedure sets the rotation angle for a generated brush. If
 
840
called for any other type of brush, it does not succeed.
 
841
HELP
 
842
 
 
843
    &bill_pdb_misc('2004', '2.4');
 
844
 
 
845
    @inargs = (
 
846
        { name => 'name', type => 'string',
 
847
          desc => 'The brush name' },
 
848
        { name => 'angle_in', type => 'float',
 
849
          desc => 'The desired brush rotation angle' }
 
850
    );
 
851
 
 
852
    @outargs = (
 
853
        { name => 'angle_out', type => 'float',
 
854
          desc => 'The brush rotation angle actually assigned' }
 
855
    );
 
856
 
 
857
    %invoke = (
 
858
        code => <<'CODE'
 
859
{
 
860
  GimpBrush *brush = (GimpBrush *)
 
861
    gimp_container_get_child_by_name (gimp->brush_factory->container, name);
 
862
 
 
863
  if (GIMP_IS_BRUSH_GENERATED (brush) && GIMP_DATA (brush)->writable)
 
864
    {
 
865
      gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush),
 
866
                                      angle_in);
 
867
      angle_out = GIMP_BRUSH_GENERATED (brush)->angle;
 
868
    }
 
869
  else
 
870
    success = FALSE;
 
871
}
 
872
CODE
 
873
    );
 
874
}
 
875
 
356
876
 
357
877
@headers = qw(<string.h> "base/temp-buf.h"
358
878
              "core/gimp.h" "core/gimplist.h" "core/gimpbrush.h"
359
 
              "core/gimpcontext.h" "core/gimpdatafactory.h");
 
879
              "core/gimpbrushgenerated.h" "core/gimpcontext.h" 
 
880
              "core/gimpdatafactory.h");
360
881
 
361
 
@procs = qw(brush_new brush_duplicate brush_rename brush_delete
 
882
@procs = qw(brush_new brush_duplicate brush_is_generated 
 
883
            brush_rename brush_delete brush_is_editable
362
884
            brush_get_info brush_get_pixels
363
 
            brush_get_spacing brush_set_spacing);
 
885
            brush_get_spacing brush_set_spacing
 
886
            brush_get_shape brush_get_radius
 
887
            brush_get_spikes brush_get_hardness
 
888
            brush_get_aspect_ratio brush_get_angle
 
889
            brush_set_shape brush_set_radius
 
890
            brush_set_spikes brush_set_hardness
 
891
            brush_set_aspect_ratio brush_set_angle);
 
892
 
364
893
%exports = (app => [@procs], lib => [@procs]);
365
894
 
366
895
$desc = 'Brush';