imgGetAnimationDecoderFrame function image

bool imgGetAnimationDecoderFrame(
  1. Pointer<ImgAnimationDecoder> decoder,
  2. Pointer<Pointer<SdlSurface>> frame,
  3. Pointer<Uint64> duration
)

Get the next frame in an animation decoder.

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.

\param decoder the animation decoder. \param frame a pointer filled in with the SDL_Surface for the next frame in the animation. \param duration 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. \returns true on success or false on failure and when no more frames are available; call IMG_GetAnimationDecoderStatus() or SDL_GetError() for more information.

\since This function is available since SDL_image 3.4.0.

\sa IMG_CreateAnimationDecoder \sa IMG_CreateAnimationDecoder_IO \sa IMG_CreateAnimationDecoderWithProperties \sa IMG_GetAnimationDecoderStatus \sa IMG_ResetAnimationDecoder \sa IMG_CloseAnimationDecoder

extern SDL_DECLSPEC bool SDLCALL IMG_GetAnimationDecoderFrame(IMG_AnimationDecoder *decoder, SDL_Surface **frame, Uint64 *duration)

Implementation

bool imgGetAnimationDecoderFrame(
  Pointer<ImgAnimationDecoder> decoder,
  Pointer<Pointer<SdlSurface>> frame,
  Pointer<Uint64> duration,
) {
  final imgGetAnimationDecoderFrameLookupFunction = _libImage
      .lookupFunction<
        Uint8 Function(
          Pointer<ImgAnimationDecoder> decoder,
          Pointer<Pointer<SdlSurface>> frame,
          Pointer<Uint64> duration,
        ),
        int Function(
          Pointer<ImgAnimationDecoder> decoder,
          Pointer<Pointer<SdlSurface>> frame,
          Pointer<Uint64> duration,
        )
      >('IMG_GetAnimationDecoderFrame');
  return imgGetAnimationDecoderFrameLookupFunction(decoder, frame, duration) ==
      1;
}