These docs describe changes that aren’t released yet. For the newest release, see the released docs.
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. It keeps its bytes, so it outlives reset() and decodes again.
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”LaminaPdfError 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”LaminaPdfError as in.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Frees the image at the end of a using block (an alias of free()).
Returns
Section titled “Returns”void
free()
Section titled “free()”free():
void
Frees the image’s WASM memory now; without it, the garbage collector frees it later. A second
call does nothing, and any other call afterwards throws disposed. Prefer using.
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