Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
a1a1b78c
Commit
a1a1b78c
authored
Mar 28, 1999
by
Manish Singh
Browse files
Stuff
-Yosh
parent
21b5cd44
Changes
18
Hide whitespace changes
Inline
Side-by-side
tools/pdbgen/.cvsignore
0 → 100644
View file @
a1a1b78c
Makefile
Makefile.in
tools/pdbgen/Makefile.am
0 → 100644
View file @
a1a1b78c
enum_headers
=
\
../../app/convert.h
\
../../app/channel_ops.h
\
../../app/text_tool.h
\
../../app/gimpdrawable.h
\
../../app/gimpimage.h
enums.pl
:
enumgen.pl $(enum_headers)
cd
$(srcdir)
\
&&
$(PERL)
enumgen.pl
$(enum_headers)
tools/pdbgen/app.pl
View file @
a1a1b78c
...
...
@@ -79,7 +79,7 @@ sub declare_args {
unless
(
exists
$_
->
{
no_declare
})
{
$result
.=
'
'
x
2
.
$arg
->
{
type
}
.
&arg_vname
(
$_
);
if
(
!
exists
$_
->
{
no_init
}
&&
exists
$_
->
{
init
})
{
$result
.=
$arg
->
{
type
}
=~
/\*$/
?
'
= NULL
'
:
'
0
'
$result
.=
$arg
->
{
type
}
=~
/\*$/
?
'
= NULL
'
:
'
=
0
'
}
$result
.=
"
;
\n
";
...
...
@@ -359,7 +359,6 @@ CODE
$out
->
{
headers
}
->
{
$header
}
++
;
}
}
$out
->
{
headers
}
->
{
q/"procedural_db.h"/
}
++
;
$out
->
{
code
}
.=
"
\n
static Argument *
\n
";
$out
->
{
code
}
.=
"
${name}
_invoker (Argument *args)
\n
{
\n
";
...
...
@@ -460,14 +459,17 @@ CODE
}
$invoker
.=
&marshal_inargs
(
$proc
,
0
);
$invoker
.=
"
\n
"
if
$invoker
&&
$invoker
!~
/\n\n/s
;
my
$frag
=
&format_code_frag
(
$proc
->
{
invoke
}
->
{
code
},
$success
)
;
my
$frag
=
""
;
$frag
=
'
'
x
2
.
"
if (success)
\n
"
.
$frag
if
$success
;
$success
=
(
$frag
=~
/success =/
)
unless
$success
;
if
(
exists
$proc
->
{
invoke
}
->
{
code
})
{
$frag
=
&format_code_frag
(
$proc
->
{
invoke
}
->
{
code
},
$success
);
$frag
=
'
'
x
2
.
"
if (success)
\n
"
.
$frag
if
$success
;
$success
=
(
$frag
=~
/success =/
)
unless
$success
;
}
chomp
$invoker
if
!
$frag
;
$code
.=
$invoker
.
$frag
;
$code
.=
"
\n
"
if
$frag
=~
/\n\n/s
||
$invoker
;
$code
.=
&marshal_outargs
(
$proc
)
.
"
}
\n
";
...
...
@@ -505,6 +507,8 @@ static ProcRecord ${name}_proc =
{ { ${name}_invoker } }
};
CODE
delete
$out
->
{
headers
}
->
{
q/"procedural_db.h"/
};
}
my
$gpl
=
<<'GPL';
...
...
@@ -553,6 +557,7 @@ HEADER
my
$cfile
=
"
$destdir
/
${group}
_cmds.c
$FILE_EXT
";
open
CFILE
,
"
>
$cfile
"
or
die
"
Can't open
$cmdfile
: $!
\n
";
print
CFILE
$gpl
;
print
CFILE
qq/#include "procedural_db.h"\n\n/
;
foreach
$header
(
sort
keys
%
{
$out
->
{
headers
}})
{
print
CFILE
"
#include
$header
\n
";
}
...
...
tools/pdbgen/enums.pl
View file @
a1a1b78c
...
...
@@ -41,6 +41,53 @@ package Gimp::CodeGen::enums;
symbols
=>
[
qw(PIXELS POINTS)
],
mapping
=>
{
PIXELS
=>
'
0
',
POINTS
=>
'
1
'
}
},
GimpFillType
=>
{
contig
=>
1
,
symbols
=>
[
qw(FOREGROUND_FILL BACKGROUND_FILL WHITE_FILL
TRANSPARENT_FILL NO_FILL)
],
mapping
=>
{
FOREGROUND_FILL
=>
'
0
',
BACKGROUND_FILL
=>
'
1
',
WHITE_FILL
=>
'
2
',
TRANSPARENT_FILL
=>
'
3
',
NO_FILL
=>
'
4
'
}
},
GimpImageType
=>
{
contig
=>
1
,
symbols
=>
[
qw(RGB_GIMAGE RGBA_GIMAGE GRAY_GIMAGE GRAYA_GIMAGE
INDEXED_GIMAGE INDEXEDA_GIMAGE)
],
mapping
=>
{
RGB_GIMAGE
=>
'
0
',
RGBA_GIMAGE
=>
'
1
',
GRAY_GIMAGE
=>
'
2
',
GRAYA_GIMAGE
=>
'
3
',
INDEXED_GIMAGE
=>
'
4
',
INDEXEDA_GIMAGE
=>
'
5
'
}
},
GimpImageBaseType
=>
{
contig
=>
1
,
symbols
=>
[
qw(RGB GRAY INDEXED)
],
mapping
=>
{
RGB
=>
'
0
',
GRAY
=>
'
1
',
INDEXED
=>
'
2
'
}
},
ChannelType
=>
{
contig
=>
1
,
symbols
=>
[
qw(Red Green Blue Gray Indexed Auxillary)
],
mapping
=>
{
Red
=>
'
0
',
Green
=>
'
1
',
Blue
=>
'
2
',
Gray
=>
'
3
',
Indexed
=>
'
4
',
Auxillary
=>
'
5
'
}
},
MergeType
=>
{
contig
=>
1
,
symbols
=>
[
qw(ExpandAsNecessary ClipToImage ClipToBottomLayer
FlattenImage)
],
mapping
=>
{
ExpandAsNecessary
=>
'
0
',
ClipToImage
=>
'
1
',
ClipToBottomLayer
=>
'
2
',
FlattenImage
=>
'
3
'
}
}
);
...
...
tools/pdbgen/groups.pl
View file @
a1a1b78c
...
...
@@ -16,5 +16,5 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Modify this list for the groups to parse in the pdb directory
@groups
=
qw(gdisplay edit floating_sel undo palette gradient
convert
channel_ops text gimprc parasite)
;
@groups
=
qw(gdisplay edit floating_sel undo palette gradient
convert
channel_ops text gimprc
drawable
parasite
paths
)
;
tools/pdbgen/pdb.pl
View file @
a1a1b78c
...
...
@@ -93,8 +93,8 @@ sub arg_parse {
my
(
$name
,
$remove
)
=
(
$
1
,
$
2
);
my
@retvals
=
('
enum
',
$name
);
if
(
$remove
&&
$remove
=~
/
\(no
/
)
{
$remove
=
~
s
/ \(no (.*?)\)$/$1
/
;
if
(
$remove
&&
$remove
=~
m@
\(no
@
)
{
chop
$remove
;
(
$remove
=
s
ubstr
(
$remove
,
5
))
=~
s/ $/
/
;
push
@retvals
,
split
(
/,\s*/
,
$remove
);
}
...
...
tools/pdbgen/pdb/convert.pdb
View file @
a1a1b78c
...
...
@@ -26,9 +26,8 @@ sub simple_inargs {
sub simple_invoke {
my $type = shift;
%invoke = (
headers => [ qw("gimage.h" "convert.h") ],
code => <<CODE
if (success = (gimage_base_type (gimage) != $type))
if
(
(success = (gimage_base_type (gimage) != $type))
)
convert_image ((void *) gimage, $type, 0, 0, 0);
CODE
);
...
...
@@ -81,7 +80,6 @@ HELP
);
%invoke = (
headers => [ qw("gimage.h" "convert.h") ],
code => <<'CODE'
{
success = (gimage_base_type (gimage) != INDEXED);
...
...
@@ -122,14 +120,15 @@ HELP
(palette_type == MAKE_PALETTE)' },
{ name => 'palette', type => 'string',
desc => 'The name of the custom palette to use, ignored unless
(palette_type == CUSTOM_PALETTE)' }
(palette_type == CUSTOM_PALETTE)',
alias => 'palette_name' }
);
%invoke = (
headers => [ qw(
"gimage.h" "convert.h"
"palette.h") ],
headers => [ qw("palette.h") ],
code => <<'CODE'
{
if (success = (gimage_base_type (gimage) != INDEXED))
if
(
(success = (gimage_base_type (gimage) != INDEXED))
)
{
PaletteEntriesP entries, the_palette = NULL;
GSList *list;
...
...
@@ -179,6 +178,8 @@ CODE
);
}
@headers = qw("gimage.h" "convert.h");
@procs = qw(convert_rgb convert_grayscale convert_indexed
convert_indexed_palette);
%exports = (app => [@procs]);
...
...
tools/pdbgen/pdb/display.pdb
View file @
a1a1b78c
...
...
@@ -40,14 +40,13 @@ HELP
);
%invoke = (
headers => [ qw("gdisplay.h") ],
vars => [ 'guint scale = 0x101' ],
code => <<'CODE'
{
if (gimage->layers == NULL)
success = FALSE;
else
if (gimage->layers)
success = (gdisp = gdisplay_new (gimage, scale)) != NULL;
else
success = FALSE;
}
CODE
);
...
...
@@ -68,10 +67,7 @@ HELP
desc => 'The display to delete', alias => 'gdisp' }
);
%invoke = (
headers => [ qw("gdisplay.h") ],
code => 'gtk_widget_destroy (gdisp->shell);'
);
%invoke = ( code => 'gtk_widget_destroy (gdisp->shell);' );
}
sub displays_flush {
...
...
@@ -85,12 +81,11 @@ HELP
&std_pdb_misc;
%invoke = (
headers => [ qw("gdisplay.h") ],
code => 'gdisplays_flush ();'
);
%invoke = ( code => 'gdisplays_flush ();' );
}
@headers = qw("gdisplay.h");
@procs = qw(display_new display_delete displays_flush);
%exports = (app => [@procs], lib => [@procs]);
...
...
tools/pdbgen/pdb/drawable.pdb
View file @
a1a1b78c
...
...
@@ -17,8 +17,38 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub drawable_arg {
{ name => 'drawable', type => 'drawable', desc => 'The drawable' }
sub drawable_arg {{
name => 'drawable',
type => 'drawable',
desc => 'The drawable',
no_success => 1
}}
sub drawable_prop_proc {
my ($return, $name, $type, $func, $desc) = @_;
$blurb = "Returns $return.";
&std_pdb_misc;
@inargs = ( &drawable_arg );
@outargs = (
{ name => $name, type => $type, desc => $desc,
alias => "drawable_$func (drawable)", no_declare => 1 }
);
}
sub drawable_type_proc {
my ($desc, $type, $func) = @_;
$help = <<HELP;
This procedure returns non-zero if the specified drawable is of type
{ $type }.
HELP
&drawable_prop_proc("whether the drawable is $desc type", $func, 'boolean',
$func, "non-zero if the drawable is $desc type")
}
sub drawable_merge_shadow {
...
...
@@ -38,11 +68,9 @@ HELP
{ name => 'undo', type => 'boolean',
desc => 'Push merge to undo stack?' }
);
delete $inargs[0]->{no_success};
%invoke = (
headers => [ qw("drawable.h") ],
code => 'drawable_merge_shadow (drawable, undo);'
);
%invoke = ( code => 'drawable_merge_shadow (drawable, undo);' );
}
sub drawable_fill {
...
...
@@ -67,8 +95,193 @@ HELP
desc => 'The type of fill: %%desc%%' }
);
%invoke = ( code => 'drawable_fill (drawable, fill_type);' );
}
sub drawable_update {
$blurb = 'Update the specified region of the drawable.';
$help = <<'HELP';
This procedure updates the specified region of the drawable. The (x, y)
coordinate pair is relative to the drawable's origin, not to the image origin.
Therefore, the entire drawable can be updated with: {x->0, y->0, w->width,
h->height }.
HELP
&std_pdb_misc;
@inargs = (
&drawable_arg,
{ name => 'x', type => 'int32',
desc => 'x coordinate of upper left corner of update region' },
{ name => 'y', type => 'int32',
desc => 'y coordinate of upper left corner of update region' },
{ name => 'width', type => 'int32',
desc => 'Width of update region' },
{ name => 'height', type => 'int32',
desc => 'Height of update region' }
);
%invoke = ( code => 'drawable_update (drawable, x, y, width, height);' );
}
sub drawable_mask_bounds {
$blurb = <<'BLURB';
Find the bounding box of the current selection in relation to the specified
drawable.
BLURB
$help = <<'HELP';
This procedure returns the whether there is a selection. If there is one, the
upper left and lower righthand corners of its bounding box are returned. These
coordinates are specified relative to the drawable's origin, and bounded by
the drawable's extents.
HELP
&std_pdb_misc;
@inargs = ( &drawable_arg );
@outargs = (
{ name => 'non_empty', type => 'boolean',
desc => 'TRUE if there is a selection' },
);
my $pos = 1;
foreach $where ('upper left', 'lower right') {
foreach (qw(x y)) {
push @outargs, { name => "$_$pos", type => 'int32',
desc => '$_ coordinate of the $where corner of
selection bounds' }
}
$pos++;
}
%invoke = (
headers => [ qw("drawable.h") ],
code => 'drawable_fill (drawable, fill_type);'
code => <<'CODE'
non_empty = drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
CODE
);
}
sub drawable_gimage {
$blurb = "Returns the drawable's image.";
$help = "This procedure returns the drawable's image.";
&std_pdb_misc;
@inargs = ( &drawable_arg );
@outargs = ( &std_image_arg );
$outargs[0]->{desc} = "The drawable's image";
%invoke = (
code => 'success = (gimage = drawable_gimage (drawable)) != NULL;'
);
}
sub drawable_type {
$help = "This procedure returns the drawable's type.";
&drawable_prop_proc("the drawable's type", 'type', 'enum GimpImageType',
'type',"The drawable's type: %%desc%%");
delete $inargs[0]->{no_success};
}
sub drawable_has_alpha {
$help = <<'HELP';
This procedure returns whether the specified drawable has an alpha channel.
This can only be true for layers, and the associated type will be one of:
{ RGBA , GRAYA, INDEXEDA }.
HELP
&drawable_prop_proc('non-zero if the drawable has an alpha channel',
'has_alpha', 'boolean', 'has_alpha',
'Does the drawable have an alpha channel?');
}
sub drawable_type_with_alpha {
$help = <<'HELP';
This procedure returns the drawable's type if an alpha channel were added. If
the type is currently Gray, for instance, the returned type would be GrayA. If
the drawable already has an alpha channel, the drawable's type is simply
returned.
HELP
&drawable_prop_proc("the drawable's type with alpha", 'type_with_alpha',
'enum GimpImageType (no RGB_GIMAGE, GRAY_GIMAGE,
INDEXED_GIMAGE)', 'type_with_alpha',
"The drawable's type with alpha: %%desc%%");
}
sub drawable_color {
&drawable_type_proc('an RGB', 'RGB, RGBA', 'color');
}
sub drawable_gray {
&drawable_type_proc('a grayscale', 'Gray, GrayA', 'gray');
}
sub drawable_indexed {
&drawable_type_proc('an indexed', 'Indexed, IndexedA', 'indexed');
}
sub drawable_bytes {
$help = <<'HELP';
This procedure returns the number of bytes per pixel (or the number of
channels) for the specified drawable.
HELP
&drawable_prop_proc('the bytes per pixel', 'bytes', 'int32', 'bytes',
'Bytes per pixel');
}
sub drawable_width {
$help = "This procedure returns the specified drawable's width in pixels.";
&drawable_prop_proc('the width of the drawable', 'width', 'int32',
'width', 'Width of drawable');
}
sub drawable_height {
$help = "This procedure returns the specified drawable's height in pixels.";
&drawable_prop_proc('the height of the drawable', 'height', 'int32',
'height', 'Height of drawable');
}
sub drawable_offsets {
$blurb = 'Returns the offsets for the drawable.';
$help = <<'HELP';
This procedure returns the specified drawable's offsets. This only makes sense
if the drawable is a layer since channels are anchored. The offsets of a
channel will be returned as 0.
HELP
&std_pdb_misc;
@inargs = ( &drawable_arg );
foreach (qw(x y)) {
push @outargs, { name => "offset_$_", type => 'int32',
desc => "$_ offset of drawable" }
}
%invoke = ( code => 'drawable_offsets (drawable, &offset_x, &offset_y);' );
}
@headers = qw("drawable.h");
@procs = qw(drawable_merge_shadow drawable_fill drawable_update
drawable_mask_bounds drawable_gimage drawable_type
drawable_has_alpha drawable_type_with_alpha drawable_color
drawable_gray drawable_indexed drawable_bytes drawable_width
drawable_height drawable_offsets);
%exports = (app => [@procs]);
$desc = 'Drawable procedures';
1;
tools/pdbgen/pdb/gdisplay.pdb
View file @
a1a1b78c
...
...
@@ -40,14 +40,13 @@ HELP
);
%invoke = (
headers => [ qw("gdisplay.h") ],
vars => [ 'guint scale = 0x101' ],
code => <<'CODE'
{
if (gimage->layers == NULL)
success = FALSE;
else
if (gimage->layers)
success = (gdisp = gdisplay_new (gimage, scale)) != NULL;
else
success = FALSE;
}
CODE
);
...
...
@@ -68,10 +67,7 @@ HELP
desc => 'The display to delete', alias => 'gdisp' }
);
%invoke = (
headers => [ qw("gdisplay.h") ],
code => 'gtk_widget_destroy (gdisp->shell);'
);
%invoke = ( code => 'gtk_widget_destroy (gdisp->shell);' );
}
sub displays_flush {
...
...
@@ -85,12 +81,11 @@ HELP
&std_pdb_misc;
%invoke = (
headers => [ qw("gdisplay.h") ],
code => 'gdisplays_flush ();'
);
%invoke = ( code => 'gdisplays_flush ();' );
}
@headers = qw("gdisplay.h");
@procs = qw(display_new display_delete displays_flush);
%exports = (app => [@procs], lib => [@procs]);
...
...
tools/pdbgen/pdb/gradient.pdb-21477
View file @
a1a1b78c
...
...
@@ -194,7 +194,6 @@ HELP
&sample_outargs;
%invoke = (
headers => [ qw("gradient.h") ],
vars => ['gdouble r, g, b, a', 'gdouble *pv'],
code => <<'CODE'
{
...
...
@@ -218,6 +217,8 @@ CODE
);
}
@headers = qw("gradient.h");
@procs = qw(gradients_get_list gradients_get_active gradients_set_active
gradients_sample_uniform gradients_sample_custom);
%exports = (app => [@procs], lib => [@procs]);
...
...
tools/pdbgen/pdb/gradients.pdb
View file @
a1a1b78c
...
...
@@ -194,7 +194,6 @@ HELP
&sample_outargs;
%invoke = (
headers => [ qw("gradient.h") ],
vars => ['gdouble r, g, b, a', 'gdouble *pv'],
code => <<'CODE'
{
...
...
@@ -218,6 +217,8 @@ CODE
);
}
@headers = qw("gradient.h");
@procs = qw(gradients_get_list gradients_get_active gradients_set_active
gradients_sample_uniform gradients_sample_custom);
%exports = (app => [@procs], lib => [@procs]);
...
...
tools/pdbgen/pdb/palette.pdb
View file @
a1a1b78c
...
...
@@ -49,7 +49,7 @@ CODE
sub invoke_set {
%invoke = (
headers => [ qw("gimpimage.h"
"palette.h"
) ],
headers => [ qw("gimpimage.h") ],
code => <<CODE
palette_set_@{[shift]}ground (col[RED_PIX], col[GREEN_PIX], col[BLUE_PIX]);
CODE
...
...
@@ -124,10 +124,7 @@ HELP
&std_pdb_misc;
%invoke = (
headers => [ qw("palette.h") ],
code => 'palette_set_default_colors ();'
);
%invoke = ( code => 'palette_set_default_colors ();' );
}
sub palette_swap_colors {
...
...
@@ -140,10 +137,7 @@ HELP
&std_pdb_misc;
%invoke = (
headers => [ qw("palette.h") ],
code => 'palette_swap_colors ();'
);
%invoke = ( code => 'palette_swap_colors ();' );
}
sub palette_refresh {
...
...
@@ -158,7 +152,6 @@ HELP
$date = '1998';
%invoke = (
headers => [ qw("palette.h") ],
code => <<'CODE'
{
/* FIXME: I've hardcoded success to be TRUE, because brushes_init() is a
...
...
@@ -177,6 +170,8 @@ CODE
);
}
@headers = qw("palette.h");
@procs = qw(palette_get_foreground palette_get_background
palette_set_foreground palette_set_background
palette_set_default_colors palette_swap_colors
...
...
tools/pdbgen/pdb/parasite.pdb
View file @
a1a1b78c
...
...
@@ -24,6 +24,19 @@ sub pdb_misc {
$date = 1998;
}
sub name_arg {{
name => 'name',
type => 'string',
desc => "The name of the parasite to $_[0]",
no_success => 1
}}
sub parasite_outarg {{
name => 'parasite',
type => 'parasite',
desc => "The $_[0] parasite"
}}
sub parasite_new {
$blurb = 'Creates a new parasite.';
...
...
@@ -32,8 +45,7 @@ sub parasite_new {
&pdb_misc;
@inargs = (
{ name => 'name', type => 'string',
desc => 'The name of the parasite to create', no_success => 1 },
&name_arg('create'),
{ name => 'flags', type => 'int32',
desc => 'The flags (persistance == 1)' },
{ name => 'size', type => '0 <= int32',
...
...
@@ -42,13 +54,9 @@ sub parasite_new {