imgCreateAnimationEncoderIo function image

Pointer<ImgAnimationEncoder> imgCreateAnimationEncoderIo(
  1. Pointer<SdlIoStream> dst,
  2. bool closeio,
  3. String? type
)

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

If closeio is true, dst will be closed before returning if this function fails, or when the animation encoder is closed if this function succeeds.

\param dst an SDL_IOStream that will be used to save the stream. \param closeio true to close the SDL_IOStream when done, false to leave it open. \param type a filename extension that represent this data ("WEBP", etc). \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 \sa IMG_CreateAnimationEncoderWithProperties \sa IMG_AddAnimationEncoderFrame \sa IMG_CloseAnimationEncoder

extern SDL_DECLSPEC IMG_AnimationEncoder * SDLCALL IMG_CreateAnimationEncoder_IO(SDL_IOStream *dst, bool closeio, const char *type)

Implementation

Pointer<ImgAnimationEncoder> imgCreateAnimationEncoderIo(
  Pointer<SdlIoStream> dst,
  bool closeio,
  String? type,
) {
  final imgCreateAnimationEncoderIoLookupFunction = _libImage
      .lookupFunction<
        Pointer<ImgAnimationEncoder> Function(
          Pointer<SdlIoStream> dst,
          Uint8 closeio,
          Pointer<Utf8> type,
        ),
        Pointer<ImgAnimationEncoder> Function(
          Pointer<SdlIoStream> dst,
          int closeio,
          Pointer<Utf8> type,
        )
      >('IMG_CreateAnimationEncoder_IO');
  final typePointer = type != null ? type.toNativeUtf8() : nullptr;
  final result = imgCreateAnimationEncoderIoLookupFunction(
    dst,
    closeio ? 1 : 0,
    typePointer,
  );
  calloc.free(typePointer);
  return result;
}