当前位置:K88软件开发文章中心编程全书微信小程序 → 文章内容

微信小程序save/restore(保存和恢复绘图上下文)

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:01:01

由 ?﹏???ζ???﹏﹏? 创建,youj 最后一次修改 2016-12-26 绘图接口和方法canvasContext.save定义保存当前的绘图上下文。restore定义恢复之前保存的绘图上下文。例子const ctx = wx.createCanvasContext('myCanvas')// save the default fill stylectx.save() ctx.setFillStyle('red')ctx.fillRect(10, 10, 150, 100)// restore to the previous saved statectx.restore()ctx.fillRect(50, 50, 150, 100)ctx.draw()绘图接口和方法

微信小程序save/restore(保存和恢复绘图上下文)