`
heji
  • 浏览: 87595 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

小议canvas的save()和restore()

阅读更多
在Canvas的类中有两个方法大家估计也经常用到在画一些图形的时候。
在文档的中,
save()的描述是:Saves the current matrix and clip onto a private stack,意思是保存当前的矩阵到私有的堆栈。保存canvas经过一系列的旋转,平移,缩放等操作后的状态

restore()的描述是:This call balances a previous call to save(), and is used to remove all modifications to the matrix/clip state since the last save call.意思是恢复到canvas的矩阵变化前的状态,也就是调用save()之前的canvas的矩阵状态。

弄清除这些了,对图形的操作才会和自如的操作!~~
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics