CanvasContext.save()

保存绘图上下文。

示例代码

  1. const ctx = wx.createCanvasContext('myCanvas')
  2. // save the default fill style
  3. ctx.save()
  4. ctx.setFillStyle('red')
  5. ctx.fillRect(10, 10, 150, 100)
  6. // restore to the previous saved state
  7. ctx.restore()
  8. ctx.fillRect(50, 50, 150, 100)
  9. ctx.draw()

CanvasContext.save - 图1