Added CreateRGBSurfaceFrom as an new constructor of SDL::Surface. Need to test it
Kartik Thakore [Sat, 31 Oct 2009 00:21:36 +0000 (20:21 -0400)]
src/Core/objects/Surface.xs
t/core_surface.t
t/core_video.t

index d0e96ac..74f5244 100644 (file)
@@ -45,6 +45,30 @@ surface_new (CLASS, flags, width, height, depth, Rmask, Gmask, Bmask, Amask )
        OUTPUT:
                RETVAL
 
+SDL_Surface *
+surface_new_from (CLASS, pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask )
+       char *CLASS
+       char *pixels
+       int width
+       int height
+       int depth
+       int pitch
+       Uint32 Rmask
+       Uint32 Gmask
+       Uint32 Bmask
+       Uint32 Amask
+       CODE:
+               void* pixeldata;
+               int len = pitch * height;
+               Newx(pixeldata,len,Uint8);
+               Copy(pixels,pixeldata,len,Uint8);
+               RETVAL = SDL_CreateRGBSurfaceFrom ( pixeldata, width, height,
+                               depth, pitch, Rmask, Gmask, Bmask, Amask );
+       OUTPUT: 
+               RETVAL
+
+
+
 SDL_PixelFormat *
 surface_format ( surface )
        SDL_Surface *surface
index 51913df..e006f60 100644 (file)
@@ -21,6 +21,7 @@ use Test::More tests => 35;
 
 my $surface
     = SDL::Surface->new( SDL::SDL_ANYFORMAT(), 640, 320, 8, 0, 0, 0, 0 );
+    #TODO: test SDL::Surface->new_from
 isa_ok( $surface, 'SDL::Surface' );
 is( $surface->w,     640, 'surface has width' );
 is( $surface->h,     320, 'surface has height' );
index 249a244..dcce70b 100644 (file)
@@ -123,7 +123,6 @@ my @left = qw/
        get_gamma_ramp
        get_RGB
        get_RGBA
-       create_RGB_surface_from
        convert_surface
        display_format
        display_format_alpha