Animated image support.
More...
|
constexpr | Animation ()=default |
| Default ctor.
|
|
constexpr | Animation (const AnimationRaw resource) |
| Constructs from AnimationParam. More...
|
|
constexpr | Animation (const Animation &other)=delete |
| Copy constructor.
|
|
constexpr | Animation (Animation &&other) |
| Move constructor.
|
|
constexpr | Animation (const AnimationRef &other)=delete |
|
constexpr | Animation (AnimationRef &&other)=delete |
|
| Animation (StringParam file) |
| Load an animation from a file. More...
|
|
| Animation (IOStreamParam src, bool closeio=false) |
| Load an animation from an IOStream. More...
|
|
| ~Animation () |
| Destructor.
|
|
Animation & | operator= (Animation other) |
| Assignment operator.
|
|
constexpr AnimationRaw | get () const |
| Retrieves underlying AnimationRaw.
|
|
constexpr AnimationRaw | release () |
| Retrieves underlying AnimationRaw and clear this.
|
|
constexpr auto | operator<=> (const Animation &other) const =default |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t _) const |
| Comparison.
|
|
constexpr | operator bool () const |
| Converts to bool.
|
|
constexpr | operator AnimationParam () const |
| Converts to AnimationParam.
|
|
void | Free () |
| Dispose of an Animation and free its resources. More...
|
|
int | GetWidth () const |
| Get the width in pixels.
|
|
int | GetHeight () const |
| Get the height in pixels.
|
|
Point | GetSize () const |
| Get the size in pixels.
|
|
int | GetCount () const |
| Return the number of frames.
|
|
SurfaceRaw | GetFrame (int index) const |
| Return the frame image under given index. More...
|
|
int | GetDelay (int index) const |
| Return the frame delay under given index. More...
|
|
Currently only animated GIFs and WEBP images are supported.
- Category:
- Resource
◆ Animation() [1/3]
constexpr SDL::Animation::Animation |
( |
const AnimationRaw |
resource | ) |
|
|
inlineexplicitconstexpr |
- Parameters
-
resource | a AnimationRaw to be wrapped. |
This assumes the ownership, call release() if you need to take back.
◆ Animation() [2/3]
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
- Parameters
-
file | path on the filesystem containing an animated image. |
- Postcondition
- a new Animation, or nullptr on error.
- Since
- This function is available since SDL_image 3.0.0.
- See also
- Animation.Free
◆ Animation() [3/3]
SDL::Animation::Animation |
( |
IOStreamParam |
src, |
|
|
bool |
closeio = false |
|
) |
| |
|
inline |
If closeio
is true, src
will be closed before returning, whether this function succeeds or not. SDL_image reads everything it needs from src
during this call in any case.
When done with the returned animation, the app should dispose of it with a call to Animation.Free().
- Parameters
-
src | an IOStream that data will be read from. |
closeio | true to close/free the IOStream before returning, false to leave it open. |
- Postcondition
- a new Animation, or nullptr on error.
- Since
- This function is available since SDL_image 3.0.0.
- See also
- Animation.Free
◆ GetDelay()
int SDL::Animation::GetDelay |
( |
int |
index | ) |
const |
|
inline |
- Parameters
-
index | the index to get frame, within [0, GetCount() - 1] |
◆ GetFrame()
SurfaceRaw SDL::Animation::GetFrame |
( |
int |
index | ) |
const |
|
inline |
- Parameters
-
index | the index to get frame, within [0, GetCount() - 1] |
The documentation for this class was generated from the following file: