window.kaolin
    Preparing search index...

    Function drawTypedArrayToCanvas

    • Draw a shaped typed-array buffer directly to a canvas element.

      Accepts Uint8ClampedArray, Uint8Array, or ArrayBuffer with a .shape property of [height, width, channels]. Only 4-channel (RGBA) input is supported; the byte length must equal height * width * 4.

      Parameters

      • canvasOrId: CanvasOrId

        Canvas element or its DOM id.

      • data:
            | ShapedTypedArray<Uint8ClampedArray<ArrayBufferLike>>
            | ShapedTypedArray<Uint8Array<ArrayBufferLike>>
            | ArrayBuffer & { shape: number[] }

        RGBA pixel data with a .shape property [height, width, ...].

      Returns boolean

      true if successful, false otherwise.