Canvas.Context2d Class
Wrapper for a canvas 2d context. It exposes the exact same api as the native 2d context, plus some extras, documented below. Just like Y.Node, use get() and set() to modify attributes.
Constructor
Canvas.Context2d
-
node -
config
Parameters:
-
nodeY.Nodethe canvas element
-
configObject-
pixelAlign=trueBooleanPass true to get thinner, cleaner strokes. Pass false to get the default rendering.
-
Methods
get
-
name
Get an attribute. This accepts all attributes of the context and the special name "pixelAlign".
Parameters:
-
nameStringthe attribute name
Returns:
the attribute value
line
-
dx -
dy
Move relative to the current pen location. This only works when the transformation matrix is constant!
Parameters:
-
dxInt -
dyInt
move
-
dx -
dy
Move relative to the current pen location (set via moveTo or move). This only works when the transformation matrix is constant!
Parameters:
-
dxInt -
dyInt
poly
-
list
Draw a polygon from a set of deltas.
Parameters:
-
listArrayList of deltas (dx,dy). You can omit values that are zero.
roundedRect
-
top -
left -
bottom -
right -
radius
Define a rectangle with rounded corners. You must call stroke(), fill(), etc. afterwards.
Parameters:
-
topInt -
leftInt -
bottomInt -
rightInt -
radiusIntradius of rounded corners
set
-
name -
value
Set an attribute. This accepts all attributes of the context and the special name "pixelAlign".
Parameters:
-
nameStringthe attribute name
-
valueMixedthe attribute value
