Module

x/canvas/mod.ts

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Go to Latest
interface MallocObj
import { type MallocObj } from "https://deno.land/x/canvas@v1.0.0/mod.ts";

This object is a wrapper around a pointer to some memory on the WASM heap. The type of the pointer was determined at creation time.

Properties

readonly
length: number

The number of objects this pointer refers to.

readonly
byteOffset: number

The "pointer" into the WASM memory. Should be fixed over the lifetime of the object.

Methods

subarray(start: number, end: number): TypedArray

Return a read/write view into a subset of the memory. Do not cache the TypedArray this returns, it may be invalidated if the WASM heap is resized. This is the same as calling .toTypedArray().subarray() except the returned TypedArray can also be passed into an API and not cause an additional copy.

toTypedArray(): TypedArray

Return a read/write view of the memory. Do not cache the TypedArray this returns, it may be invalidated if the WASM heap is resized. If this TypedArray is passed into a CanvasKit API, it will not be copied again, only the pointer will be re-used.