亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

微信小程序開發(fā)文檔 / 微信小程序API 繪圖fill(對當(dāng)前路徑進(jìn)行填充)

微信小程序API 繪圖fill(對當(dāng)前路徑進(jìn)行填充)

fill


定義

對當(dāng)前路徑中的內(nèi)容進(jìn)行填充。默認(rèn)的填充色為黑色。

Tip: 如果當(dāng)前路徑?jīng)]有閉合,fill() 方法會將起點(diǎn)和終點(diǎn)進(jìn)行連接,然后填充,詳情見例一。

Tip: fill() 填充的的路徑是從 beginPath() 開始計(jì)算,但是不會將 fillRect() 包含進(jìn)去,詳情見例二。

例子

const ctx = wx.createCanvasContext('myCanvas')
ctx.moveTo(10, 10)
ctx.lineTo(100, 10)
ctx.lineTo(100, 100)
ctx.fill()
ctx.draw()

201612241559547166.png

const ctx = wx.createCanvasContext('myCanvas')// begin pathctx.rect(10, 10, 100, 30)
ctx.setFillStyle('yellow')
ctx.fill()// begin another pathctx.beginPath()
ctx.rect(10, 40, 100, 30)// only fill this rect, not in current pathctx.setFillStyle('blue')
ctx.fillRect(10, 70, 100, 30)

ctx.rect(10, 100, 100, 30)// it will fill current pathctx.setFillStyle('red')
ctx.fill()
ctx.draw()

201612241600026426.png