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

3.2.14 IMG_LoadPNG_RW

SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)

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

Load src as a PNG image for use as a surface, if PNG support is compiled into the SDL_image library.
Note: If the image format loader requires initialization, it will attempt to do that the first time it is needed if you have not already called IMG_Init to load support for your image format.

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

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

See Also:
3.1.2 IMG_Init, 3.2.3 IMG_LoadTyped_RW, 3.3.11 IMG_isPNG



This document was generated on November, 3 2009 using texi2html