您的位置:首页 > 其它

Canvas.save() Canvasre.restore()小区别

2016-09-03 00:20 274 查看
Canvas.save()存储画布当前的状态,Canvas.restore()恢复画布的旋转缩放之前的状态,到之前save时画布的状态 restore()只返回上一次save()的状态 ,不跳跃返回。

api解释: Canvas.save()

Saves the current matrix and clip onto a private stack.

api解释: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. It is an error to call restore() more times than save() was called.

要注意restore()方法跟save()方法之间的对应。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: