Skip to content
GitLab
Menu
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
01e69ec1
Commit
01e69ec1
authored
Mar 06, 1999
by
Marc Lehmann
Browse files
see plug-ins/perl/Changes
parent
1a82edc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
plug-ins/perl/Changes
View file @
01e69ec1
Revision history for Gimp-Perl extension.
- added new convinience functions to Gimp::Util.
1.06 Sat Mar 6 19:36:12 CET 1999
- Gimp::Fu does no longer display the returned image when it
is the same as the one passed in.
...
...
plug-ins/perl/Gimp/Util.pm
View file @
01e69ec1
...
...
@@ -46,7 +46,7 @@ require Exporter;
)
;
#@EXPORT_OK = qw();
$VERSION
=
1.
00
1
;
$VERSION
=
1.1
;
use
Gimp
;
...
...
@@ -241,6 +241,21 @@ sub gimp_text_wh {
returns the corresponding layer type for an image, alpha controls wether the layer type
is with alpha or not. Example: imagetype: RGB -> RGB_IMAGE (or RGBA_IMAGE).
=item C<gimp_image_add_new_layer $image,$index,$fill_type,$alpha>
creates a new layer and adds it at position $index (default 0) to the
image, after filling it with gimp_drawable_fill $fill_type (default
BG_IMAGE_FILL). If $alpha is non-zero (default 1), the new layer has
alpha.
=item C<gimp_image_set_visible @layers>, C<gimp_image_set_invisible @layers>
mark the given layers visible (invisible) and all others invisible (visible).
=item C<gimp_layer_get_position $layer>
return the position the layer has in the image layer stack.
=cut
sub
gimp_image_layertype
{
my
$type
=
$_
[
0
]
->
base_type
;
...
...
@@ -250,6 +265,41 @@ sub gimp_image_layertype {
die
;
}
sub
gimp_image_add_new_layer
{
my
(
$image
,
$index
,
$filltype
,
$alpha
)
=
@_
;
my
$layer
=
new
Layer
(
$image
,
$image
->
width
,
$image
->
height
,
$image
->
layertype
(
defined
$alpha
?
$alpha
:
1
),
join
("
:
",(
caller
)[
1
,
2
]),
100
,
NORMAL_MODE
);
$layer
->
fill
(
defined
$filltype
?
$filltype
:
BG_IMAGE_FILL
);
$image
->
add_layer
(
$layer
,
$index
*
1
);
$layer
;
}
sub
gimp_image_set_visible
{
my
$image
=
shift
;
my
%layers
;
@layers
{
map
$
$_
,
@
_
}
++
;
for
(
$image
->
get_layers
)
{
$_
->
set_visible
(
$layers
{
$
$_
});
}
}
sub
gimp_image_set_invisible
{
my
$image
=
shift
;
my
%layers
;
@layers
{
map
$
$_
,
@
_
}
++
;
for
(
$image
->
get_layers
)
{
$_
->
set_visible
(
!
$layers
{
$
$_
});
}
}
sub
gimp_layer_get_position
{
my
$layer
=
shift
;
my
@layers
=
$layer
->
image
->
get_layers
;
for
(
0
..
$#layers
)
{
return
$_
if
$
{
$layers
[
$_
]}
==
$$layer
;
}
();
}
=
pod
=
back
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment