Class AbstractCanvas2DAbstract

Base class for all canvases. A description of the public API is available in . All color values of Constants#NONE will be converted to null in the state.

Constructor: D

Constructs a new abstract canvas.

Hierarchy (view full)

Constructors

Properties

closeOp: string = 'Z'

Holds the operator for closing curves. Default is 'Z'.

converter: UrlConverter

Holds the to convert image URLs.

curveOp: string = 'C'

Contains the string used for bezier curves. Default is 'C'.

lastX: number = 0

Holds the last x coordinate.

lastY: number = 0

Holds the last y coordinate.

lineOp: string = 'L'

Contains the string used for moving in paths. Default is 'L'.

moveOp: string = 'M'

Contains the string used for moving in paths. Default is 'M'.

path: (string | number)[] = []

Holds the current path as an array.

pointerEvents: boolean = false

Boolean value that specifies if events should be handled. Default is false.

pointerEventsValue: null | string = null
quadOp: string = 'Q'

Contains the string used for quadratic paths. Default is 'Q'.

rotateHtml: boolean = true

Switch for rotation of HTML. Default is false.

state: CanvasState = ...

Holds the current state.

states: CanvasState[] = []

Stack of states.

Methods

  • Adds the given arc to the current path. This is a synthetic operation that is broken down into curves.

    Parameters

    • rx: number
    • ry: number
    • angle: number
    • largeArcFlag: boolean
    • sweepFlag: boolean
    • x: number
    • y: number

    Returns void

  • Closes the current path.

    Parameters

    • Optionalx1: number
    • Optionaly1: number
    • Optionalx2: number
    • Optionaly2: number
    • Optionalx3: number
    • Optionaly3: number

    Returns void

  • Adds a bezier curve to the current path.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number
    • x3: number
    • y3: number

    Returns void

  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number
    • src: string
    • aspect: boolean
    • flipH: boolean
    • flipV: boolean

    Returns void

  • Draws a line to the given coordinates. Uses moveTo with the op argument.

    Parameters

    • x: number
    • y: number

    Returns void

  • Adds a quadratic curve to the current path.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number

    Returns void

  • Rotates the current state.

    Parameters

    • theta: number
    • flipH: boolean
    • flipV: boolean
    • cx: number
    • cy: number

    Returns void

  • Sets the current gradient.

    Parameters

    • color1: string
    • color2: string
    • x: number
    • y: number
    • w: number
    • h: number
    • direction: DirectionValue
    • alpha1: number = 1
    • alpha2: number = 1

    Returns void