WeChat program API drawing
May 19, 2021
WeChat Mini Program Development Document
Table of contents
API interface
The method list for the context object
Color, style, shadow
Gradient
Line style
Rectangular
Method
|
Description
|
rect
|
Create a rectangle
|
fillRect
|
Fill a rectangle
|
strokeRect
|
Draw a rectangle (not filled)
|
clearRect
|
In a given rectangular area, clear the pixels on the canvas
|
Path
Method
|
Description
|
fill
|
Fill the current path
|
stroke
|
Stroke the current path
|
beginPath
|
Start a path
|
closePath
|
Close a path
|
moveTo
|
Move the path to the specified point in the canvas, but do not create lines.
|
lineTo
|
Add a new point, and then create a line in the canvas from that point to the last specified point.
|
arc
|
Add an arc path to the current path and draw clockwise.
|
quadraticCurveTo
|
Create a second Fang Besier curve
|
bezierCurveTo
|
Create a three-way Basser curve
|
Deformation
method
|
illustrate
|
scale
|
Zeng
|
rotate
|
Cut the coordinate axis rotate clockwise
|
translate
|
Zoom in the origin of the coordinate
|
Word
Image
Method
|
Description
|
drawImage
|
Draw an image on the canvas
|
Mixed
Other
Method
|
Description
|
save
|
Save the current drawing context
|
restore
|
Restore the previously protected drawing context
|
draw
|
Draw
|
getActions
(not recommended)
|
Gets the
context
stored on the current context
|
clearActions
(not recommended)
|
Empty the current stored drawing action
|