[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.13 IMG_LoadTGA_RW

SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)

src
The source SDL_RWops as a pointer. The TGA image is loaded from this.

Load src as a TGA image for use as a surface, if TGA support is compiled into the SDL_image library. If you try to load a non TGA image, you might succeed even when it's not TGA image formatted data, this is because the TGA has no magic, which is a way of identifying a filetype from a signature in it's contents. So be careful with this.

Returns: a pointer to the image as a new SDL_Surface. NULL is returned on errors, like if TGA is not supported, or a read error.

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

See Also:
3.1.3 IMG_LoadTyped_RW



This document was generated on January, 24 2006 using texi2html