pixi.js
    Preparing search index...

    Interface HTMLSourceCanvasExperimental Advanced

    An HTMLCanvasElement extended with the experimental HTML-in-Canvas proposal APIs.

    These members only exist in browsers that have the HTML-in-Canvas feature enabled, so they are optional. HTMLSource feature-detects requestPaint; the HTML-in-Canvas API must be enabled for the texture to upload.

    import type { HTMLSourceCanvas } from 'pixi.js/html-source';

    const canvas = app.canvas as HTMLSourceCanvas;

    // Feature-detect before relying on the experimental API.
    if (canvas.requestPaint)
    {
    canvas.requestPaint();
    }
    • HTMLSource For the texture source that drives these APIs
    • ElementImage For the snapshot type captureElementImage() returns
    interface HTMLSourceCanvas {
        captureElementImage?: (element: Element) => ElementImage;
        requestPaint?: () => void;
        getContext(
            contextId: "2d",
            options?: CanvasRenderingContext2DSettings,
        ): CanvasRenderingContext2D;
        getContext(
            contextId: "bitmaprenderer",
            options?: ImageBitmapRenderingContextSettings,
        ): ImageBitmapRenderingContext;
        getContext(
            contextId: "webgl",
            options?: WebGLContextAttributes,
        ): WebGLRenderingContext;
        getContext(
            contextId: "webgl2",
            options?: WebGLContextAttributes,
        ): WebGL2RenderingContext;
        getContext(contextId: string, options?: any): RenderingContext;
        getContext(contextId: "webgpu"): GPUCanvasContext;
    }

    Hierarchy

    Index
    captureElementImage?: (element: Element) => ElementImage

    Captures the current rendered pixels of element into an immutable ElementImage.

    requestPaint?: () => void

    Requests a paint event so the canvas re-snapshots its layoutsubtree children.