Module images
Images: HTMLImageElement (<img> and <input type=image>) and decoding image files from buffers. naturalWidth and naturalHeight are density-corrected CSS pixels (0 until the image is available).
Exposed to: Window, Worker. Source: api/images.widl.
Odin: import "wren:images".
Types
handle HTMLImageElement : Element
Checked by the browser on every call (lookup_HTMLImageElement).
Functions
HTMLImageElement_naturalWidth
i32 HTMLImageElement_naturalWidth(HTMLImageElement image)Host: HTMLImageElement_naturalWidth :: proc(c: ^Call, image: Api_HTMLImageElement) -> i32
HTMLImageElement_naturalHeight
i32 HTMLImageElement_naturalHeight(HTMLImageElement image)Host: HTMLImageElement_naturalHeight :: proc(c: ^Call, image: Api_HTMLImageElement) -> i32
HTMLImageElement_complete
bool HTMLImageElement_complete(HTMLImageElement image)Host: HTMLImageElement_complete :: proc(c: ^Call, image: Api_HTMLImageElement) -> bool
HTMLImageElement_currentSrc
string HTMLImageElement_currentSrc(HTMLImageElement image)The absolute URL of the chosen source ("" when none).
Host: HTMLImageElement_currentSrc :: proc(c: ^Call, image: Api_HTMLImageElement) -> string
HTMLImageElement_decode
Promise HTMLImageElement_decode(HTMLImageElement image)image.decode(): settles (value 0) once decoded at its natural size; rejected with Encoding when it is broken or its source changes first.
Host: HTMLImageElement_decode :: proc(c: ^Call, image: Api_HTMLImageElement) -> u64
Image_decode
Promise<Buffer> Image_decode(Buffer data)Decodes an image file (PNG, JPEG, GIF, BMP, ICO, TIFF, WebP / AVIF where the codecs exist) on the decoding threads: settles with a buffer of RGBA8 pixels (straight alpha, sRGB, rows top-down) as value and "<width>x<height>" as text (first frame of an animation). Rejected with Encoding (not an image, corrupt, over the limits) or Quota.
Host: Image_decode :: proc(c: ^Call, data: Api_Buffer) -> u64