|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
SDL_Surface *IMG_Load(const char *file)
Load file for use as an image in a new surface. This actually calls
IMG_LoadTyped_RW, with the file extension used as the type string. This can load all supported image files, including TGA as long as the filename ends with ".tga". It is best to call this outside of event loops, and rather keep the loaded images around until you are really done with them, as disk speed and image conversion to a surface is not that speedy. Don't forget to SDL_FreeSurface the returned surface pointer when you are through with it.
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.
Note: If the image format supports a transparent pixel, SDL_image 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);
Returns: a pointer to the image as a new
SDL_Surface. NULL is returned on errors, such as no support built for the image, or a file reading error.
3.1.2 IMG_Init, 3.2.2 IMG_Load_RW, 3.2.3 IMG_LoadTyped_RW