imageBufferToCanvas Function
Create a canvas element with the same dimensions and contents as an image buffer.
imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: booleantrue): HTMLCanvasElement | undefined
@returns an HTMLCanvasElement object containing the contents of the source image buffer, or undefined if the conversion fails.
Parameter | Type | Description |
---|---|---|
buffer | ImageBuffer | the source ImageBuffer object from which the HTMLCanvasElement object will be constructed. |
preserveAlpha | boolean | If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from readImageBuffer). |
Returns - HTMLCanvasElement | undefined
an HTMLCanvasElement object containing the contents of the source image buffer, or undefined if the conversion fails.
Defined in
Last Updated: 14 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.