imgLoadAnimation function image

Pointer<ImgAnimation> imgLoadAnimation(
  1. String? file
)

Load an animation from a file.

When done with the returned animation, the app should dispose of it with a call to IMG_FreeAnimation().

\param file path on the filesystem containing an animated image. \returns a new IMG_Animation, or NULL on error.

\since This function is available since SDL_image 3.0.0.

\sa IMG_LoadAnimation_IO \sa IMG_LoadAnimationTyped_IO \sa IMG_LoadAPNGAnimation_IO \sa IMG_LoadAVIFAnimation_IO \sa IMG_LoadGIFAnimation_IO \sa IMG_LoadWEBPAnimation_IO \sa IMG_FreeAnimation

extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation(const char *file)

Implementation

Pointer<ImgAnimation> imgLoadAnimation(String? file) {
  final imgLoadAnimationLookupFunction = _libImage
      .lookupFunction<
        Pointer<ImgAnimation> Function(Pointer<Utf8> file),
        Pointer<ImgAnimation> Function(Pointer<Utf8> file)
      >('IMG_LoadAnimation');
  final filePointer = file != null ? file.toNativeUtf8() : nullptr;
  final result = imgLoadAnimationLookupFunction(filePointer);
  calloc.free(filePointer);
  return result;
}