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

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/buffer.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
# GIMP - The GNU Image Manipulation Program
 
2
# Copyright (C) 1995 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
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
 
19
 
 
20
sub buffers_get_list {
 
21
    $blurb = 'Retrieve a complete listing of the available buffers.';
 
22
 
 
23
    $help = <<'HELP';
 
24
This procedure returns a complete listing of available named buffers.
 
25
HELP
 
26
 
 
27
    &mitch_pdb_misc('2005', '2.4');
 
28
 
 
29
    @inargs = (
 
30
        { name => 'filter', type => 'string', null_ok => 1,
 
31
          desc => 'An optional regular expression used to filter the list' }
 
32
    );
 
33
 
 
34
    @outargs = (
 
35
        { name => 'buffer_list', type => 'stringarray',
 
36
          desc => 'The list of buffer names',
 
37
          array => { name => 'num_buffers',
 
38
                     desc => 'The number of buffers' } }
 
39
    );
 
40
 
 
41
    %invoke = (
 
42
        code => <<'CODE'
 
43
{
 
44
  buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers,
 
45
                                                        filter, &num_buffers);
 
46
}
 
47
CODE
 
48
    );
 
49
}
 
50
 
 
51
sub buffer_rename {
 
52
    $blurb = 'Renames a named buffer.';
 
53
    $help  = 'This procedure renames a named buffer.';
 
54
 
 
55
    &mitch_pdb_misc('2005', '2.4');
 
56
 
 
57
    @inargs = (
 
58
        { name => 'buffer_name', type => 'string',
 
59
          desc => 'The buffer name' },
 
60
        { name => 'new_name', type => 'string',
 
61
          desc => 'The buffer\'s new name' }
 
62
    );
 
63
 
 
64
    @outargs = (
 
65
        { name => 'real_name', type => 'string',
 
66
          desc => 'The real name given to the buffer' }
 
67
    );
 
68
 
 
69
    %invoke = (
 
70
        code => <<'CODE'
 
71
{
 
72
  GimpBuffer *buffer = (GimpBuffer *)
 
73
    gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
 
74
 
 
75
  if (buffer && strlen (new_name))
 
76
    {
 
77
      gimp_object_set_name (GIMP_OBJECT (buffer), new_name);
 
78
      real_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (buffer)));
 
79
    }
 
80
  else
 
81
    success = FALSE;
 
82
}
 
83
CODE
 
84
    );
 
85
}
 
86
 
 
87
sub buffer_delete {
 
88
    $blurb = 'Deletes a named buffer.';
 
89
    $help  = 'This procedure deletes a named buffer.';
 
90
 
 
91
    $author = $copyright = 'David Gowers <neota@softhome.net>';
 
92
    $date   = '2005';
 
93
    $since  = '2.4';
 
94
 
 
95
    @inargs = (
 
96
        { name => 'buffer_name', type => 'string',
 
97
          desc => 'The buffer name' }
 
98
    );
 
99
 
 
100
    %invoke = (
 
101
        code => <<'CODE'
 
102
{
 
103
  GimpBuffer *buffer = (GimpBuffer *)
 
104
    gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
 
105
 
 
106
  if (buffer)
 
107
    success = gimp_container_remove (gimp->named_buffers, GIMP_OBJECT (buffer));
 
108
  else
 
109
    success = FALSE;
 
110
}
 
111
CODE
 
112
    );
 
113
}
 
114
 
 
115
sub buffer_get_width {
 
116
    $blurb = "Retrieves the specified buffer's width.";
 
117
    $help  = "This procedure retrieves the specified named buffer's width.";
 
118
 
 
119
    &mitch_pdb_misc('2005', '2.4');
 
120
 
 
121
    @inargs = (
 
122
        { name => 'buffer_name', type => 'string',
 
123
          desc => 'The buffer name' }
 
124
    );
 
125
 
 
126
    @outargs = (
 
127
        { name => 'width', type => 'int32',
 
128
          desc => "The buffer width" }
 
129
    );
 
130
 
 
131
    %invoke = (
 
132
        code => <<'CODE'
 
133
{
 
134
  GimpBuffer *buffer = (GimpBuffer *)
 
135
    gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
 
136
 
 
137
  if (buffer)
 
138
    width = gimp_buffer_get_width (buffer);
 
139
  else
 
140
    success = FALSE;
 
141
}
 
142
CODE
 
143
    );
 
144
}
 
