Skip to content

Image

An image to draw: a JPEG (passed through), a PNG (alpha as a soft mask) or raw RGBA pixels. The bytes are copied when the image is created. It is decoded once per WASM module, the first time a builder of that module draws it (or width/height is read), so problems with the data (invalid-image, unsupported-image, …) surface there. Written once per document however often it is drawn.

get height(): number

Height in pixels (decodes the image if no module has yet).

LaminaError as in.

number


get width(): number

Width in pixels (decodes the image if no module has yet).

LaminaError as in.

number

free(): void

Frees the image’s WASM memory now (otherwise when it is garbage-collected).

void


static jpeg(bytes): Image

A JPEG.

Uint8Array

Image


static png(bytes): Image

A PNG.

Uint8Array

Image


static rgba(width, height, pixels): Image

8-bit RGBA pixels, row by row (image-data-length at first use for a wrong length).

number

number

Uint8Array

Image