imgCreateAnimationDecoder function image

Pointer<ImgAnimationDecoder> imgCreateAnimationDecoder(
  1. String? file
)

Create a decoder to read a series of images from a file.

The file type is determined from the file extension, e.g. "file.webp" will be decoded using WEBP.

\param file the file containing a series of images. \returns a new IMG_AnimationDecoder, or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL_image 3.4.0.

\sa IMG_CreateAnimationDecoder_IO \sa IMG_CreateAnimationDecoderWithProperties \sa IMG_GetAnimationDecoderFrame \sa IMG_ResetAnimationDecoder \sa IMG_CloseAnimationDecoder

extern SDL_DECLSPEC IMG_AnimationDecoder * SDLCALL IMG_CreateAnimationDecoder(const char *file)

Implementation

Pointer<ImgAnimationDecoder> imgCreateAnimationDecoder(String? file) {
  final imgCreateAnimationDecoderLookupFunction = _libImage
      .lookupFunction<
        Pointer<ImgAnimationDecoder> Function(Pointer<Utf8> file),
        Pointer<ImgAnimationDecoder> Function(Pointer<Utf8> file)
      >('IMG_CreateAnimationDecoder');
  final filePointer = file != null ? file.toNativeUtf8() : nullptr;
  final result = imgCreateAnimationDecoderLookupFunction(filePointer);
  calloc.free(filePointer);
  return result;
}