TSdlAnimatedImage
Animated image support
Currently only animated GIFs are supported.
Definition
Unit: Neslib.Sdl3.Image
Properties
Name | Description |
---|---|
Delays | The delays after each frame, in milliseconds. |
FrameCount | The number of frames in the animation. |
Frames | The frames in the animation, as SDL surfaces |
Height | The height of the frames in the animation. |
Width | The width of the frames in the animation. |
Constructors
Name | Description |
---|---|
Create(TSdlIOStream, Boolean, String) | Load an animation from an SDL datasource |
Create(String) | Load an animation from a file. |
LoadGif | Load a GIF animation directly. |
Operators
Name | Description |
---|---|
Equal(TSdlAnimatedImage, TSdlAnimatedImage) | Used to compare against another TSdlAnimatedImage. |
Equal(TSdlAnimatedImage, Pointer) | Used to compare against nil . |
Implicit | Used to set the value to nil . |
NotEqual(TSdlAnimatedImage, TSdlAnimatedImage) | Used to compare against another TSdlAnimatedImage. |
NotEqual(TSdlAnimatedImage, Pointer) | Used to compare against nil . |
Methods
Name | Description |
---|---|
Free | Dispose of the animation and free its resources. |
Property Descriptions
Delays
The delays after each frame, in milliseconds.
property Delays[const AIndex: Integer]: Integer read GetDelay
Type: Integer
FrameCount
The number of frames in the animation.
property FrameCount: Integer read GetCount
Type: Integer
Frames
The frames in the animation, as SDL surfaces
property Frames[const AIndex: Integer]: TSdlSurface read GetFrame
Type: TSdlSurface
Height
The height of the frames in the animation.
property Height: Integer read GetHeight
Type: Integer
Width
The width of the frames in the animation.
property Width: Integer read GetWidth
Type: Integer
Constructor Descriptions
Create
Load an animation from an SDL datasource
Even though this method accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. If AType
is empty, SDL_image will rely solely on its ability to guess the format.
If ACloseIO
is True, ASrc
will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from ASrc
during this call in any case.
When done with the animation, the app should dispose of it with a call to Free.
constructor Create(const ASrc: TSdlIOStream; const ACloseIO: Boolean; const AType: String = ''); overload
Parameters
ASrc
: TSdlIOStream
: A TSdlIOStream that data will be read from.
ACloseIO
: Boolean
: True to close/free the TSdlIOStream before returning, False to leave it open.
AType
: String = ''
: (Optional) filename extension that represent this data ("GIF") or empty (default) to autodetect.
Exceptions
ESdlError
: Raised on failure.
See Also
Create
Load an animation from a file.
When done with the animation, the app should dispose of it with a call to Free.
constructor Create(const AFile: String); overload
Parameters
AFile
: String
: Path on the filesystem containing an animated image.
Exceptions
ESdlError
: Raised on failure.
See Also
LoadGif
Load a GIF animation directly.
If you know you definitely have a GIF image, you can call this function, which will skip SDL_image's file format detection routines. Generally it's better to use the Create constructor; also, there is only an TSdlIOStream interface available here.
constructor LoadGif(const ASrc: TSdlIOStream)
Parameters
ASrc
: TSdlIOStream
: A TSdlIOStream that data will be read from.
Exceptions
ESdlError
: Raised on failure.
See Also
Operator Descriptions
Equal(TSdlAnimatedImage, TSdlAnimatedImage)
Used to compare against another TSdlAnimatedImage.
class operator Equal(const ALeft, ARight: TSdlAnimatedImage): Boolean; inline; static
Parameters
ALeft
: TSdlAnimatedImage
ARight
: TSdlAnimatedImage
Returns
Boolean
Equal(TSdlAnimatedImage, Pointer)
Used to compare against nil
.
class operator Equal(const ALeft: TSdlAnimatedImage; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TSdlAnimatedImage
ARight
: Pointer
Returns
Boolean
Implicit(Pointer)
Used to set the value to nil
.
class operator Implicit(const AValue: Pointer): TSdlAnimatedImage; inline; static
Parameters
AValue
: Pointer
Returns
NotEqual(TSdlAnimatedImage, TSdlAnimatedImage)
Used to compare against another TSdlAnimatedImage.
class operator NotEqual(const ALeft, ARight: TSdlAnimatedImage): Boolean; inline; static
Parameters
ALeft
: TSdlAnimatedImage
ARight
: TSdlAnimatedImage
Returns
Boolean
NotEqual(TSdlAnimatedImage, Pointer)
Used to compare against nil
.
class operator NotEqual(const ALeft: TSdlAnimatedImage; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TSdlAnimatedImage
ARight
: Pointer
Returns
Boolean
Method Descriptions
Free
Dispose of the animation and free its resources.
The animation is not valid once this call returns.
procedure Free; inline