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
26e21fc7
Commit
26e21fc7
authored
Apr 27, 1999
by
Manish Singh
Browse files
Stuff
-Yosh
parent
83802561
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
tools/pdbgen/Makefile.am
View file @
26e21fc7
...
...
@@ -17,7 +17,8 @@ enum_headers = \
../../app/shear_tool.h
\
../../app/color_balance.h
\
../../app/hue_saturation.h
\
../../app/layerF.h
../../app/layerF.h
\
../../app/layer.h
enums.pl
:
enumgen.pl $(enum_headers)
cd
$(srcdir)
\
...
...
tools/pdbgen/app.pl
View file @
26e21fc7
...
...
@@ -225,9 +225,10 @@ sub marshal_inargs {
my
$var
=
&arg_vname
(
$_
);
if
(
exists
$arg
->
{
id_func
})
{
$result
.=
<<CODE;
$var = $arg->{id_func} (args[$argc].value.pdb_$type);
CODE
my
$id_func
=
$arg
->
{
id_func
};
$id_func
=
$_
->
{
id_func
}
if
exists
$_
->
{
id_func
};
$result
.=
"
$var
=
$id_func
(args[
$argc
].value.pdb_
$type
);
\n
";
$result
.=
&make_arg_test
(
$_
,
sub
{
$
{
$_
[
0
]}
=~
s/==/!=/
},
"
$var
== NULL
");
}
...
...
@@ -248,11 +249,12 @@ CODE
}
elsif
(
$pdbtype
eq
'
tattoo
')
{
$result
.=
&make_arg_test
(
$_
,
sub
{
$
{
$_
[
0
]}
=~
s/==/!=/
},
'
$var == 0
'
);
"
$var
== 0
"
);
}
elsif
(
$pdbtype
eq
'
unit
')
{
$typeinfo
[
0
]
=
'
UNIT_PIXEL
'
unless
defined
$typeinfo
[
0
];
$result
.=
&make_arg_test
(
$_
,
sub
{
$
{
$_
[
0
]}
=
"
!(
${
$
_
[0]
}
)
"
},
"
$var
<
UNIT_PIXEL
||
$var
>=
"
.
"
$var
<
$typeinfo
[0]
||
$var
>=
"
.
'
gimp_unit_get_number_of_units ()
');
}
elsif
(
$pdbtype
eq
'
enum
'
&&
!
$enums
{
$typeinfo
[
0
]}
->
{
contig
})
{
...
...
@@ -395,7 +397,15 @@ CODE
$argc
++
;
$outargs
.=
'
'
x
2
;
if
(
exists
$arg
->
{
id_ret_func
})
{
$var
=
eval
qq/"$arg->{id_ret_func}"/
;
my
$ret
=
eval
qq/"$arg->{id_ret_func}"/
;
$ret
=
eval
qq/"$_->{id_ret_func}"/
if
exists
$_
->
{
id_ret_func
};
if
(
exists
$_
->
{
return_fail
})
{
$var
=
"
$var
?
$ret
:
$_
->{return_fail}
";
}
else
{
$var
=
$ret
;
}
}
$outargs
.=
"
return_args[
$argc
].value.pdb_
$type
=
$var
;
\n
";
...
...
@@ -688,7 +698,7 @@ HEADER
print
IFILE
"
void
$_
"
.
'
'
x
(
$longest
-
length
$_
)
.
"
(void);
\n
";
}
chop
$group_procs
;
print
IFILE
"
\n
/*
$total
total
procedures registered total */
\n\n
";
print
IFILE
"
\n
/*
$total
procedures registered total */
\n\n
";
print
IFILE
"
void
\n
internal_procs_init (void)
\n
{
\n
$group_procs
}
\n
";
close
IFILE
;
&write_file
(
$internal
);
...
...
tools/pdbgen/enums.pl
View file @
26e21fc7
...
...
@@ -82,26 +82,36 @@ package Gimp::CodeGen::enums;
GRAY
=>
'
1
',
INDEXED
=>
'
2
'
}
},
GuideOrientation
=>
{
contig
=>
1
,
header
=>
'
gimpimage.h
',
symbols
=>
[
qw(HORIZONTAL_GUIDE VERTICAL_GUIDE)
],
mapping
=>
{
HORIZONTAL_GUIDE
=>
'
0
',
VERTICAL_GUIDE
=>
'
1
'
},
nicks
=>
{
HORIZONTAL_GUIDE
=>
'
HORIZONTAL
',
VERTICAL_GUIDE
=>
'
VERTICAL
'
}
},
ChannelType
=>
{
contig
=>
1
,
header
=>
'
gimpimage.h
',
symbols
=>
[
qw(Red Green Blue Gray Indexed Auxillary)
],
mapping
=>
{
Red
=>
'
0
',
Green
=>
'
1
',
Blue
=>
'
2
',
Gray
=>
'
3
',
Indexed
=>
'
4
',
Auxillary
=>
'
5
'
}
symbols
=>
[
qw(RED_CHANNEL GREEN_CHANNEL BLUE_CHANNEL
GRAY_CHANNEL INDEXED_CHANNEL AUXILLARY_CHANNEL)
],
mapping
=>
{
RED_CHANNEL
=>
'
0
',
GREEN_CHANNEL
=>
'
1
',
BLUE_CHANNEL
=>
'
2
',
GRAY_CHANNEL
=>
'
3
',
INDEXED_CHANNEL
=>
'
4
',
AUXILLARY_CHANNEL
=>
'
5
'
}
},
MergeType
=>
{
contig
=>
1
,
header
=>
'
gimpimage.h
',
symbols
=>
[
qw(E
xpandAsNecessary ClipToImage ClipToBottomLayer
FlattenImage
)
],
mapping
=>
{
E
xpandAsNecessary
=>
'
0
',
C
lipToImage
=>
'
1
',
C
lipToBottomLayer
=>
'
2
',
F
lattenImage
=>
'
3
'
}
symbols
=>
[
qw(E
XPAND_AS_NECESSARY CLIP_TO_IMAGE
CLIP_TO_BOTTOM_LAYER FLATTEN_IMAGE
)
],
mapping
=>
{
E
XPAND_AS_NECESSARY
=>
'
0
',
C
LIP_TO_IMAGE
=>
'
1
',
C
LIP_TO_BOTTOM_LAYER
=>
'
2
',
F
LATTEN_IMAGE
=>
'
3
'
}
},
PDBArgType
=>
{
contig
=>
1
,
...
...
@@ -192,8 +202,8 @@ package Gimp::CodeGen::enums;
DIFFERENCE_MODE
=>
'
DIFFERENCE
',
ADDITION_MODE
=>
'
ADDITION
',
SUBTRACT_MODE
=>
'
SUBTRACT
',
DARKEN_ONLY_MODE
=>
'
DARKEN
-
ONLY
',
LIGHTEN_ONLY_MODE
=>
'
LIGHTEN
-
ONLY
',
DARKEN_ONLY_MODE
=>
'
DARKEN
_
ONLY
',
LIGHTEN_ONLY_MODE
=>
'
LIGHTEN
_
ONLY
',
HUE_MODE
=>
'
HUE
',
SATURATION_MODE
=>
'
SATURATION
',
COLOR_MODE
=>
'
COLOR
',
...
...
@@ -360,6 +370,13 @@ package Gimp::CodeGen::enums;
nicks
=>
{
ADD_WHITE_MASK
=>
'
WHITE_MASK
',
ADD_BLACK_MASK
=>
'
BLACK_MASK
',
ADD_ALPHA_MASK
=>
'
ALPHA_MASK
'
}
},
MaskApplyMode
=>
{
contig
=>
1
,
header
=>
'
layer.h
',
symbols
=>
[
qw(APPLY DISCARD)
],
mapping
=>
{
APPLY
=>
'
0
',
DISCARD
=>
'
1
'
}
}
);
...
...
tools/pdbgen/groups.pl
View file @
26e21fc7
...
...
@@ -19,4 +19,5 @@
@groups
=
qw(gdisplay edit floating_sel undo palette gradient convert
channel_ops gimprc drawable parasite paths gradient_select
unit procedural_db brushes text_tool brush_select color
misc tools channel patterns pattern_select layer gimage_mask)
;
misc tools channel patterns pattern_select layer gimage_mask
gimage guides)
;
tools/pdbgen/pdb.pl
View file @
26e21fc7
...
...
@@ -33,39 +33,44 @@ package Gimp::CodeGen::pdb;
color
=>
{
name
=>
'
COLOR
'
,
type
=>
'
guchar *
'
},
display
=>
{
name
=>
'
DISPLAY
',
type
=>
'
GDisplay *
',
headers
=>
[
qw("gdisplay.h")
],
id_func
=>
'
gdisplay_get_ID
',
id_ret_func
=>
'
$var->ID
'
},
image
=>
{
name
=>
'
IMAGE
',
type
=>
'
GimpImage *
',
headers
=>
[
qw("procedural_db.h")
],
id_func
=>
'
pdb_id_to_image
',
id_ret_func
=>
'
pdb_image_to_id ($var)
'
},
layer
=>
{
name
=>
'
LAYER
',
type
=>
'
GimpLayer *
',
headers
=>
[
qw("drawable.h" "layer.h")
],
id_func
=>
'
layer_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
channel
=>
{
name
=>
'
CHANNEL
',
type
=>
'
Channel *
',
headers
=>
[
qw("drawable.h" "channel.h")
],
id_func
=>
'
channel_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
drawable
=>
{
name
=>
'
DRAWABLE
',
type
=>
'
GimpDrawable *
',
headers
=>
[
qw("drawable.h")
],
id_func
=>
'
gimp_drawable_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
selection
=>
{
name
=>
'
SELECTION
',
type
=>
'
Channel *
',
headers
=>
[
qw("drawable.h" "channel.h")
],
id_func
=>
'
channel_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
parasite
=>
{
name
=>
'
PARASITE
',
type
=>
'
Parasite *
',
headers
=>
[
qw("libgimp/parasite.h")
]
},
display
=>
{
name
=>
'
DISPLAY
',
type
=>
'
GDisplay *
',
headers
=>
[
qw("gdisplay.h")
],
id_func
=>
'
gdisplay_get_ID
',
id_ret_func
=>
'
$var->ID
'
},
image
=>
{
name
=>
'
IMAGE
',
type
=>
'
GimpImage *
',
headers
=>
[
qw("procedural_db.h")
],
id_func
=>
'
pdb_id_to_image
',
id_ret_func
=>
'
pdb_image_to_id ($var)
'
},
layer
=>
{
name
=>
'
LAYER
',
type
=>
'
GimpLayer *
',
headers
=>
[
qw("drawable.h" "layer.h")
],
id_func
=>
'
layer_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
channel
=>
{
name
=>
'
CHANNEL
',
type
=>
'
Channel *
',
headers
=>
[
qw("drawable.h" "channel.h")
],
id_func
=>
'
channel_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
drawable
=>
{
name
=>
'
DRAWABLE
',
type
=>
'
GimpDrawable *
',
headers
=>
[
qw("drawable.h")
],
id_func
=>
'
gimp_drawable_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
selection
=>
{
name
=>
'
SELECTION
',
type
=>
'
Channel *
',
headers
=>
[
qw("drawable.h" "channel.h")
],
id_func
=>
'
channel_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
layer_mask
=>
{
name
=>
'
CHANNEL
',
type
=>
'
LayerMask *
',
headers
=>
[
qw("drawable.h" "channel.h")
],
id_func
=>
'
layer_mask_get_ID
',
id_ret_func
=>
'
drawable_ID (GIMP_DRAWABLE ($var))
'
},
parasite
=>
{
name
=>
'
PARASITE
',
type
=>
'
Parasite *
',
headers
=>
[
qw("libgimp/parasite.h")
]
},
boundary
=>
{
name
=>
'
BOUNDARY
',
type
=>
'
gpointer
'
},
# ??? FIXME
path
=>
{
name
=>
'
PATH
'
,
type
=>
'
gpointer
'
},
# ??? FIXME
...
...
@@ -75,6 +80,7 @@ package Gimp::CodeGen::pdb;
enum
=>
{
name
=>
'
INT32
',
type
=>
'
gint32
'
},
boolean
=>
{
name
=>
'
INT32
',
type
=>
'
gboolean
'
},
tattoo
=>
{
name
=>
'
INT32
',
type
=>
'
gint32
'
},
guide
=>
{
name
=>
'
INT32
',
type
=>
'
gint32
'
},
unit
=>
{
name
=>
'
INT32
',
type
=>
'
GUnit
'
},
region
=>
{
name
=>
'
REGION
',
type
=>
'
gpointer
'
}
# not supported
...
...
@@ -109,6 +115,11 @@ sub arg_parse {
return
@retvals
;
}
elsif
(
$arg
=~
/^unit(?: \(min (.*?)\))?/
)
{
my
@retvals
=
('
unit
');
push
@retvals
,
$
1
if
$
1
;
return
@retvals
;
}
elsif
(
$arg
=~
/^
(?:([
+-.\
d
][
^\
s]*) \s* (<=|<))?
\s* (\w+) \s*
(?:(<=|<) \s* ([+-.\d][^\s]
*
))?
...
...
tools/pdbgen/pdb/channel.pdb
View file @
26e21fc7
...
...
@@ -231,10 +231,10 @@ HELP
$author = $copyright = 'Jay Cox';
$date = '1998';
CODE
$#procs--;
@headers = qw("channel.h" "channel_pvt.h");
$#procs--;
unshift @procs, qw(channel_new channel_copy channel_delete);
%exports = (app => [@procs]);
...
...
tools/pdbgen/pdb/gimage.pdb
0 → 100644
View file @
26e21fc7
This diff is collapsed.
Click to expand it.
tools/pdbgen/pdb/guides.pdb
0 → 100644
View file @
26e21fc7
# The GIMP -- an image manipulation program
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub pdb_misc {
$author = $copyright = 'Adam D. Moss';
$date = '1998';
}
sub image_add_guide {
my ($desc, $type, $max, $pos) = @_;
$blurb = "Add a $desc guide to an image.";
$help = <<HELP;
This procedure adds a $desc guide to an image. It takes the input image and the
$type-position of the new guide as parameters. It returns the guide ID of the
new guide.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => "${type}position", type => '0 < int32',
desc => "The guide's ${type}-offset from $pos of image",
alias => 'offset' }
);
@outargs = (
{ name => 'guide_id', type => 'guide', init => 1,
desc => 'The new guide' }
);
my $func = substr($desc, 0, 1);
%invoke = (
vars => [ 'Guide *guide' ],
code => <<CODE
{
if (offset < gimage->$max)
{
guide = gimp_image_add_${func}guide (gimage);
guide->position = offset;
guide_id = guide->guide_ID;
}
else
success = FALSE;
}
CODE
);
}
# The defs
sub image_add_hguide {
&image_add_guide('horizontal', 'y', 'height', 'top');
}
sub image_add_vguide {
&image_add_guide('vertical', 'x', 'width', 'left');
}
sub image_delete_guide {
$blurb = 'Deletes a guide from an image.';
$help = <<'HELP';
This procedure takes an image and a guide ID as input and removes the specified
guide from the specified image.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'guide', type => 'guide',
desc => 'The ID of the guide to be removed' }
);
%invoke = (
headers => [ qw("undo.h") ],
vars => [ 'GList *guides' ],
code => <<'CODE'
{
success = FALSE;
guides = gimage->guides;
while (guides)
{
if ((((Guide *) guides->data)->guide_ID == guide) &&
(((Guide *) guides->data)->position >= 0))
{
GList *tmp_next;
success = TRUE;
tmp_next = guides->next;
((Guide *) guides->data)->position = -1;
undo_push_guide (gimage, ((Guide *) guides->data));
/* gimp_image_remove_guide (gimage, ((Guide *) guides->data)); */
guides = tmp_next;
}
else
guides = guides->next;
}
}
CODE
);
}
sub image_find_next_guide {
$blurb = 'Find next guide on an image.';
$help = <<'HELP';
This procedure takes an image and a guide ID as input and finds the guide ID of
the successor of the given guide ID in the image's guide list. If the supplied
guide ID is 0, the procedure will return the first Guide. The procedure will
return 0 if given the final guide ID as an argument or the image has no guides.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'guide', type => 'guide',
desc => 'The ID of the current guide (0 if first invocation)' }
);
@outargs = (
{ name => 'next_guide', type => 'guide', init => 1,
desc => "The next guide's ID" }
);
%invoke = (
vars => [ 'GList *guides' ],
code => <<'CODE'
{
guides = gimage->guides;
if (guides != NULL)
{
if (guide == 0) /* init - Return first guide ID in list */
{
while (guides && (((Guide *) guides->data)->position < 0))
guides = guides->next;
if (guides) /* didn't just come to end of list */
next_guide = ((Guide *) guides->data)->guide_ID;
}
else
{
success = FALSE;
while (guides)
{
if ((((Guide *) guides->data)->guide_ID == guide) &&
(((Guide *) guides->data)->position >= 0))
{
GList* tmplist;
success = TRUE;
tmplist = guides->next;
while (tmplist && (((Guide *) tmplist->data)->position < 0))
tmplist = tmplist->next;
if (tmplist);
next_guide = ((Guide *) tmplist->data)->guide_ID;
break;
}
guides = guides->next;
}
}
}
}
CODE
);
}
sub image_get_guide_orientation {
$blurb = 'Get orientation of a guide on an image.';
$help = <<'HELP';
This procedure takes an image and a guide ID as input and returns the
orientations of the guide.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'guide', type => 'guide',
desc => 'The guide' }
);
@outargs = (
{ name => 'orientation', type => 'enum GuideOrientation', init => 1,
desc => "The guide's orientation: { %%desc%% }" }
);
%invoke = (
vars => [ 'GList *guides' ],
code => <<'CODE'
{
guides = gimage->guides;
success = FALSE;
while (guides)
{
if ((((Guide *) guides->data)->guide_ID == guide) &&
(((Guide *) guides->data)->position >= 0))
{
orientation = ((Guide *) guides->data)->orientation;
success = TRUE;
break;
}
guides = guides->next;
}
}
CODE
);
}
sub image_get_guide_position {
$blurb = 'Get position of a guide on an image.';
$help = <<'HELP';
This procedure takes an image and a guide ID as input and returns the position
of the guide relative to the top or left of the image.
HELP
&pdb_misc;
@inargs = (
&std_image_arg,
{ name => 'guide', type => 'guide',
desc => 'The guide' }
);
@outargs = (
{ name => 'position', type => 'int32', init => 1,
desc => "The guide's position relative to top or left of image" }
);
%invoke = (
vars => [ 'GList *guides' ],
code => <<'CODE'
{
guides = gimage->guides;
success = FALSE;
while (guides)
{
if ((((Guide *) guides->data)->guide_ID == guide) &&
(((Guide *) guides->data)->position >= 0))
{
position = ((Guide *) guides->data)->position;
success = TRUE;
break;
}
guides = guides->next;
}
}
CODE
);
}
@headers = qw("gimage.h");
@procs = qw(image_add_hguide image_add_vguide image_delete_guide
image_find_next_guide image_get_guide_orientation
image_get_guide_position);
%exports = (app => [@procs]);
$desc = 'Guide procedures';
1;
tools/pdbgen/pdb/image.pdb
0 → 100644
View file @
26e21fc7
This diff is collapsed.
Click to expand it.
tools/pdbgen/pdb/layer.pdb
View file @
26e21fc7
...
...
@@ -425,8 +425,7 @@ sub layer_mask {
$blurb = "Get the specified layer's mask if it exists.";
$help = <<'HELP';
This procedure returns the specified layer's mask. If there is no layer mask,
the procedure fails.
This procedure returns the specified layer's mask, or -1 if none exists.
HELP
&std_pdb_misc;
...
...
@@ -436,10 +435,9 @@ HELP
@outargs = (
{ name => 'mask', type => 'channel',
desc => 'The layer mask',
alias => 'layer->mask', no_declare => 1 }
alias => 'layer->mask', no_declare => 1,
return_fail => -1 }
);
%invoke = ( code => 'success = layer->mask ? TRUE : FALSE;' );
}
sub layer_is_floating_sel {
...
...
@@ -543,10 +541,10 @@ HELP
$author = $copyright = 'Jay Cox';
$date = '1998';
CODE
$#procs--;
@headers = qw("layer.h" "layer_pvt.h");
$#procs--;
unshift @procs, qw(layer_new layer_copy layer_create_mask layer_scale
layer_resize layer_delete layer_translate layer_add_alpha
layer_set_offsets layer_mask layer_is_floating_sel);
...
...
tools/pdbgen/pdb/parasite.pdb
View file @
26e21fc7
...
...
@@ -17,11 +17,9 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
# The defs
sub pdb_misc {
$author = $copyright = 'Jay Cox';
$date = 1998;
$date =
'
1998
'
;
}
sub name_arg {{
...
...
@@ -44,15 +42,20 @@ sub drawable_arg () {{
desc => 'The drawable'
}}
sub drawable_convert {
foreach ($blurb, $help, $inargs[0]->{desc}) { s/the gimp/a drawable/ }
sub convert_proc {
my ($type, $arg, $var) = @_;
my $desc = ($type =~ /^[aeiou]/ ? 'an ' : 'a ') . $type;
foreach ($blurb, $help, $inargs[0]->{desc}) { s/the gimp/$desc/e }
unshift @inargs,
&drawable_
arg;
unshift @inargs,
$
arg;
$invoke{code} =~ s/gimp/gimp_
drawable/
;
$invoke{code} =~ s/\(((?!gimp).*?(?:parasite|name))/
(drawable
, $1
/
;
$invoke{code} =~ s/gimp/
"
gimp_
$type"/e
;
$invoke{code} =~ s/\(((?!gimp).*?(?:parasite|name))/
"($var
, $1
"/e
;
}
# The defs
sub parasite_new {
$blurb = 'Creates a new parasite.';