gimp/plug-ins/perl/examples/layerfuncs

33 lines
1021 B
Plaintext
Raw Normal View History

2000-03-28 21:30:29 +08:00
#!/usr/app/bin/perl -w
eval 'exec /usr/app/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
1999-11-09 01:39:13 +08:00
# <sjburges@gimp.org>
use Gimp;
use Gimp::Fu;
use Gimp::Util;
# Gimp::set_trace(TRACE_ALL);
# 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.
2000-03-11 22:12:48 +08:00
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();
};
1999-11-09 01:39:13 +08:00
register "center_layer", "Center Layer",
"Centers the current layer on the image",
"Seth Burgess", "Seth Burgess <sjburges\@gimp.org>",
2000-03-11 22:12:48 +08:00
"1.0", N_"<Image>/Layers/Center Layer", "*", [], sub {
1999-11-09 01:39:13 +08:00
($img, $layer) = @_;
$layer->set_offsets(($img->width - $layer->width )/2,
($img->height - $layer->height)/2);
return();
};
exit main;