# CanvasContext.rect(number x, number and number width, number height)

with Promise style call: Not supported

Mini Program plugin: Support

Creates a rectangular path. Need fill or stroke Method draws the rectangle to the canvas in

# parameter

# number x

The upper-left abscissa of a rectangular path

# number and

The ordinate of the upper-left corner of a rectangular path

# number width

Width of Rectangular Path

# number height

Height of rectangular path

# sample code

const ctx = wx.createCanvasContext('myCanvas')
ctx.rect(10, 10, 150, 75)
ctx.setFillStyle('red')
ctx.fill()
ctx.draw()