meo-skia-canvas
    Preparing search index...

    Variable Canvas

    Canvas: { prototype: Canvas; new (width?: number, height?: number): Canvas }

    The browser Canvas constructor.

    new Canvas(w, h) returns a <canvas> element with the export methods assigned onto it, so the result is a DOM node: it can be appended to the document, and instanceof HTMLCanvasElement holds where instanceof Canvas does not.

    Unlike the Node constructor it takes no options object: pixel format, color space and renderer are the browser's to choose. Both dimensions are assigned onto the element as given, so new Canvas() is 0 x 0 rather than the 300 x 150 an empty <canvas> would be -- pass a size, or set width and height afterwards.

    Type Declaration

      • new (width?: number, height?: number): Canvas
      • Create a canvas element of width x height pixels.

        Parameters

        • Optionalwidth: number
        • Optionalheight: number

        Returns Canvas

    • prototype: Canvas

      The shape instances share. Assigning to it affects nothing: the constructor returns an element, not an object built from this.