Tao.Sdl SDK Documentation

SdlImage.IMG_Load_RW Method 

Load an image of an unspecified format

[Visual Basic]
Public Shared Function IMG_Load_RW( _
   ByVal src As IntPtr, _
   ByVal freesrc As Integer _
) As IntPtr
[C#]
public static IntPtr IMG_Load_RW(
   IntPtr src,
   int freesrc
);

Parameters

src
The image is loaded from pointer.
freesrc
A non-zero value mean is will automatically close/free the src for you.

Return Value

a pointer to the image as a new SDL_Surface. NULL is returned on errors.

Remarks

Load src for use as a surface. This can load all supported image formats, except TGA. Using SDL_RWops is not covered here, but they enable you to load from almost any source.

Binds to C-function in SDL_image.h

            SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc)
            

Example

            // load sample.png in to image
                    SDL_Surface *image;
                image=IMG_Load_RW(SDL_RWFromFile("sample.png", "rb"), 1);
                    if(!image)
                {
                    printf("IMG_Load_RW: %s\n", IMG_GetError());
                    // handle error
                }
            

See Also

SdlImage Class | Tao.Sdl Namespace | IMG_Load | IMG_LoadTyped_RW