Fixed up the test for video_set_colors
[sdlgit/SDL_perl.git] / lib / SDL / Surface.pm
index 5ba31f6..0d58261 100644 (file)
@@ -1,3 +1,15 @@
+package SDL::Surface;
+use strict;
+use warnings;
+require Exporter;
+require DynaLoader;
+our @ISA = qw(Exporter DynaLoader);
+bootstrap SDL::Surface;
+
+1;
+
+__END__
+
 #!/usr/bin/env perl
 #
 # Surface.pm
@@ -166,7 +178,7 @@ sub fill {
        if ($_[1] == 0 ) {
                SDL::FillRect(${$_[0]},0,${$_[2]});
        } else {
-               SDL::FillRect(${$_[0]},$_[1],${$_[2]});
+               SDL::FillRect(${$_[0]},$_[1],$_[2]);
        }
 }
 
@@ -208,7 +220,9 @@ sub blit {
                croak "SDL::Surface::blit requires SDL::Surface objects"
                        unless $_[2]->isa('SDL::Surface'); 
        }
-               SDL::BlitSurface( $_[0], $_[1], ${$_[2]}, $_[3]);
+       #BlitSurface ( src, src_rect, dest, dest_rect )
+
+               SDL::BlitSurface( ${$_[0]}, $_[1], ${$_[2]}, $_[3]);
 }
 
 sub set_colors {
@@ -239,6 +253,14 @@ sub display_format {
        $self;
 }
 
+sub display_format_alpha {
+       my $self = shift;
+       my $tmp = SDL::DisplayFormatAlpha($$self);
+       SDL::FreeSurface ($$self);
+       $$self = $tmp;
+       $self;
+}
+
 sub rgb {
        my $self = shift;
        my $tmp = SDL::ConvertRGB($$self);
@@ -525,13 +547,18 @@ C<alpha> takes a value from 0x00 to 0xff.
 C<SDL::Surface::display_format> converts the surface to the same format as the
 current screen.
 
+=head2 display_format_alpha ()
+
+C<SDL::Surface::display_format_alpha> converts the surface to the same format as the
+current screen, plus an alpha channel.
+
 =head2 rgb ()
-C<SDL::Surface::rgb> converts the surface to a 24 bit rgb format regardless of the 
-initial format.
+
+C<SDL::Surface::rgb> converts the surface to a 24 bit rgb format regardless of the initial format.
 
 =head2 rgba ()
-C<SDL::Surface::rgba> converts the surface to a 32 bit rgba format regarless of the
-initial format.
+
+C<SDL::Surface::rgba> converts the surface to a 32 bit rgba format regarless of the initial format.
 
 =head2 print (x,y,text...)