imgCreateAnimationEncoder function image

Pointer<ImgAnimationEncoder> imgCreateAnimationEncoder(
  1. String? file
)

Create an encoder to save a series of images to a file.

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

\param file the file where the animation will be saved. \returns a new IMG_AnimationEncoder, or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL_image 3.4.0.

\sa IMG_CreateAnimationEncoder_IO \sa IMG_CreateAnimationEncoderWithProperties \sa IMG_AddAnimationEncoderFrame \sa IMG_CloseAnimationEncoder

extern SDL_DECLSPEC IMG_AnimationEncoder * SDLCALL IMG_CreateAnimationEncoder(const char *file)

Implementation

Pointer<ImgAnimationEncoder> imgCreateAnimationEncoder(String? file) {
  final imgCreateAnimationEncoderLookupFunction = _libImage
      .lookupFunction<
        Pointer<ImgAnimationEncoder> Function(Pointer<Utf8> file),
        Pointer<ImgAnimationEncoder> Function(Pointer<Utf8> file)
      >('IMG_CreateAnimationEncoder');
  final filePointer = file != null ? file.toNativeUtf8() : nullptr;
  final result = imgCreateAnimationEncoderLookupFunction(filePointer);
  calloc.free(filePointer);
  return result;
}