imgSaveAvif function
Save an SDL_Surface into a AVIF image file.
If the file already exists, it will be overwritten.
\param surface the SDL surface to save. \param file path on the filesystem to write new file to. \param quality the desired quality, ranging between 0 (lowest) and 100 (highest). \returns true on success or false on failure; call SDL_GetError() for more information.
\since This function is available since SDL_image 3.0.0.
\sa IMG_SaveAVIF_IO
extern SDL_DECLSPEC bool SDLCALL IMG_SaveAVIF(SDL_Surface *surface, const char *file, int quality)
Implementation
bool imgSaveAvif(Pointer<SdlSurface> surface, String? file, int quality) {
final imgSaveAvifLookupFunction = libSdl3Image.lookupFunction<
Uint8 Function(
Pointer<SdlSurface> surface, Pointer<Utf8> file, Int32 quality),
int Function(Pointer<SdlSurface> surface, Pointer<Utf8> file,
int quality)>('IMG_SaveAVIF');
final filePointer = file != null ? file.toNativeUtf8() : nullptr;
final result = imgSaveAvifLookupFunction(surface, filePointer, quality) == 1;
calloc.free(filePointer);
return result;
}