CanvasContext.restore()

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

示例代码

  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.restore - 图1