skia
    Preparing search index...

    Interface EmulatedCanvas2D

    interface EmulatedCanvas2D {
        decodeImage(bytes: ArrayBuffer | Uint8Array<ArrayBufferLike>): Image;
        dispose(): void;
        getContext(type: string): CanvasRenderingContext2D | null;
        loadFont(
            bytes: ArrayBuffer | Uint8Array<ArrayBufferLike>,
            descriptors: Record<string, string>,
        ): void;
        makePath2D(str?: string): Path2D;
        toDataURL(codec?: string, quality?: number): string;
    }
    Index

    Methods

    • Decodes an image with the given bytes.

      Parameters

      • bytes: ArrayBuffer | Uint8Array<ArrayBufferLike>

      Returns Image

    • Cleans up all resources associated with this emulated canvas.

      Returns void

    • Returns an emulated canvas2d context if type == '2d', null otherwise.

      Parameters

      • type: string

      Returns CanvasRenderingContext2D | null

    • Loads the given font with the given descriptors. Emulates new FontFace().

      Parameters

      • bytes: ArrayBuffer | Uint8Array<ArrayBufferLike>
      • descriptors: Record<string, string>

      Returns void

    • Returns an new emulated Path2D object.

      Parameters

      • Optionalstr: string

        an SVG string representing a path.

      Returns Path2D

    • Returns the current canvas as a base64 encoded image string.

      Parameters

      • Optionalcodec: string

        image/png by default; image/jpeg also supported.

      • Optionalquality: number

      Returns string