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

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/patterns.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 pattern_arg () {{
21
 
    name => 'name',
22
 
    type => 'string',
23
 
    desc => 'The pattern 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 pattern $_" };
31
 
    }
32
 
    @args;
33
 
}
34
 
 
35
 
sub pattern_outargs {
36
 
    foreach (@outargs) {
37
 
        my $alias;
38
 
        if ($_->{type} eq 'string') {
39
 
            $alias = "GIMP_OBJECT (pattern)->$_->{name}";
40
 
        } else {
41
 
            $alias = "pattern->$_->{name}";
42
 
        }
43
 
        $alias = "g_strdup ($alias)" if $_->{type} eq 'string';
44
 
        $alias =~ s/pattern/pattern->mask/ if $_->{name} =~ /width|height/;
45
 
        $_->{alias} = $alias;
46
 
        $_->{no_declare} = 1;
47
 
    }
48
 
}
49
 
 
50
 
# The defs
51
 
 
52
20
sub patterns_refresh {
53
21
    $blurb = 'Refresh current patterns. This function always succeeds.';
54
22
 
57
25
and updates all pattern dialogs accordingly.
58
26
HELP
59
27
 
60
 
    $author = $copyright = 'Michael Natterer';
61
 
    $date = '2002';
 
28
    &mitch_pdb_misc('2002');
62
29
 
63
30
    %invoke = (
64
 
        code => <<'CODE'
 
31
        code => <<'CODE'
65
32
{
66
 
  gimp_data_factory_data_save (gimp->pattern_factory);
67
 
  gimp_data_factory_data_init (gimp->pattern_factory, FALSE);
 
33
  gimp_data_factory_data_refresh (gimp->pattern_factory);
68
34
}
69
35
CODE
70
36
    );
75
41
 
76
42
    $help = <<'HELP';
77
43
This procedure returns a complete listing of available GIMP patterns. Each name
78
 
returned can be used as input to the 'gimp_context_set_pattern'.
 
44
returned can be used as input to the gimp_context_set_pattern().
79
45
HELP
80
46
 
81
47
    &std_pdb_misc;
82
48
 
83
49
    @inargs = (
84
 
        { name => 'filter',
85
 
          type => 'string', null_ok => 1,
 
50
        { name => 'filter', type => 'string', null_ok => 1,
86
51
          desc => 'An optional regular expression used to filter the list' }
87
52
    );
88
53
 
90
55
        { name => 'pattern_list', type => 'stringarray',
91
56
          desc => 'The list of pattern names',
92
57
          array => { name => 'num_patterns',
93
 
                     desc => 'The number of patterns in the pattern list' },
94
 
          init => 1 }
 
58
                     desc => 'The number of patterns in the pattern list' } }
95
59
    );
96
60
 
97
61
    %invoke = (
98
62
        headers => [ qw("core/gimpcontainer-filter.h") ],
99
 
        code => 'pattern_list = gimp_container_get_filtered_name_array (gimp->pattern_factory->container, filter, &num_patterns);'
 
63
        code => <<'CODE'
 
64
{
 
65
  pattern_list = gimp_container_get_filtered_name_array (gimp->pattern_factory->container,
 
66
                                                         filter, &num_patterns);
 
67
}
 
68
CODE
100
69
    );
101
70
}
102
71
 
103
72
sub patterns_get_pattern {
104
 
    &std_pdb_deprecated ('gimp_context_get_pattern');
 
73
    &std_pdb_deprecated ('gimp-context-get-pattern');
105
74
 
106
75
    @outargs = (
107
 
        &pattern_arg,
108
 
        &dim_args,
 
76
        { name => 'name', type => 'string',
 
77
          desc => 'The pattern name' },
 
78
        { name => 'width', type => 'int32',
 
79
          desc => 'The pattern width' },
 
80
        { name => 'height', type => 'int32',
 
81
          desc => 'The pattern height' }
109
82
    );
110
83
 
111
 
    &pattern_outargs;
112
 
 
113
84
    %invoke = (
114
 
        vars => [ 'GimpPattern *pattern' ],
115
 
        code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;'
 
85
        code => <<'CODE'
 
86
{
 
87
  GimpPattern *pattern = gimp_context_get_pattern (context);
 
88
 
 
89
  if (pattern)
 
90
    {
 
91
      name   = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
 
92
      width  = pattern->mask->width;
 
93
      height = pattern->mask->height;
 
94
    }
 
95
  else
 
96
    success = FALSE;
 
97
}
 
98
CODE
116
99
    );
117
100
}
118
101
 
