Expose SDL::MapRGB
[sdlgit/SDL_perl.git] / src / SDL.xs
index a415673..6e07fe1 100644 (file)
@@ -858,22 +858,22 @@ GetKeyName ( sym )
        OUTPUT:
                RETVAL
 
+#ifdef HAVE_SDL_IMAGE
+
 SDL_Surface *
-CreateRGBSurface (flags, width, height, depth, Rmask, Gmask, Bmask, Amask )
-       Uint32 flags
-       int width
-       int height
-       int depth
-       Uint32 Rmask
-       Uint32 Gmask
-       Uint32 Bmask
-       Uint32 Amask
+IMG_Load ( filename )
+       char *filename
        CODE:
-               RETVAL = SDL_CreateRGBSurface ( flags, width, height,
-                               depth, Rmask, Gmask, Bmask, Amask );
-       OUTPUT: 
+               char* CLASS = "SDL::Surface";
+               RETVAL = IMG_Load(filename);
+       OUTPUT:
                RETVAL
 
+#endif
+
+=for comment
+
+Comment out for now as it does not compile
 
 SDL_Surface *
 CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask )
@@ -896,18 +896,6 @@ CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask,
        OUTPUT: 
                RETVAL
 
-#ifdef HAVE_SDL_IMAGE
-
-SDL_Surface *
-IMGLoad ( fname )
-       char *fname
-       CODE:
-               RETVAL = IMG_Load(fname);
-       OUTPUT:
-               RETVAL
-
-#endif
-
 SDL_Surface*
 SurfaceCopy ( surface )
        SDL_Surface *surface
@@ -1079,6 +1067,8 @@ SurfacePixels ( surface )
        OUTPUT:
                RETVAL
 
+=cut
+
 =for comment
 
 Comment out for now as it does not compile
@@ -1147,8 +1137,6 @@ SurfacePixel ( surface, x, y, ... )
        OUTPUT:
                RETVAL
 
-=cut
-
 int
 MUSTLOCK ( surface )
        SDL_Surface *surface
@@ -1178,6 +1166,7 @@ GetVideoSurface ()
        OUTPUT:
                RETVAL
 
+=cut
 
 HV *
 VideoInfo ()
@@ -1251,6 +1240,50 @@ PaletteNColors ( palette, ... )
        OUTPUT:
                RETVAL
 
+SDL_Surface *
+SetVideoMode ( width, height, bpp, flags )
+
+       int width
+       int height
+       int bpp
+       Uint32 flags
+
+       CODE:
+               char *CLASS = "SDL::Surface";
+               RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
+       OUTPUT:
+               RETVAL
+
+int
+Flip ( surface )
+       SDL_Surface *surface
+       CODE:
+               RETVAL = SDL_Flip(surface);
+       OUTPUT:
+               RETVAL
+
+int
+BlitSurface ( src, src_rect, dest, dest_rect )
+       SDL_Surface *src
+       SDL_Surface *dest
+       SDL_Rect *src_rect
+       SDL_Rect *dest_rect
+       CODE:
+               RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
+       OUTPUT:
+               RETVAL
+
+Uint32
+MapRGB ( pixel_format, r, g, b )
+       SDL_PixelFormat *pixel_format
+       Uint8 r
+       Uint8 g
+       Uint8 b
+       CODE:
+               RETVAL = SDL_MapRGB(pixel_format,r,g,b);
+       OUTPUT:
+               RETVAL
+
 =for comment
 
 Comment out for now as it does not compile
@@ -1269,7 +1302,7 @@ PaletteColors ( palette, index, ... )
        OUTPUT:
                RETVAL
 
-=cut
+
 
 int
 VideoModeOK ( width, height, bpp, flags )
@@ -1311,7 +1344,7 @@ UpdateRects ( surface, ... )
                int num_rects,i;
                if ( items < 2 ) return;
                num_rects = items - 1;
-                       
+               SDL_UpdateRects(surface,num_rects,rects);                       
                rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
                for(i=0;i<num_rects;i++) {
                        temp = (SDL_Rect *)SvIV(ST(i+1));
@@ -1322,7 +1355,6 @@ UpdateRects ( surface, ... )
                } 
                SDL_UpdateRects(surface,num_rects,rects);
                safefree(rects);
-               
 
 int
 Flip ( surface )
@@ -1355,17 +1387,6 @@ all_done:
                RETVAL
 
 Uint32
-MapRGB ( surface, r, g, b )
-       SDL_Surface *surface
-       Uint8 r
-       Uint8 g
-       Uint8 b
-       CODE:
-               RETVAL = SDL_MapRGB(surface->format,r,g,b);
-       OUTPUT:
-               RETVAL
-
-Uint32
 MapRGBA ( surface, r, g, b, a )
        SDL_Surface *surface
        Uint8 r
@@ -1504,19 +1525,7 @@ ConvertRGBA ( surface )
        OUTPUT:
                RETVAL
 
-int
-BlitSurface ( src, src_rect, dest, dest_rect )
-       SDL_Surface *src
-
-       SDL_Surface *dest
-
-       SDL_Rect *src_rect
-
-       SDL_Rect *dest_rect
-       CODE:
-               RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
-       OUTPUT:
-               RETVAL
+=cut
 
 int
 FillRect ( dest, dest_rect, color )
@@ -2949,6 +2958,8 @@ TTFSizeUNICODE ( font, text )
        OUTPUT:
                RETVAL
 
+=for comment
+
 SDL_Surface*
 TTFRenderTextSolid ( font, text, fg )
        TTF_Font *font
@@ -3172,6 +3183,8 @@ TTFPutString ( font, mode, surface, x, y, fg, bg, text )
        OUTPUT:
                RETVAL
 
+=cut
+
 #endif
 
 SDL_Overlay*
@@ -3611,6 +3624,8 @@ SMPEGGetInfo ( mpeg )
 
 #ifdef HAVE_SDL_GFX
 
+=cut
+
 SDL_Surface *
 GFXRotoZoom ( src, angle, zoom, smooth)
        SDL_Surface * src
@@ -3633,6 +3648,8 @@ GFXZoom ( src, zoomx, zoomy, smooth)
        OUTPUT:
                RETVAL
 
+=cut
+
 int
 GFXPixelColor ( dst, x, y, color )
        SDL_Surface* dst