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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#
# SDL::GraphicTool - zooming and rotating graphic tool
#
# Copyright (C) 2002 Russell E. Valentine
# Copyright (C) 2002 David J. Goehrig
package SDL::Tool::Graphic;
use SDL;
require SDL::Surface;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
$self = {};
bless $self, $class;
$self;
}
sub DESTROY {
# nothing to do
}
sub zoom {
my ( $self, $surface, $zoomx, $zoomy, $smooth) = @_;
die "SDL::Tool::Graphic::zoom requires an SDL::Surface\n"
unless ( ref($surface) && $surface->isa('SDL::Surface'));
my $tmp = $$surface;
$$surface = SDL::GFXZoom($$surface, $zoomx, $zoomy, $smooth);
SDL::FreeSurface($tmp);
$surface;
}
sub rotoZoom {
my ( $self, $surface, $angle, $zoom, $smooth) = @_;
die "SDL::Tool::Graphic::rotoZoom requires an SDL::Surface\n"
unless ( ref($surface) && $surface->isa('SDL::Surface'));
my $tmp = $$surface;
$$surface = SDL::GFXRotoZoom($$surface, $angle, $zoom, $smooth);
SDL::FreeSurface($tmp);
$surface;
}
1;
__END__;
=pod
=head1 NAME
SDL::Tool::Graphic
=head1 DESCRIPTION
L<SDL::Tool::Graphic> is a module for zooming and rotating L<SDL::Surface> objects.
=head1 METHODS
=head2 zoom ( surface, xzoom, yzoom, smooth )
C<SDL::Tool::Graphic::zoom> scales a L<SDL::Surface> along the two axis independently,
and returns a new L<SDL::Surface> object.
=head2 rotoZoom ( surface, angle, zoom, smooth )
C<SDL::Tool::Graphic::rotoZoom> rotates and fixed axis zooms a L<SDL::Surface>
and returns a new L<SDL::Surface> object.
=head1 AUTHOR
Russell E. Valentine
=head1 SEE ALSO
L<perl> L<SDL::Surface>
=cut
|