145
 
 
146
sub buffer_get_height {
 
147
    $blurb = "Retrieves the specified buffer's height.";
 
148
    $help  = "This procedure retrieves the specified named buffer's height.";
 
149
 
 
150
    &mitch_pdb_misc('2005', '2.4');
 
151
 
 
152
    @inargs = (
 
153
        { name => 'buffer_name', type => 'string',
 
154
          desc => 'The buffer name' }
 
155
    );
 
156
 
 
157
    @outargs = (
 
158
        { name => 'height', type => 'int32',
 
159
          desc => "The buffer height" }
 
160
    );
 
161
 
 
162
    %invoke = (
 
163
        code => <<'CODE'
 
164
{
 
165
  GimpBuffer *buffer = (GimpBuffer *)
 
166
    gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
 
167
 
 
168
  if (buffer)
 
169
    height = gimp_buffer_get_height (buffer);
 
170
  else
 
171
    success = FALSE;
 
172
}
 
173
CODE
 
174
    );
 
175
}
 
176
 
 
177
sub buffer_get_bytes {
 
178
    $blurb = "Retrieves the specified buffer's bytes.";
 
179
    $help  = "This procedure retrieves the specified named buffer's bytes.";
 
180
 
 
181
    &mitch_pdb_misc('2005', '2.4');
 
182
 
 
183
    @inargs = (
 
184
        { name => 'buffer_name', type => 'string',
 
185
          desc => 'The buffer name' }
 
186
    );
 
187
 
 
188
    @outargs = (
 
189
        { name => 'bytes', type => 'int32',
 
190
          desc => "The buffer bpp" }
 
191
    );
 
192
 
 
193
    %invoke = (
 
194
        code => <<'CODE'
 
195
{
 
196
  GimpBuffer *buffer = (GimpBuffer *)
 
197
    gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
 
198
 
 
199
  if (buffer)
 
200
    bytes = gimp_buffer_get_bytes (buffer);
 
201
  else
 
202
    success = FALSE;
 
203
}
 
204
CODE
 
205
    );
 
206
}
 
207
 
 
208
sub buffer_get_image_type {
 
209
    $blurb = "Retrieves the specified buffer's image type.";
 
210
    $help  = "This procedure retrieves the specified named buffer's image type.";
 
211
 
 
212
    &mitch_pdb_misc('2005', '2.4');
 
213
 
 
214
    @inargs = (
 
215
        { name => 'buffer_name', type => 'string',
 
216
          desc => 'The buffer name' }
 
217
    );
 
218
 
 
219
    @outargs = (
 
220
        { name => 'image_type', type => 'enum GimpImageBaseType',
 
221
          desc => "The buffer image type" }
 
222
    );
 
223
 
 
224
    %invoke = (
 
225
        code => <<'CODE'
 
226
{
 
227
  GimpBuffer *buffer = (GimpBuffer *)
 
228
    gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
 
229
 
 
230
  if (buffer)
 
231
    image_type = gimp_buffer_get_image_type (buffer);
 
232
  else
 
233
    success = FALSE;
 
234
}
 
235
CODE
 
236
    );
 
237
}
 
238
 
 
239
 
 
240
@headers = qw(<string.h> "core/gimp.h" "core/gimpbuffer.h"
 
241
              "core/gimpcontainer.h" "core/gimpcontainer-filter.h"
 
242
              "gimp-intl.h");
 
243
 
 
244
@procs = qw(buffers_get_list
 
245
            buffer_rename buffer_delete
 
246
            buffer_get_width buffer_get_height
 
247
            buffer_get_bytes buffer_get_image_type);
 
248
 
 
249
%exports = (app => [@procs], lib => [@procs]);
 
250
 
 
251
$desc = 'Buffer procedures';
 
252
 
 
253
1;