File: layerfuncs

package info (click to toggle)
libgimp-perl 2.0.dfsg-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,112 kB
  • ctags: 462
  • sloc: perl: 10,026; sh: 207; ansic: 207; makefile: 70
file content (46 lines) | stat: -rwxr-xr-x 1,313 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/opt/bin/perl -w

eval 'exec /opt/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell
# <sjburges@gimp.org>
use Gimp;
use Gimp::Fu;
use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);

# 7/15/03: <sjburges@gimp.org>
# * s/Layers/Layer/ in registration
# * remove layer_to_image_size, since its in core now
#
# These are a couple of one-liners that you might find handy.  Both should
# be undoable w/o any special magick, and work with any gimp.

# No reason to register this now - its equivalent in C is present now.
#
# register "layer_to_image_size", "Layer2ImageSize", "Expands layer to image size",
#         "Seth Burgess", "Seth Burgess <sjburges\@gimp.org>", "1.0",
#         "<None>", "*", [ ], sub {
#   ($img, $layer) = @_;
#   $layer->resize($img->width, $img->height, $layer->offsets);
#   return();
#};

register "center_layer", "Center Layer", 
         "Centers the current layer on the image", 
         "Seth Burgess", "Seth Burgess <sjburges\@gimp.org>", 
         "1.0", N_"<Image>/Layer/Center Layer", "*", [], sub {
	($img, $layer) = @_;
	$layer->set_offsets(($img->width  - $layer->width )/2, 
                        ($img->height - $layer->height)/2);
	return();
};

exit main;

=head1 LICENSE

Copyright Seth Burgess.  
Distrubuted under the same terms as Gimp-Perl.

=cut