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

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/brushes.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 brush_arg () {{
21
 
    name => 'name',
22
 
    type => 'string',
23
 
    desc => 'The brush name',
24
 
    null_ok => '1'
25
 
}}
26
 
 
27
 
sub dim_args () {
28
 
    my @args;
29
 
    foreach (qw(width height)) {
30
 
        push @args, { name => $_, type => 'int32', desc => "The brush $_" };
31
 
    }
32
 
    @args;
33
 
}
34
 
 
35
 
sub opacity_arg () {{
36
 
    name => 'opacity',
37
 
    type => '0 <= float <= 100',
38
 
    desc => 'The brush opacity: %%desc%%'
39
 
}}
40
 
 
41
 
sub spacing_arg () {{
42
 
    name => 'spacing',
43
 
    type => '0 <= int32 <= 1000',
44
 
    desc => 'The brush spacing: %%desc%%'
45
 
}}
46
 
 
47
 
sub paint_mode_arg () {{
48
 
    name => 'paint_mode', type => 'enum GimpLayerModeEffects',
49
 
    desc => 'The paint mode: { %%desc%% }'
50
 
}}
51
 
 
52
 
sub brush_outargs {
53
 
    foreach (@outargs) {
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/;
58
 
        $_->{alias} = $alias;
59
 
        $_->{no_declare} = 1;
60
 
    }
61
 
}
62
 
 
63
 
my $get_brush_from_name = <<'CODE';
64
 
if (name && strlen (name))
65
 
  {
66
 
    brush = (GimpBrush *)
67
 
      gimp_container_get_child_by_name (gimp->brush_factory->container,
68
 
                                        name);
69
 
  }
70
 
else
71
 
  {
72
 
    brush = gimp_context_get_brush (context);
73
 
  }
74
 
CODE
75
 
 
76
 
 
77
 
# The defs
78
 
 
79
20
sub brushes_refresh {
80
21
    $blurb = 'Refresh current brushes. This function always succeeds.';
81
22
 
84
25
and updates the brush dialogs accordingly.
85
26
HELP
86
27
 
87
 
    $author = $copyright = 'Seth Burgess';
88
 
    $date = '1997';
 
28
    &seth_pdb_misc('1997');
89
29
 
90
30
    %invoke = (
91
31
        code => <<'CODE'
92
32
{
93
 
  gimp_data_factory_data_save (gimp->brush_factory);
94
 
  gimp_data_factory_data_init (gimp->brush_factory, FALSE);
 
33
  gimp_data_factory_data_refresh (gimp->brush_factory);
95
34
}
96
35
CODE
97
36
    );
103
42
    $help = <<'HELP';
104
43
This procedure returns a complete listing of available GIMP
105
44
brushes. Each name returned can be used as input to the
106
 
'gimp_context_set_brush' procedure.
 
45
gimp_context_set_brush() procedure.
107
46
HELP
108
47
 
109
48
    &std_pdb_misc;
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' },
121
 
          init => 1 }
 
59
                     desc => 'The number of brushes in the brush list' } }
122
60
    );
123
61
 
124
62
    %invoke = (
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);'
 
64
        code    => <<'CODE'
 
65
{
 
66
  brush_list = gimp_container_get_filtered_name_array (gimp->brush_factory->container,
 
67
                                                       filter, &num_brushes);
 
68
}
 
69
CODE
127
70
    );
128
71
}
129
72
 
130
73
sub brushes_get_brush {
131
 
    &std_pdb_deprecated ('gimp_context_get_brush');
 
74
    &std_pdb_deprecated ('gimp-context-get-brush');
132
75
 
133
76
    @outargs = (
134
 
        &brush_arg,
135
 
        &dim_args,
136
 
        &spacing_arg
 
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' }
137
85
    );
138
86
 
139
 
    &brush_outargs;
140
 
 
141
87
    %invoke = (
142
 
        vars => [ 'GimpBrush *brush' ],
143
 
        code => 'success = (brush = gimp_context_get_brush (context)) != NULL;'
 
88
        code => <<'CODE'
 
89
{
 
90
  GimpBrush *brush = gimp_context_get_brush (context);
 
91
 
 
92
  if (brush)
 
93
    {
 
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);
 
98
    }
 
99
  else
 
100
    success = FALSE;
 
101
}
 
102
CODE
144
103
    );
145
104
}
146
105
 
