package SDL::Tool::Graphic;
+use strict;
+use warnings;
+use Carp;
use SDL;
use SDL::Config;
require SDL::Surface;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
- $self = {};
+ my $self = {};
bless $self, $class;
$self;
}
sub zoom {
my ( $self, $surface, $zoomx, $zoomy, $smooth) = @_;
- die "SDL::Tool::Graphic::zoom requires an SDL::Surface\n"
+ croak "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);
sub rotoZoom {
my ( $self, $surface, $angle, $zoom, $smooth) = @_;
- die "SDL::Tool::Graphic::rotoZoom requires an SDL::Surface\n"
+ croak "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);
sub grayScale {
my ( $self, $surface ) = @_;
+ my $workingSurface;
if($surface->isa('SDL::Surface')) {
- $workingSurface = $$surface;
+ $workingSurface = $$surface;
} else {
$workingSurface = $surface;
}
sub invertColor {
my ( $self, $surface ) = @_;
+ my $workingSurface;
if($surface->isa('SDL::Surface')) {
$workingSurface = $$surface;
} else {
}
}
-die "SDL::Tool::Graphic requires SDL_gfx support\n"
+croak "SDL::Tool::Graphic requires SDL_gfx support\n"
unless SDL::Config->has('SDL_gfx');