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.
Accessors
Section titled “Accessors”height
Section titled “height”Get Signature
Section titled “Get Signature”get height():
number
Height in pixels (decodes the image if no module has yet).
Throws
Section titled “Throws”LaminaError as in.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get width():
number
Width in pixels (decodes the image if no module has yet).
Throws
Section titled “Throws”LaminaError as in.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”free()
Section titled “free()”free():
void
Frees the image’s WASM memory now (otherwise when it is garbage-collected).
Returns
Section titled “Returns”void
jpeg()
Section titled “jpeg()”
staticjpeg(bytes):Image
A JPEG.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”Image
staticpng(bytes):Image
A PNG.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”Image
rgba()
Section titled “rgba()”
staticrgba(width,height,pixels):Image
8-bit RGBA pixels, row by row (image-data-length at first use for a wrong length).
Parameters
Section titled “Parameters”number
height
Section titled “height”number
pixels
Section titled “pixels”Uint8Array
Returns
Section titled “Returns”Image