147
106
sub brushes_get_spacing {
148
 
    &std_pdb_deprecated ('gimp_brush_get_spacing');
149
 
 
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');
 
108
 
 
109
    @outargs = (
 
110
        { name => 'spacing', type => '0 <= int32 <= 1000',
 
111
          desc => 'The brush spacing' }
 
112
    );
 
113
 
 
114
    %invoke = (
 
115
        code =><<'CODE'
 
116
{
 
117
  GimpBrush *brush = gimp_context_get_brush (context);
 
118
 
 
119
  if (brush)
 
120
    spacing = gimp_brush_get_spacing (brush);
 
121
  else
 
122
    success = FALSE;
 
123
}
 
124
CODE
 
125
    );
153
126
}
154
127
 
155
128
sub brushes_set_spacing {
156
 
    &std_pdb_deprecated ('gimp_brush_set_spacing');
 
129
    &std_pdb_deprecated ('gimp-brush-set-spacing');
157
130
 
158
 
    @inargs = ( &spacing_arg );
 
131
    @inargs = (
 
132
        { name => 'spacing', type => '0 <= int32 <= 1000',
 
133
          desc => 'The brush spacing' }
 
134
    );
159
135
 
160
136
    %invoke = (
161
 
        code => 'gimp_brush_set_spacing (gimp_context_get_brush (context), spacing);'
 
137
        code => <<'CODE'
 
138
{
 
139
  gimp_brush_set_spacing (gimp_context_get_brush (context), spacing);
 
140
}
 
141
CODE
162
142
    );
163
143
}
164
144
 
165
145
sub brushes_get_brush_data {
166
 
    &std_pdb_deprecated ('gimp_brush_get_pixels');
 
146
    &std_pdb_deprecated ('gimp-brush-get-pixels');
167
147
 
168
148
    @inargs = (
169
 
        &brush_arg
 
149
        { name => 'name', type => 'string',
 
150
          desc => 'The brush name ("" means current active brush)',
 
151
          null_ok => '1' }
170
152
    );
171
 
    $inargs[0]->{desc} = 'The brush name ("" means current active brush)';
172
153
 
173
154
    @outargs = (
174
 
        &brush_arg,
175
 
        &opacity_arg,
176
 
        &spacing_arg,
177
 
        &paint_mode_arg,
178
 
        &dim_args,
 
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' } }
179
171
    );
180
172
 
181
 
    &brush_outargs;
182
 
 
183
 
    $outargs[1]->{alias} = '1.0';
184
 
    $outargs[3]->{alias} = '0';
185
 
 
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' } };
190
 
    
191
173
    %invoke = (
192
 
        vars => [ 'GimpBrush *brush = NULL' ],
193
174
        code => <<'CODE'
194
175
{
 
176
  GimpBrush *brush;
 
177
 
195
178
  if (name && strlen (name))
196
179
    {
197
180
      brush = (GimpBrush *)
204
187
 
205
188
  if (brush)
206
189
    {
207
 
      length    = brush->mask->height * brush->mask->width;
208
 
      mask_data = g_memdup (temp_buf_data (brush->mask), length);
 
190
      actual_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
 
191
      opacity     = 1.0;
 
192
      spacing     = gimp_brush_get_spacing (brush);
 
193
      paint_mode  = 0;
 
194
      width       = brush->mask->width;
 
195
      height      = brush->mask->height;
 
196
      length      = brush->mask->height * brush->mask->width;
 
197
      mask_data   = g_memdup (temp_buf_data (brush->mask), length);
209
198
    }
210
199
  else
211
200
    success = FALSE;
215
204
}
216
205
 
217
206
 
218
 
@headers = qw(<string.h> "base/temp-buf.h"
219
 
              "core/gimp.h" "core/gimplist.h" "core/gimpbrush.h"
220
 
              "core/gimpcontext.h" "core/gimpdatafactory.h");
221
 
 
222
 
@procs = qw(brushes_refresh brushes_get_list brushes_get_brush
223
 
            brushes_get_spacing brushes_set_spacing brushes_get_brush_data);
 
207
@headers = qw(<string.h>
 
208
              "base/temp-buf.h"
 
209
              "core/gimp.h"
 
210
              "core/gimplist.h"
 
211
              "core/gimpbrush.h"
 
212
              "core/gimpcontext.h"
 
213
              "core/gimpdatafactory.h");
 
214
 
 
215
@procs = qw(brushes_refresh brushes_get_list
 
216
            brushes_get_brush
 
217
            brushes_get_spacing brushes_set_spacing
 
218
            brushes_get_brush_data);
 
219
 
224
220
%exports = (app => [@procs], lib => [@procs]);
225
221
 
226
222
$desc = 'Brushes';