v2026.11.0
All Bundles
Bundle

SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

Image

Image loading operations

Operations

Init # function

Initialize by loading support as indicated by the flags

function : Init(flags:Int) ~ Int

Parameters

NameTypeDescription
flagsIntOR'd values ImageFlags->IMG_INIT_JPG, ImageFlags->IMG_INIT_PNG and ImageFlags->IMG_INIT_TIF

Return

TypeDescription
Intstatus code

Load # function

Load image into surface

function : Load(file:String) ~ Surface

Parameters

NameTypeDescription
fileStringfile path to image

Return

TypeDescription
Surfaceloaded surface

Quit # function

Uninitialize image library

function : Quit() ~ Nil

SavePNG # function

Save a surface as a PNG file

function : SavePNG(surface:Surface, file:String) ~ Int

Parameters

NameTypeDescription
surfaceSurfacethe surface to save
fileStringfile path to write

Return

TypeDescription
Int0 on success or a negative error code on failure; Core->GetError says why