Tao.Sdl SDK Documentation

SdlImage.IMG_LoadTyped_RW Method 

Load an image from an SDL data source. The 'type' may be one of: "BMP", "GIF", "PNG", etc. If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey);

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

Parameters

src
The image is loaded from this.
freesrc
A non-zero value mean is will automatically close/free the src for you.
type
A string that indicates which format type to interpret the image as.

Here is a list of the currently recognized strings (case is not important):












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. This method does not guarantee that the format specified by type is the format of the loaded image, except in the case when TGA format is specified (or any other non-magicable format). 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_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type)
            

Example

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

See Also

SdlImage Class | Tao.Sdl Namespace | IMG_Load | IMG_Load_RW