#
#	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
