18.15.1Class IMAGE

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
GetErrorGets image related error
LoadLoads an image file based on filename extension
SetErrorSets image related error string
isBMPChecks if an image is in BMP format.
isGIFChecks if an image is in GIF format.
isJPGChecks if an image is in JPG format.
isLBMChecks if an image is in LBM format.
isPCXChecks if an image is in PCX format.
isPNGChecks if an image is in PCX format.
isPNMChecks if an image is in PNM format.
isTIFChecks if an image is in TIF format.
isXCFChecks if an image is in XCF format.
isXPMChecks if an image is in XPM format.

Methods

GetError

Gets image related error

IMAGE.GetError()
ReturnReturns a string containing a humam readble version or the reason for the last error that occured

The current active image error is returned

Load

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.
ReturnA new instance of SDLSurface.
Raise
SDLError if the file could not be interpreted as an image.

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):

SetError

Sets image related error string

IMAGE.SetError()
ReturnReturns 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.

isBMP

Checks if an image is in BMP format.

IMAGE.isBMP( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a BMP image.

It may be useful to reset the stream to the current position after calling this function.

isGIF

Checks if an image is in GIF format.

IMAGE.isGIF( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a GIF image.

It may be useful to reset the stream to the current position after calling this function.

isJPG

Checks if an image is in JPG format.

IMAGE.isJPG( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a JPG image.

It may be useful to reset the stream to the current position after calling this function.

isLBM

Checks if an image is in LBM format.

IMAGE.isLBM( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a LBM image.

It may be useful to reset the stream to the current position after calling this function.

isPCX

Checks if an image is in PCX format.

IMAGE.isPCX( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a PCX image.

It may be useful to reset the stream to the current position after calling this function.

isPNG

Checks if an image is in PCX format.

IMAGE.isPNG( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a PCX image.

It may be useful to reset the stream to the current position after calling this function.

isPNM

Checks if an image is in PNM format.

IMAGE.isPNM( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a PNM image.

It may be useful to reset the stream to the current position after calling this function.

isTIF

Checks if an image is in TIF format.

IMAGE.isTIF( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a TIF image.

It may be useful to reset the stream to the current position after calling this function.

isXCF

Checks if an image is in XCF format.

IMAGE.isXCF( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a XCF image.

It may be useful to reset the stream to the current position after calling this function.

isXPM

Checks if an image is in XPM format.

IMAGE.isXPM( file )
file a Falcon Stream instance pointing at the beginning of the image data.
ReturnTrue if the stream is stroing a XPM image.

It may be useful to reset the stream to the current position after calling this function.

Made with http://www.falconpl.org