Canvas implementation of the Drawing class.
CanvasDrawing is not intended to be used directly. Instead, use the Drawing class.
If the browser lacks SVG capabilities but has
Canvas capabilities, the Drawing
class will point to the CanvasDrawing class.
_clearAndUpdateCoordsClears the coordinate arrays. Called at the end of a drawing operation.
_createGraphicCreates canvas element
HTMLCanvasElement
_curveToargs
relative
Implements curveTo methods.
_getLinearGradientReturns a linear gradient fill
CanvasGradient
_getRadialGradientReturns a radial gradient fill
CanvasGradient
_initPropsClears all values
_lineToargs
relative
Implements lineTo methods.
_moveToargs
relative
Implements moveTo methods.
_quadraticCurveToargs
relative
Implements quadraticCurveTo methods.
_setCurveBoundingBoxArray
Number
Number
Calculates the bounding box for a curve
_toRGBAval
alpha
Parses hex color string and alpha value to rgba
_trackSizew
h
Updates the size of the graphics object
_updateCoordsx
y
Tracks coordinates. Used to calculate the start point of dashed lines.
_updateDrawingQueueval
Queues up a method to be executed when a shape redraws.
val
Array
An array containing data that can be parsed into a method and arguments. The value at zero-index
of the array is a string reference of the drawing method that will be called. All subsequent indices are argument for
that method. For example, lineTo(10, 100) would be structured as:
["lineTo", 10, 100].
_updateNodePositionMoves the shape's dom node.
clearClears the graphics object.
closePathEnds a fill and stroke
curveTocp1x
cp1y
cp2x
cp2y
x
y
Draws a bezier curve.
drawCirclex
y
r
Draws a circle. Used internally by CanvasCircle class.
drawDiamondx
y
width
height
Draws a diamond.
drawEllipsex
y
w
h
Draws an ellipse. Used internally by CanvasEllipse class.
drawRectx
y
w
h
Draws a rectangle.
drawRectx
y
w
h
ew
eh
Draws a rectangle with rounded corners.
drawWedgex
y
startAngle
arc
radius
yRadius
Draws a wedge.
x
Number
x-coordinate of the wedge's center point
y
Number
y-coordinate of the wedge's center point
startAngle
Number
starting angle in degrees
arc
Number
sweep of the wedge. Negative values draw clockwise.
radius
Number
radius of wedge. If [optional] yRadius is defined, then radius is the x radius.
yRadius
Number
[optional] y radius for wedge.
endCompletes a drawing operation.
getBezierDataArray
Number
Returns the points on a curve
Array
lineTopoint1
point2
Draws a line segment from the current drawing position to the specified x and y coordinates.
moveTox
y
Moves the current drawing position to specified x and y coordinates.
quadraticCurveTocpx
cpy
x
y
Draws a quadratic bezier curve.
relativeCurveTocp1x
cp1y
cp2x
cp2y
x
y
Draws a bezier curve relative to the current coordinates.
relativeLineTopoint1
point2
Draws a line segment from the current drawing position to the relative x and y coordinates.
relativeMoveTox
y
Moves the current drawing position relative to specified x and y coordinates.
relativeQuadraticCurveTocpx
cpy
x
y
Draws a quadratic bezier curve relative to the current position.