External: CanvasRenderingContext2D

CanvasRenderingContext2D

The built-in 2D rendering context for the drawing surface of a external:canvas.

See:

Methods


CanvasRenderingContext2D#dashedLineTo(fromX, fromY, toX, toY, pattern)

Dashed line polyfill for the canvas. Note that dashed lines are expensive operations when not supported natively! @see CanvasRenderingContext2D.stxLine

Parameters:
Name Type Description
fromX number

Starting point of the X-axis

fromY number

Starting point of the Y-axis

toX number

Destination on the X-axis

toY number

Destination on the Y-axis

pattern Array.<string>

Array of stroke patterns.


CanvasRenderingContext2D#stxCircle(x, y, radius, filled)

Add native circle drawing to the canvas

Parameters:
Name Type Description
x number

X position of center of circle

y number

Y position of center of circle

radius number

Radius of circle

filled boolean

If true then circle will be filled


CanvasRenderingContext2D#stxLine(fromX, fromY, toX, toY, color, opacity, lineWidth [, pattern])

Convenience function for rendering lines of various types on the canvas.

Parameters:
Name Type Argument Description
fromX number

Starting point of the X-axis

fromY number

Starting point of the Y-axis

toX number

Destination on the X-axis

toY number

Destination on the Y-axis

color string

CSS-compatible color, such as hex, rgb, rgba or even color names such as orange.

opacity number

The alpha. A number between 0 and 1.

lineWidth number

The line width in pixels.

pattern Array.<number> <optional>

An array that contains the number of pixels on and then the number of pixels off. For instance [1,1] would create a dotted pattern by turning one pixel on and then one pixel off repeatedly.