Board logo

标题: 微信小程序save/restore(保存和恢复绘图上下文) [打印本页]

作者: vicky.yu    时间: 5 天前 13:10     标题: 微信小程序save/restore(保存和恢复绘图上下文)

canvasContext.save
定义
保存当前的绘图上下文。

restore
定义
恢复之前保存的绘图上下文。

例子
const ctx = wx.createCanvasContext('myCanvas')

// save the default fill style
ctx.save()
ctx.setFillStyle('red')
ctx.fillRect(10, 10, 150, 100)

// restore to the previous saved state
ctx.restore()
ctx.fillRect(50, 50, 150, 100)

ctx.draw()




欢迎光临 赛捷软件论坛 (http://sagesoft.cn/bbs/) Powered by Discuz! 7.2