//
// Generated by Brutal.Sdl.Generate; do not edit by hand.
#nullable enable
namespace Brutal.SdlApi.Image
{
public readonly unsafe partial struct ImgAnimationDecoder
{
///
/// Close an animation decoder, finishing any decoding.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Calling this function frees the animation decoder, and returns the final
/// status of the decoding process.
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function is available since SDL_image 3.4.0.
///
///
///
///
public bool Close()
{
if (IsNull())
{
return default;
}
return SdlImage.CloseAnimationDecoder(this);
}
///
/// Get the next frame in an animation decoder.
///
///
/// a pointer filled in with the SDL_Surface for the next frame in
/// the animation.
///
///
/// the duration of the frame, usually in milliseconds but can
/// be other units if the
/// IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER
/// property is set when creating the decoder.
///
///
/// true on success or false on failure and when no more frames are
/// available; call IMG_GetAnimationDecoderStatus() or SDL_GetError()
/// for more information.
///
///
///
/// This function decodes the next frame in the animation decoder, returning it
/// as an SDL_Surface. The returned surface should be freed with
/// SDL_FreeSurface() when no longer needed.
///
///
/// If the animation decoder has no more frames or an error occurred while
/// decoding the frame, this function returns false. In that case, please call
/// SDL_GetError() for more information. If SDL_GetError() returns an empty
/// string, that means there are no more available frames. If SDL_GetError()
/// returns a valid string, that means the decoding failed.
///
///
///
/// This function is available since SDL_image 3.4.0.
///
///
///
///
///
///
///
public bool GetFrame(SdlSurface** frame, out ulong duration) =>
SdlImage.GetAnimationDecoderFrame(this, frame, out duration);
///
/// Get the properties of an animation decoder.
///
///
/// the properties ID of the animation decoder, or 0 if there are no
/// properties; call SDL_GetError() for more information.
///
///
///
/// This function returns the properties of the animation decoder, which holds
/// information about the underlying image such as description, copyright text
/// and loop count.
///
///
/// IMG_PROP_METADATA_LOOP_COUNT_NUMBER, if present, specifies the number of times to play the
/// animation, with 0 meaning loop continuously.
///
///
///
/// This function is available since SDL_image 3.4.0.
///
///
///
///
public uint GetProperties() => SdlImage.GetAnimationDecoderProperties(this);
///
/// Get the decoder status indicating the current state of the decoder.
///
///
/// the status of the underlying decoder, or
/// IMG_DECODER_STATUS_INVALID if the given decoder is invalid.
///
///
/// This function is available since SDL_image 3.4.0.
///
///
public ImgAnimationDecoderStatus GetStatus() => SdlImage.GetAnimationDecoderStatus(this);
///
/// Reset an animation decoder.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Calling this function resets the animation decoder, allowing it to start
/// from the beginning again. This is useful if you want to decode the frame
/// sequence again without creating a new decoder.
///
///
///
/// This function is available since SDL_image 3.4.0.
///
///
///
///
///
///
public bool Reset() => SdlImage.ResetAnimationDecoder(this);
}
public readonly unsafe partial struct ImgAnimationEncoder
{
///
/// Add a frame to an animation encoder.
///
/// the surface to add as the next frame in the animation.
///
/// the duration of the frame, usually in milliseconds but can
/// be other units if the
/// IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER
/// property is set when creating the encoder.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
/// This function is available since SDL_image 3.4.0.
///
///
///
///
///
public bool AddFrame(SdlSurface* surface, ulong duration) =>
SdlImage.AddAnimationEncoderFrame(this, surface, duration);
///
/// Close an animation encoder, finishing any encoding.
///
///
/// true on success or false on failure; call SDL_GetError() for more
/// information.
///
///
///
/// Calling this function frees the animation encoder, and returns the final
/// status of the encoding process.
///
///
/// This is equivalent to Dispose(): it is a safe no-op on a default (null) handle and otherwise performs
/// the single native free. Because a handle is a copyable value type, it cannot invalidate its own copies
/// after the free, so calling this (or Dispose) more than once on the same handle value — or on separate
/// copies of it — frees the underlying native object more than once. Free each handle exactly once.
///
///
///
/// This function is available since SDL_image 3.4.0.
///
///
///
///
public bool Close()
{
if (IsNull())
{
return default;
}
return SdlImage.CloseAnimationEncoder(this);
}
}
}