18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
23
desc => 'The brush name',
29
foreach (qw(width height)) {
30
push @args, { name => $_, type => 'int32', desc => "The brush $_" };
37
type => '0 <= float <= 100',
38
desc => 'The brush opacity: %%desc%%'
43
type => '0 <= int32 <= 1000',
44
desc => 'The brush spacing: %%desc%%'
47
sub paint_mode_arg () {{
48
name => 'paint_mode', type => 'enum GimpLayerModeEffects',
49
desc => 'The paint mode: { %%desc%% }'
54
my $alias = ($_->{type} eq 'string') ?
55
"GIMP_OBJECT (brush)->$_->{name}" : "brush->$_->{name}";
56
$alias = "g_strdup ($alias)" if $_->{type} eq 'string';
57
$alias =~ s/brush/brush->mask/ if $_->{name} =~ /width|height/;
63
my $get_brush_from_name = <<'CODE';
64
if (name && strlen (name))
67
gimp_container_get_child_by_name (gimp->brush_factory->container,
72
brush = gimp_context_get_brush (context);
79
20
sub brushes_refresh {
80
21
$blurb = 'Refresh current brushes. This function always succeeds.';
117
56
{ name => 'brush_list', type => 'stringarray',
118
57
desc => 'The list of brush names',
119
58
array => { name => 'num_brushes',
120
desc => 'The number of brushes in the brush list' },
59
desc => 'The number of brushes in the brush list' } }
125
63
headers => [ qw("core/gimpcontainer-filter.h") ],
126
code => 'brush_list = gimp_container_get_filtered_name_array (gimp->brush_factory->container, filter, &num_brushes);'
66
brush_list = gimp_container_get_filtered_name_array (gimp->brush_factory->container,
67
filter, &num_brushes);
130
73
sub brushes_get_brush {
131
&std_pdb_deprecated ('gimp_context_get_brush');
74
&std_pdb_deprecated ('gimp-context-get-brush');
77
{ name => 'name', type => 'string',
78
desc => 'The brush name' },
79
{ name => 'width', type => 'int32',
80
desc => 'The brush width' },
81
{ name => 'height', type => 'int32',
82
desc => 'The brush height' },
83
{ name => 'spacing', type => '0 <= int32 <= 1000',
84
desc => 'The brush spacing' }
142
vars => [ 'GimpBrush *brush' ],
143
code => 'success = (brush = gimp_context_get_brush (context)) != NULL;'
90
GimpBrush *brush = gimp_context_get_brush (context);
94
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
95
width = brush->mask->width;
96
height = brush->mask->height;
97
spacing = gimp_brush_get_spacing (brush);
147
106
sub brushes_get_spacing {
148
&std_pdb_deprecated ('gimp_brush_get_spacing');
150
@outargs = ( &spacing_arg );
151
$outargs[0]->{alias} = 'gimp_brush_get_spacing (gimp_context_get_brush (context))';
152
$outargs[0]->{no_declare} = 1;
107
&std_pdb_deprecated ('gimp-brush-get-spacing');
110
{ name => 'spacing', type => '0 <= int32 <= 1000',
111
desc => 'The brush spacing' }
117
GimpBrush *brush = gimp_context_get_brush (context);
120
spacing = gimp_brush_get_spacing (brush);
155
128
sub brushes_set_spacing {
156
&std_pdb_deprecated ('gimp_brush_set_spacing');
129
&std_pdb_deprecated ('gimp-brush-set-spacing');
158
@inargs = ( &spacing_arg );
132
{ name => 'spacing', type => '0 <= int32 <= 1000',
133
desc => 'The brush spacing' }
161
code => 'gimp_brush_set_spacing (gimp_context_get_brush (context), spacing);'
139
gimp_brush_set_spacing (gimp_context_get_brush (context), spacing);
165
145
sub brushes_get_brush_data {
166
&std_pdb_deprecated ('gimp_brush_get_pixels');
146
&std_pdb_deprecated ('gimp-brush-get-pixels');
149
{ name => 'name', type => 'string',
150
desc => 'The brush name ("" means current active brush)',
171
$inargs[0]->{desc} = 'The brush name ("" means current active brush)';
155
{ name => 'actual_name', type => 'string',
156
desc => 'The brush name' },
157
{ name => 'opacity', type => '0 <= float <= 100',
158
desc => 'The brush opacity' },
159
{ name => 'spacing', type => '0 <= int32 <= 1000',
160
desc => 'The brush spacing' },
161
{ name => 'paint_mode', type => 'enum GimpLayerModeEffects',
162
desc => 'The paint mode' },
163
{ name => 'width', type => 'int32',
164
desc => 'The brush width' },
165
{ name => 'height', type => 'int32',
166
desc => 'The brush height' },
167
{ name => 'mask_data', type => 'int8array',
168
desc => 'The brush mask data',
169
array => { name => 'length',
170
desc => 'Length of brush mask data' } }
183
$outargs[1]->{alias} = '1.0';
184
$outargs[3]->{alias} = '0';
186
push @outargs, { name => 'mask_data', type => 'int8array', init => 1,
187
desc => 'The brush mask data',
188
array => { name => 'length', init => 1,
189
desc => 'Length of brush mask data' } };
192
vars => [ 'GimpBrush *brush = NULL' ],
195
178
if (name && strlen (name))
197
180
brush = (GimpBrush *)