SDL_image 1.2.3: IMG_LoadTyped_RW

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

### 3.1.3 IMG_LoadTyped_RW

`SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type)`

src
  The source SDL_RWops as a pointer. 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):

      "TGA"
      "BMP"
      "PNM"
      "XPM"
      "XCF"
      "PCX"
      "GIF"
      "JPG"
      "TIF"
      "LBM"
      "PNG"

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.

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

    // 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:
3.1.1 IMG_Load, 3.1.2 IMG_Load_RW

This document was generated on June, 12 2003 using texi2html