18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
24
sub drawable_arg () {{
27
desc => 'The affected drawable',
30
sub drawable_out_arg {
32
my $arg = &drawable_arg;
33
$arg->{desc} = "The $type drawable";
34
$arg->{no_declare} = 1;
38
sub sample_merged_arg () {{
39
name => 'sample_merged',
41
desc => 'Use the composite image, not the drawable'
44
sub operation_arg () {{
46
type => 'enum GimpChannelOps',
47
desc => 'The selection operation: { %%desc%% }'
50
sub threshold_arg () {{
52
type => '0 <= int32 <= 255',
53
desc => 'Threshold in intensity levels %%desc%%'
56
sub feather_select_args () {(
57
{ name => 'feather', type => 'boolean',
58
desc => 'Feather option for selections' },
59
{ name => 'feather_radius', type => 'float',
60
desc => 'Radius for feather operation' }
66
20
sub by_color_select {
67
21
$blurb = <<'BLURB';
68
22
Create a selection by selecting all pixels (in the specified drawable) with the
43
{ name => 'drawable', type => 'drawable',
44
desc => 'The affected drawable' },
90
45
{ name => 'color', type => 'color',
91
46
desc => 'The color to select' },
47
{ name => 'threshold', type => '0 <= int32 <= 255',
48
desc => 'Threshold in intensity levels' },
49
{ name => 'operation', type => 'enum GimpChannelOps',
50
desc => 'The selection operation' },
51
{ name => 'antialias', type => 'boolean',
52
desc => 'Antialiasing' },
53
{ name => 'feather', type => 'boolean',
54
desc => 'Feather option for selections' },
55
{ name => 'feather_radius', type => '0 <= float',
56
desc => 'Radius for feather operation' },
57
{ name => 'sample_merged', type => 'boolean',
58
desc => 'Use the composite image, not the drawable' }
100
vars => [ 'GimpImage *gimage' ],
103
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
64
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
105
gimp_channel_select_by_color (gimp_image_get_mask (gimage), drawable,
66
gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
109
70
FALSE /* don't select transparent */,
71
GIMP_SELECT_CRITERION_COMPOSITE,
83
sub by_color_select_full {
85
Create a selection by selecting all pixels (in the specified drawable) with the
86
same (or similar) color to that specified.
90
This tool creates a selection over the specified image. A by-color selection is
91
determined by the supplied color under the constraints of the specified
92
threshold. Essentially, all pixels (in the drawable) that have color
93
sufficiently close to the specified color (as determined by the threshold
94
value) are included in the selection. To select transparent regions, the color
95
specified must also have minimum alpha. The antialiasing parameter allows the
96
final selection mask to contain intermediate values based on close misses to
97
the threshold bar. Feathering can be enabled optionally and is controlled with
98
the 'feather-radius' parameter. If the 'sample-merged' parameter is TRUE, the data
99
of the composite image will be used instead of that for the specified drawable.
100
This is equivalent to sampling for colors after merging all visible layers.
101
In the case of a merged sampling, the supplied drawable is ignored.
104
&david_pdb_misc('2006','2.4');
107
{ name => 'drawable', type => 'drawable',
108
desc => 'The affected drawable' },
109
{ name => 'color', type => 'color',
110
desc => 'The color to select' },
111
{ name => 'threshold', type => '0 <= int32 <= 255',
112
desc => 'Threshold in intensity levels' },
113
{ name => 'operation', type => 'enum GimpChannelOps',
114
desc => 'The selection operation' },
115
{ name => 'antialias', type => 'boolean',
116
desc => 'Antialiasing' },
117
{ name => 'feather', type => 'boolean',
118
desc => 'Feather option for selections' },
119
{ name => 'feather_radius_x', type => '0 <= float',
120
desc => 'Radius for feather operation in X direction' },
121
{ name => 'feather_radius_y', type => '0 <= float',
122
desc => 'Radius for feather operation in Y direction' },
123
{ name => 'sample_merged', type => 'boolean',
124
desc => 'Use the composite image, not the drawable' },
125
{ name => 'select_transparent', type => 'boolean',
126
desc => "Whether to consider transparent pixels for selection.
127
If TRUE, transparency is considered as a unique selectable
129
{ name => 'select_criterion', type => 'enum GimpSelectCriterion',
130
desc => "The criterion used to determine color similarity.
131
SELECT_CRITERION_COMPOSITE is the standard choice.
138
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
140
gimp_channel_select_by_color (gimp_image_get_mask (image), drawable,
120
157
sub ellipse_select {
121
158
$blurb = 'Create an elliptical selection over the specified image.';
174
{ name => 'image', type => 'image',
175
desc => 'The image' },
138
176
{ name => 'x', type => 'float',
139
177
desc => 'x coordinate of upper-left corner of ellipse bounding box' },
140
178
{ name => 'y', type => 'float',
141
179
desc => 'y coordinate of upper-left corner of ellipse bounding box' },
142
180
{ name => 'width', type => '0 < float',
143
desc => 'The width of the ellipse: %%desc%%' },
181
desc => 'The width of the ellipse' },
144
182
{ name => 'height', type => '0 < float',
145
desc => 'The height of the ellipse: %%desc%%' },
183
desc => 'The height of the ellipse' },
184
{ name => 'operation', type => 'enum GimpChannelOps',
185
desc => 'The selection operation' },
186
{ name => 'antialias', type => 'boolean',
187
desc => 'Antialiasing' },
188
{ name => 'feather', type => 'boolean',
189
desc => 'Feather option for selections' },
190
{ name => 'feather_radius', type => '0 <= float',
191
desc => 'Radius for feather operation' }
153
gimp_channel_select_ellipse (gimp_image_get_mask (gimage),
155
(gint) width, (gint) height,
197
gimp_channel_select_ellipse (gimp_image_get_mask (image),
199
(gint) width, (gint) height,
165
212
sub free_select {
166
213
$blurb = 'Create a polygonal selection over the specified image.';
230
{ name => 'image', type => 'image',
231
desc => 'The image' },
184
232
{ name => 'segs', type => 'floatarray',
185
233
desc => 'Array of points: { p1.x, p1.y, p2.x, p2.y, ...,
187
array => { type => '2 <= int32', on_success => 'num_segs /= 2;',
235
array => { type => '2 <= int32',
188
236
desc => 'Number of points (count 1 coordinate as two
238
{ name => 'operation', type => 'enum GimpChannelOps',
239
desc => 'The selection operation' },
240
{ name => 'antialias', type => 'boolean',
241
desc => 'Antialiasing' },
242
{ name => 'feather', type => 'boolean',
243
desc => 'Feather option for selections' },
244
{ name => 'feather_radius', type => '0 <= float',
245
desc => 'Radius for feather operation' }
197
gimp_channel_select_polygon (gimp_image_get_mask (gimage),
200
(GimpVector2 *) segs,
251
gimp_channel_select_polygon (gimp_image_get_mask (image),
254
(GimpVector2 *) segs,
210
267
sub fuzzy_select {
211
268
$blurb = <<'BLURB';
212
269
Create a fuzzy selection starting at the specified coordinates on the specified
294
{ name => 'drawable', type => 'drawable',
295
desc => 'The affected drawable' },
238
296
{ name => 'x', type => 'float',
239
297
desc => 'x coordinate of initial seed fill point: (image
241
299
{ name => 'y', type => 'float',
242
300
desc => 'y coordinate of initial seed fill point: (image
247
&feather_select_args,
302
{ name => 'threshold', type => '0 <= int32 <= 255',
303
desc => 'Threshold in intensity levels' },
304
{ name => 'operation', type => 'enum GimpChannelOps',
305
desc => 'The selection operation' },
306
{ name => 'antialias', type => 'boolean',
307
desc => 'Antialiasing' },
308
{ name => 'feather', type => 'boolean',
309
desc => 'Feather option for selections' },
310
{ name => 'feather_radius', type => '0 <= float',
311
desc => 'Radius for feather operation' },
312
{ name => 'sample_merged', type => 'boolean',
313
desc => 'Use the composite image, not the drawable' }
252
vars => [ 'GimpImage *gimage' ],
255
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
319
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
257
gimp_channel_select_fuzzy (gimp_image_get_mask (gimage),
321
gimp_channel_select_fuzzy (gimp_image_get_mask (image),
262
326
FALSE /* don't select transparent */,
327
GIMP_SELECT_CRITERION_COMPOSITE,
339
sub fuzzy_select_full {
341
Create a fuzzy selection starting at the specified coordinates on the specified
346
This tool creates a fuzzy selection over the specified image. A fuzzy selection
347
is determined by a seed fill under the constraints of the specified threshold.
348
Essentially, the color at the specified coordinates (in the drawable) is
349
measured and the selection expands outwards from that point to any adjacent
350
pixels which are not significantly different (as determined by the threshold
351
value). This process continues until no more expansion is possible. The
352
antialiasing parameter allows the final selection mask to contain intermediate
353
values based on close misses to the threshold bar at pixels along the seed fill
354
boundary. Feathering can be enabled optionally and is controlled with the
355
'feather-radius' paramter. If the 'sample-merged' parameter is TRUE, the data
356
of the composite image will be used instead of that for the specified drawable.
357
This is equivalent to sampling for colors after merging all visible layers. In
358
the case of a merged sampling, the supplied drawable is ignored. If the sample
359
is merged, the specified coordinates are relative to the image origin;
360
otherwise, they are relative to the drawable's origin.
363
&david_pdb_misc("2006","2.4");
366
{ name => 'drawable', type => 'drawable',
367
desc => 'The affected drawable' },
368
{ name => 'x', type => 'float',
369
desc => 'x coordinate of initial seed fill point: (image
371
{ name => 'y', type => 'float',
372
desc => 'y coordinate of initial seed fill point: (image
374
{ name => 'threshold', type => '0 <= int32 <= 255',
375
desc => 'Threshold in intensity levels' },
376
{ name => 'operation', type => 'enum GimpChannelOps',
377
desc => 'The selection operation' },
378
{ name => 'antialias', type => 'boolean',
379
desc => 'Antialiasing' },
380
{ name => 'feather', type => 'boolean',
381
desc => 'Feather option for selections' },
382
{ name => 'feather_radius_x', type => '0 <= float',
383
desc => 'Radius for feather operation in X direction' },
384
{ name => 'feather_radius_y', type => '0 <= float',
385
desc => 'Radius for feather operation in Y direction' },
386
{ name => 'sample_merged', type => 'boolean',
387
desc => 'Use the composite image, not the drawable' },
388
{ name => 'select_transparent', type => 'boolean',
389
desc => "Whether to consider transparent pixels for selection.
390
If TRUE, transparency is considered as a unique selectable
392
{ name => 'select_criterion', type => 'enum GimpSelectCriterion',
393
desc => "The criterion used to determine color similarity.
394
SELECT_CRITERION_COMPOSITE is the standard choice.
401
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
403
gimp_channel_select_fuzzy (gimp_image_get_mask (image),
273
421
sub rect_select {
274
422
$blurb = 'Create a rectangular selection over the specified image;';
288
{ name => 'x', type => 'float',
289
desc => 'x coordinate of upper-left corner of rectangle' },
290
{ name => 'y', type => 'float',
291
desc => 'y coordinate of upper-left corner of rectangle' },
292
{ name => 'width', type => '0 < float',
293
desc => 'The width of the rectangle: %%desc%%' },
294
{ name => 'height', type => '0 < float',
295
desc => 'The height of the rectangle: %%desc%%' },
297
&feather_select_args,
302
gimp_channel_select_rectangle (gimp_image_get_mask (gimage),
304
(gint) width, (gint) height,
435
{ name => 'image', type => 'image',
436
desc => 'The image' },
437
{ name => 'x', type => 'float',
438
desc => 'x coordinate of upper-left corner of rectangle' },
439
{ name => 'y', type => 'float',
440
desc => 'y coordinate of upper-left corner of rectangle' },
441
{ name => 'width', type => '0 < float',
442
desc => 'The width of the rectangle' },
443
{ name => 'height', type => '0 < float',
444
desc => 'The height of the rectangle' },
445
{ name => 'operation', type => 'enum GimpChannelOps',
446
desc => 'The selection operation' },
447
{ name => 'feather', type => 'boolean',
448
desc => 'Feather option for selections' },
449
{ name => 'feather_radius', type => '0 <= float',
450
desc => 'Radius for feather operation' }
456
gimp_channel_select_rectangle (gimp_image_get_mask (image),
458
(gint) width, (gint) height,
470
sub round_rect_select {
471
$blurb = 'Create a rectangular selection with round corners over the specified image;';
474
This tool creates a rectangular selection with round corners over the
475
specified image. The rectangular region can be either added to,
476
subtracted from, or replace the contents of the previous selection
477
mask. If the feather option is enabled, the resulting selection is
478
blurred before combining. The blur is a gaussian blur with the
479
specified feather radius.
482
&martin_pdb_misc("2006","2.4");
485
{ name => 'image', type => 'image',
486
desc => 'The image' },
487
{ name => 'x', type => 'float',
488
desc => 'x coordinate of upper-left corner of rectangle' },
489
{ name => 'y', type => 'float',
490
desc => 'y coordinate of upper-left corner of rectangle' },
491
{ name => 'width', type => '0 < float',
492
desc => 'The width of the rectangle' },
493
{ name => 'height', type => '0 < float',
494
desc => 'The height of the rectangle' },
495
{ name => 'corner_radius_x', type => '0 < float < GIMP_MAX_IMAGE_SIZE',
496
desc => 'The corner radius in X direction' },
497
{ name => 'corner_radius_y', type => '0 < float < GIMP_MAX_IMAGE_SIZE',
498
desc => 'The corner radius in Y direction' },
499
{ name => 'operation', type => 'enum GimpChannelOps',
500
desc => 'The selection operation' },
501
{ name => 'antialias', type => 'boolean',
502
desc => 'Antialiasing' },
503
{ name => 'feather', type => 'boolean',
504
desc => 'Feather option for selections' },
505
{ name => 'feather_radius_x', type => '0 <= float',
506
desc => 'Radius for feather operation in X direction' },
507
{ name => 'feather_radius_y', type => '0 <= float',
508
desc => 'Radius for feather operation in Y direction' }
514
gimp_channel_select_round_rect (gimp_image_get_mask (image),
516
(gint) width, (gint) height,
313
531
@headers = qw("core/gimpchannel-select.h" "gimp-intl.h");
315
@procs = qw(by_color_select ellipse_select free_select fuzzy_select
533
@procs = qw(by_color_select by_color_select_full
536
fuzzy_select fuzzy_select_full
537
rect_select round_rect_select);
317
539
%exports = (app => [@procs], lib => [@procs]);
319
541
$desc = 'Selection Tool procedures';