119
102
sub patterns_get_pattern_data {
120
 
    &std_pdb_deprecated ('gimp_pattern_get_pixels');
 
103
    &std_pdb_deprecated ('gimp-pattern-get-pixels');
121
104
 
122
105
    @inargs = (
123
 
        &pattern_arg
 
106
        { name => 'name', type => 'string', null_ok => 1,
 
107
          desc => 'The pattern name ("" means currently active pattern)' }
124
108
    );
125
 
    $inargs[0]->{desc} = 'The pattern name ("" means currently active pattern)';
126
109
 
127
110
    @outargs = (
128
 
        &pattern_arg,
129
 
        &dim_args,
 
111
        { name => 'actual_name', type => 'string',
 
112
          desc => 'The pattern name' },
 
113
        { name => 'width', type => 'int32',
 
114
          desc => 'The pattern width' },
 
115
        { name => 'height', type => 'int32',
 
116
          desc => 'The pattern height' },
 
117
        { name => 'mask_bpp', type => 'int32',
 
118
          desc => 'Pattern bytes per pixel' },
 
119
        { name => 'mask_data', type => 'int8array',
 
120
          desc => 'The pattern mask data',
 
121
          array => { name => 'length',
 
122
                     desc => 'Length of pattern mask data' } }
130
123
    );
131
 
 
132
 
    &pattern_outargs;
133
 
 
134
 
    push @outargs, { name => 'mask_bpp', type => 'int32', init => 1,
135
 
                     desc => 'Pattern bytes per pixel',
136
 
                     alias => 'pattern->mask->bytes', no_declare => 1 },
137
 
                   { name => 'mask_data', type => 'int8array', init => 1,
138
 
                     desc => 'The pattern mask data',
139
 
                     array => { name => 'length', init => 1,
140
 
                                desc => 'Length of pattern mask data' } };
141
124
    
142
125
    %invoke = (
143
 
        vars => [ 'GimpPattern *pattern = NULL' ],
144
126
        code => <<'CODE'
145
127
{
 
128
  GimpPattern *pattern;
 
129
 
146
130
  if (name && strlen (name))
147
131
    {
148
132
      pattern = (GimpPattern *)
156
140
 
157
141
  if (pattern)
158
142
    {
159
 
      length = pattern->mask->height * pattern->mask->width *
160
 
               pattern->mask->bytes;
161
 
      mask_data = g_memdup (temp_buf_data (pattern->mask), length);
 
143
      actual_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
 
144
      width       = pattern->mask->width;
 
145
      height      = pattern->mask->height;
 
146
      mask_bpp    = pattern->mask->bytes;
 
147
      length      = pattern->mask->height * pattern->mask->width *
 
148
                    pattern->mask->bytes;
 
149
      mask_data   = g_memdup (temp_buf_data (pattern->mask), length);
162
150
    }
163
151
  else
164
152
    success = FALSE;
167
155
    );
168
156
}
169
157
 
170
 
@headers = qw(<string.h> "core/gimp.h" "core/gimpcontext.h" "core/gimplist.h"
171
 
              "core/gimpdatafactory.h" "core/gimppattern.h" "base/temp-buf.h");
 
158
 
 
159
@headers = qw(<string.h>
 
160
              "base/temp-buf.h"
 
161
              "core/gimp.h"
 
162
              "core/gimpcontext.h"
 
163
              "core/gimpdatafactory.h"
 
164
              "core/gimplist.h"
 
165
              "core/gimppattern.h");
172
166
 
173
167
@procs = qw(patterns_refresh patterns_get_list patterns_get_pattern
174
168
            patterns_get_pattern_data);
 
169
 
175
170
%exports = (app => [@procs], lib => [@procs]);
176
171
 
177
172
$desc = 'Patterns';