Main SDL IMAGE encapsulation class.
Class IMAGE
This class is the namespace for IMAGE functions of the SDL module. It contains the extensions provided by Falcon on the sdlimage module.
Methods | |
GetError | Gets image related error |
Load | Loads an image file based on filename extension |
SetError | Sets image related error string |
isBMP | Checks if an image is in BMP format. |
isGIF | Checks if an image is in GIF format. |
isJPG | Checks if an image is in JPG format. |
isLBM | Checks if an image is in LBM format. |
isPCX | Checks if an image is in PCX format. |
isPNG | Checks if an image is in PCX format. |
isPNM | Checks if an image is in PNM format. |
isTIF | Checks if an image is in TIF format. |
isXCF | Checks if an image is in XCF format. |
isXPM | Checks if an image is in XPM format. |
Gets image related error
IMAGE.GetError()
Return | Returns a string containing a humam readble version or the reason for the last error that occured |
The current active image error is returned
Loads an image file based on filename extension
IMAGE.Load( file, [type] )
file | The name of the file to be loaded, or a Falcon Stream instance pointing at the beginning of the image data. | ||
type | A string representing the type of image in the file stream. | ||
Return | A new instance of SDLSurface. | ||
Raise |
|
Load file for use as an image in a new surface. This actually uses the file extension as the type string. This can load all supported image files, provided that the extension is correctly representing the file type.
When a stream is given as file parameter, the type parameter is taken as the format type of the image in the incoming stream. It is just an hint, some common format doesn't require necessarily it.
Currently, the only format which is not automatically recognized is "TGA"; however, providing the hint will result in less guessing and may be necessary if the underlying stream doesn't support seek (i.e. a network stream or the standard input).
Here is a list of the currently recognized strings (case is not important):
Sets image related error string
IMAGE.SetError()
Return | Returns a string containing a humam readble version or the reason for the last error that occured |
This function sets the error string which may be fetched with img_GetError (or sdl_GetError). The function accepts a string not longer than 1024 chars in length.
Checks if an image is in BMP format.
IMAGE.isBMP( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a BMP image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in GIF format.
IMAGE.isGIF( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a GIF image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in JPG format.
IMAGE.isJPG( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a JPG image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in LBM format.
IMAGE.isLBM( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a LBM image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in PCX format.
IMAGE.isPCX( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a PCX image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in PCX format.
IMAGE.isPNG( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a PCX image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in PNM format.
IMAGE.isPNM( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a PNM image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in TIF format.
IMAGE.isTIF( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a TIF image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in XCF format.
IMAGE.isXCF( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a XCF image. |
It may be useful to reset the stream to the current position after calling this function.
Checks if an image is in XPM format.
IMAGE.isXPM( file )
file | a Falcon Stream instance pointing at the beginning of the image data. |
Return | True if the stream is stroing a XPM image. |
It may be useful to reset the stream to the current position after calling this function.