brutal/Brutal.Sdl.Image/Generated/SdlImage.HandleMethods.gen.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

211 lines
10 KiB
C#

// <auto-generated/>
// Generated by Brutal.Sdl.Generate; do not edit by hand.
#nullable enable
namespace Brutal.SdlApi.Image
{
public readonly unsafe partial struct ImgAnimationDecoder
{
/// <summary>
/// Close an animation decoder, finishing any decoding.
/// </summary>
/// <returns>
/// true on success or false on failure; call SDL_GetError() for more
/// information.
/// </returns>
/// <remarks>
/// <para>
/// Calling this function frees the animation decoder, and returns the final
/// status of the decoding process.
/// </para>
/// <para>
/// 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.
/// </para>
/// </remarks>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderIO"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderWithProperties"/>
public bool Close()
{
if (IsNull())
{
return default;
}
return SdlImage.CloseAnimationDecoder(this);
}
/// <summary>
/// Get the next frame in an animation decoder.
/// </summary>
/// <param name="frame">
/// a pointer filled in with the SDL_Surface for the next frame in
/// the animation.
/// </param>
/// <param name="duration">
/// the duration of the frame, usually in milliseconds but can
/// be other units if the
/// <c>IMG_PROP_ANIMATION_DECODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER</c>
/// property is set when creating the decoder.
/// </param>
/// <returns>
/// true on success or false on failure and when no more frames are
/// available; call IMG_GetAnimationDecoderStatus() or SDL_GetError()
/// for more information.
/// </returns>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// <para>
/// 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.
/// </para>
/// </remarks>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderIO"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderWithProperties"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.GetAnimationDecoderStatus"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.ResetAnimationDecoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CloseAnimationDecoder"/>
public bool GetFrame(SdlSurface** frame, out ulong duration) =>
SdlImage.GetAnimationDecoderFrame(this, frame, out duration);
/// <summary>
/// Get the properties of an animation decoder.
/// </summary>
/// <returns>
/// the properties ID of the animation decoder, or 0 if there are no
/// properties; call SDL_GetError() for more information.
/// </returns>
/// <remarks>
/// <para>
/// This function returns the properties of the animation decoder, which holds
/// information about the underlying image such as description, copyright text
/// and loop count.
/// </para>
/// <para>
/// <c>IMG_PROP_METADATA_LOOP_COUNT_NUMBER</c>, if present, specifies the number of times to play the
/// animation, with 0 meaning loop continuously.
/// </para>
/// </remarks>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderIO"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderWithProperties"/>
public uint GetProperties() => SdlImage.GetAnimationDecoderProperties(this);
/// <summary>
/// Get the decoder status indicating the current state of the decoder.
/// </summary>
/// <returns>
/// the status of the underlying decoder, or
/// IMG_DECODER_STATUS_INVALID if the given decoder is invalid.
/// </returns>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.GetAnimationDecoderFrame"/>
public ImgAnimationDecoderStatus GetStatus() => SdlImage.GetAnimationDecoderStatus(this);
/// <summary>
/// Reset an animation decoder.
/// </summary>
/// <returns>
/// true on success or false on failure; call SDL_GetError() for more
/// information.
/// </returns>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// </remarks>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderIO"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationDecoderWithProperties"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.GetAnimationDecoderFrame"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CloseAnimationDecoder"/>
public bool Reset() => SdlImage.ResetAnimationDecoder(this);
}
public readonly unsafe partial struct ImgAnimationEncoder
{
/// <summary>
/// Add a frame to an animation encoder.
/// </summary>
/// <param name="surface">the surface to add as the next frame in the animation.</param>
/// <param name="duration">
/// the duration of the frame, usually in milliseconds but can
/// be other units if the
/// <c>IMG_PROP_ANIMATION_ENCODER_CREATE_TIMEBASE_DENOMINATOR_NUMBER</c>
/// property is set when creating the encoder.
/// </param>
/// <returns>
/// true on success or false on failure; call SDL_GetError() for more
/// information.
/// </returns>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationEncoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationEncoderIO"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationEncoderWithProperties"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CloseAnimationEncoder"/>
public bool AddFrame(SdlSurface* surface, ulong duration) =>
SdlImage.AddAnimationEncoderFrame(this, surface, duration);
/// <summary>
/// Close an animation encoder, finishing any encoding.
/// </summary>
/// <returns>
/// true on success or false on failure; call SDL_GetError() for more
/// information.
/// </returns>
/// <remarks>
/// <para>
/// Calling this function frees the animation encoder, and returns the final
/// status of the encoding process.
/// </para>
/// <para>
/// 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.
/// </para>
/// </remarks>
/// <since>
/// This function is available since SDL_image 3.4.0.
/// </since>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationEncoder"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationEncoderIO"/>
/// <seealso cref="Brutal.SdlApi.Image.SdlImage.PInvoke.CreateAnimationEncoderWithProperties"/>
public bool Close()
{
if (IsNull())
{
return default;
}
return SdlImage.CloseAnimationEncoder(this);
}
}
}