imgLoadAnimation function

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 2.6.0.

\sa IMG_FreeAnimation

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

Implementation

Pointer<ImgAnimation> imgLoadAnimation(String? file) {
  final imgLoadAnimationLookupFunction = libSdl2Image.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;
}