[Top] | [Contents] | [Index] | [ ? ] |
1. Overview The README from the SDL_image distribution
2. Getting Started Using SDL_image
3. Functions Functions supported by the SDL_image API 4. Defines Defined values/macros in the SDL_image API
Index Index of selected words
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
I am currently, as I write this document, a programmer for Raytheon. There I do all sorts of communications, network, GUI, and other general programming tasks in C/C++ on the Solaris, Linux, and Windows Operating Systems.
Feel free to contact me: JonathanCAtkins@gmail.com
I am also usually on IRC at irc.freenode.net in the #SDL channel as LIM
Images provide the basic visual building blocks for any user interface. Colors and fun shapes are the stuff that we as kids looked at for hours at a time while trying to shoot down big aliens and rescue pixelated princesses. Now it's our turn to make the images that others will remember later in life perhaps. Now how do we get this dang images into our SDL programs, and be flexible in the handling of the images so that we don't even have to worry about what various formats they may be in? This is where SDLimage makes all of our lives easier. This document doesn't help you make artwork, but it will give you the functional knowledge on how to get that art into your game. Now go forth and make your Stick Figure of Justice, someone else might fill in for your lack of artistry, at least you won't have to make much of an effort to include the new and better art into your code.
This is the README, updated by me for accuracy, in the SDL_image source archive.
|
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This assumes you have gotten SDL_image and installed it on your system. SDL_image has an README document in the source distribution to help you get it compiled and installed. Well it at least points you to locations for the source code of some of the image libraries SDL_image can use. Most of the other image formats are builtin to SDL_image.
Generally, in UNIX-like environments, installation consists of:
|
SDL_image supports loading and decoding images from the following formats:
.pbm
= Portable BitMap (mono).pgm
= Portable GreyMap (256 greys).ppm
= Portable PixMap (full color)
You may also want to look at some demonstration code which may be downloaded from:
http://www.jonatkins.org/SDL_image/
2.1 Includes The include files to use for SDL_image 2.2 Compiling Using the SDL_image library and header file.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To use SDL_image functions in a C/C++ source code file, you must use the SDL_image.h include file:
#include "SDL_image.h"
|
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To link with SDL_image you should use sdl-config to get the required SDL
compilation options. After that, compiling with SDL_image is quite easy.
Note: Some systems may not have the SDL_image library and include file in the same place as the SDL library and includes are located, in that case you will need to add more -I and -L paths to these command lines.
Simple Example for compiling an object file:
Simple Example for compiling an object file:
|
Now myprogram
is ready to run.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These are the functions in the SDL_image API.
3.1 General Versioning, Initialization and Cleanup 3.2 Loading From Image Data to SDL_Surface 3.3 Info Image Type Detection 3.4 Errors Error Handling
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions query, initialize, and cleanup the SDL_image library.
3.1.1 IMG_Linked_Version Get version number 3.1.2 IMG_Init Initialize SDL_image 3.1.3 IMG_Quit Cleanup SDL_image
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
const SDL_version *IMG_Linked_Version()
void SDL_IMAGE_VERSION(SDL_version *compile_version)
This works similar to SDL_Linked_Version
and SDL_VERSION.
Using these you can compare the runtime version to the version that you compiled with.
These functions/macros do not require any library initialization calls before using them.
|
See Also:
3.1.2 IMG_Init
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_Init(int flags)
Initialize by loading support as indicated by the flags, or at least return success if support is already loaded. You may call this multiple times, which will actually require you to call IMG_Quit
just once to clean up. You may call this function with a 0 to retrieve whether support was built-in or not loaded yet.
Note: to load JPG, PNG, and/or TIF images you can call IMG_Init
with the right IMG_INIT_* flags OR'd together before you program gets busy, to prevent a later hiccup while it loads the library, and to check that you do have the support that you need before you try and use it.
Note: No initialization is needed nor performed when using the IMG_isJPG
, IMG_isPNG
, and IMG_isTIF
functions.
Note: this function does not always set the error string, so do not depend on IMG_GetError
being meaningful all the time.
Returns: a bitmask of all the currently initted image loaders.
|
See Also:
3.1.3 IMG_Quit
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void IMG_Quit()
This function cleans up all dynamically loaded library handles, freeing memory. If support is required again it will be initialized again, either by IMG_Init
or loading an image with dynamic support required. You may call this function when IMG_Load functions are no longer needed for the JPG, PNG, and TIF image formats. You only need to call this function once, no matter how many times IMG_Init
was called.
|
See Also:
3.1.2 IMG_Init
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions create an SDL_Surface from image data either from a file, or SDL_RWop, or from an array of data in memory.
Automagic Loading
Specific Loaders
3.2.1 IMG_Load Load from a file 3.2.2 IMG_Load_RW Load using a SDL_RWop 3.2.3 IMG_LoadTyped_RW Load more format specifically with a SDL_RWop
Array Loaders
3.2.6 IMG_LoadBMP_RW Load BMP using a SDL_RWop 3.2.4 IMG_LoadCUR_RW Load CUR using a SDL_RWop 3.2.11 IMG_LoadGIF_RW Load GIF using a SDL_RWop 3.2.5 IMG_LoadICO_RW Load ICO using a SDL_RWop 3.2.12 IMG_LoadJPG_RW Load JPG using a SDL_RWop 3.2.16 IMG_LoadLBM_RW Load LBM using a SDL_RWop 3.2.10 IMG_LoadPCX_RW Load PCX using a SDL_RWop 3.2.14 IMG_LoadPNG_RW Load PNG using a SDL_RWop 3.2.7 IMG_LoadPNM_RW Load PNM using a SDL_RWop 3.2.15 IMG_LoadTGA_RW Load TGA using a SDL_RWop 3.2.13 IMG_LoadTIF_RW Load TIF using a SDL_RWop 3.2.9 IMG_LoadXCF_RW Load XCF using a SDL_RWop 3.2.8 IMG_LoadXPM_RW Load XPM using a SDL_RWop 3.2.17 IMG_LoadXV_RW Load XV using a SDL_RWop
3.2.18 IMG_ReadXPMFromArray Load XPM from compiled XPM data
[ < ] | [ > ] | [ << ] | [ 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.
|
See Also:
3.1.2 IMG_Init,
3.2.2 IMG_Load_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc)
Load src for use as a surface. This can load all supported image formats, except TGA.
Using SDL_RWops
is not covered here, but they enable you to load from almost any source.
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.
|
See Also:
3.1.2 IMG_Init,
3.2.1 IMG_Load,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type)
"BMP" "CUR" "GIF" "ICO" "JPG" "LBM" "PCX" "PNG" "PNM" "TGA" "TIF" "XCF" "XPM" "XV" |
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 in the future).
Using SDL_RWops
is not covered here, but they enable you to load from almost any source.
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.
|
See Also:
3.1.2 IMG_Init,
3.2.1 IMG_Load,
3.2.2 IMG_Load_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadCUR_RW(SDL_RWops *src)
Load src as a Windows Cursor image for use as a surface, if BMP support is compiled into the SDL_image library. The CUR's mask is put into to per pixel alpha in the surface. For files with multiple images, the first one found with the highest color count is chosen.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if BMP is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.1 IMG_isCUR
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadICO_RW(SDL_RWops *src)
Load src as a Windows Icon image for use as a surface, if BMP support is compiled into the SDL_image library. The ICO's mask is put into to per pixel alpha in the surface. For files with multiple images, the first one found with the highest color count is chosen.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if BMP is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.2 IMG_isICO
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src)
Load src as a BMP image for use as a surface, if BMP support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if BMP is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.3 IMG_isBMP
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadPNM_RW(SDL_RWops *src)
Load src as a PNM image for use as a surface, if PNM support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if PNM is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.4 IMG_isPNM
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
Load src as a XPM image for use as a surface, if XPM support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if XPM is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.2.18 IMG_ReadXPMFromArray,
3.3.5 IMG_isXPM
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadXCF_RW(SDL_RWops *src)
Load src as a XCF image for use as a surface, if XCF support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if XCF is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.6 IMG_isXCF
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src)
Load src as a PCX image for use as a surface, if PCX support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if PCX is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.7 IMG_isPCX
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src)
Load src as a GIF image for use as a surface, if GIF support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if GIF is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.8 IMG_isGIF
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
Load src as a JPG image for use as a surface, if JPG 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 JPG is not supported, or a read error.
|
See Also:
3.1.2 IMG_Init,
3.2.3 IMG_LoadTyped_RW,
3.3.9 IMG_isJPG
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadTIF_RW(SDL_RWops *src)
Load src as a TIF image for use as a surface, if TIF 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 TIF is not supported, or a read error.
|
See Also:
3.1.2 IMG_Init,
3.2.3 IMG_LoadTyped_RW,
3.3.10 IMG_isTIF
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
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.
|
See Also:
3.1.2 IMG_Init,
3.2.3 IMG_LoadTyped_RW,
3.3.11 IMG_isPNG
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
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.
|
See Also:
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadLBM_RW(SDL_RWops *src)
Load src as a LBM image for use as a surface, if LBM support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if LBM is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.12 IMG_isLBM
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_LoadXV_RW(SDL_RWops *src)
Load src as a XV thumbnail image for use as a surface, if XV support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if XV is not supported, or a read error.
|
See Also:
3.2.3 IMG_LoadTyped_RW,
3.3.13 IMG_isXV
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
Load xpm as a XPM image for use as a surface, if XPM support is compiled into the SDL_image library.
Returns: a pointer to the image as a new SDL_Surface
. NULL is returned on errors, like if XPM is not supported, or a read error.
|
See Also:
3.2.8 IMG_LoadXPM_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are tests for specific file formats. They also show if the format is supported in the linked SDL_image library, assuming you have a valid image of that type.
3.3.3 IMG_isBMP Test for valid, supportted BMP file 3.3.1 IMG_isCUR Test for valid, supportted CUR file 3.3.8 IMG_isGIF Test for valid, supportted GIF file 3.3.2 IMG_isICO Test for valid, supportted ICO file 3.3.9 IMG_isJPG Test for valid, supportted JPG file 3.3.12 IMG_isLBM Test for valid, supportted LBM file 3.3.7 IMG_isPCX Test for valid, supportted PCX file 3.3.11 IMG_isPNG Test for valid, supportted PNG file 3.3.4 IMG_isPNM Test for valid, supportted PNM file 3.3.10 IMG_isTIF Test for valid, supportted TIF file 3.3.6 IMG_isXCF Test for valid, supportted XCF file 3.3.5 IMG_isXPM Test for valid, supportted XPM file 3.3.13 IMG_isXV Test for valid, supportted XV file
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isCUR(SDL_RWops *src)
If the BMP format is supported, then the image data is tested to see if it is readable as a CUR, otherwise it returns false (Zero).
Returns: 1 if the image is a CUR and the BMP format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.4 IMG_LoadCUR_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isICO(SDL_RWops *src)
If the BMP format is supported, then the image data is tested to see if it is readable as an ICO, otherwise it returns false (Zero).
Returns: 1 if the image is an ICO and the BMP format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.5 IMG_LoadICO_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isBMP(SDL_RWops *src)
If the BMP format is supported, then the image data is tested to see if it is readable as a BMP, otherwise it returns false (Zero).
Returns: 1 if the image is a BMP and the BMP format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.6 IMG_LoadBMP_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isPNM(SDL_RWops *src)
If the PNM format is supported, then the image data is tested to see if it is readable as a PNM, otherwise it returns false (Zero).
Returns: 1 if the image is a PNM and the PNM format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.7 IMG_LoadPNM_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isXPM(SDL_RWops *src)
If the XPM format is supported, then the image data is tested to see if it is readable as a XPM, otherwise it returns false (Zero).
Returns: 1 if the image is a XPM and the XPM format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.8 IMG_LoadXPM_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isXCF(SDL_RWops *src)
If the XCF format is supported, then the image data is tested to see if it is readable as a XCF, otherwise it returns false (Zero).
Returns: 1 if the image is a XCF and the XCF format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.9 IMG_LoadXCF_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isPCX(SDL_RWops *src)
If the PCX format is supported, then the image data is tested to see if it is readable as a PCX, otherwise it returns false (Zero).
Returns: 1 if the image is a PCX and the PCX format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.10 IMG_LoadPCX_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isGIF(SDL_RWops *src)
If the GIF format is supported, then the image data is tested to see if it is readable as a GIF, otherwise it returns false (Zero).
Returns: 1 if the image is a GIF and the GIF format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.11 IMG_LoadGIF_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isJPG(SDL_RWops *src)
If the JPG format is supported, then the image data is tested to see if it is readable as a JPG, otherwise it returns false (Zero).
Returns: 1 if the image is a JPG and the JPG format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.12 IMG_LoadJPG_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isTIF(SDL_RWops *src)
If the TIF format is supported, then the image data is tested to see if it is readable as a TIF, otherwise it returns false (Zero).
Returns: 1 if the image is a TIF and the TIF format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.13 IMG_LoadTIF_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isPNG(SDL_RWops *src)
If the PNG format is supported, then the image data is tested to see if it is readable as a PNG, otherwise it returns false (Zero).
Returns: 1 if the image is a PNG and the PNG format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.14 IMG_LoadPNG_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isLBM(SDL_RWops *src)
If the LBM format is supported, then the image data is tested to see if it is readable as a LBM, otherwise it returns false (Zero).
Returns: 1 if the image is a LBM and the LBM format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.16 IMG_LoadLBM_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int IMG_isXV(SDL_RWops *src)
If the XV format is supported, then the image data is tested to see if it is readable as an XV thumbnail, otherwise it returns false (Zero).
Returns: 1 if the image is an XV thumbnail and the XV format support is compiled into SDL_image. 0 is returned otherwise.
|
See Also:
3.2.17 IMG_LoadXV_RW,
3.2.3 IMG_LoadTyped_RW
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are used for error status strings that should help the user and developer understand why a function failed.
3.4.1 IMG_SetError Set the current error string 3.4.2 IMG_GetError Get the current error string
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
void IMG_SetError(const char *fmt, ...)
This is the same as SDL_SetError, which sets the error string which may be fetched with IMG_GetError (or SDL_GetError).
This functions acts like printf, except that it is limited to SDL_ERRBUFIZE(1024) chars in length. It only accepts the following format types: %s, %d, %f, %p
. No variations are supported, like %.2f
would not work. For any more specifics read the SDL docs.
|
See Also:
3.4.2 IMG_GetError
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
char *IMG_GetError()
This is the same as SDL_GetError, which returns the last error set as a string which you may use to tell the user what happened when an error status has been returned from an SDL_image function call.
Returns: a char pointer (string) containing a humam readble version or the reason for the last error that occured.
|
See Also:
3.4.1 IMG_SetError
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1
2
8
1
2
4
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | I R S |
---|
Jump to: | I R S |
---|
[Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
1. Overview
2. Getting Started
3. Functions
4. Defines
Index
[Top] | [Contents] | [Index] | [ ? ] |
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | previous section in reading order | 1.2.2 |
[ > ] | Forward | next section in reading order | 1.2.4 |
[ << ] | FastBack | previous or up-and-previous section | 1.1 |
[ Up ] | Up | up section | 1.2 |
[ >> ] | FastForward | next or up-and-next section | 1.3 |
[Top] | Top | cover (top) of document | |
[Contents] | Contents | table of contents | |
[Index] | Index | concept index | |
[ ? ] | About | this page |