Android 学习 之 Canvas (一) androidapicanvassave()restore()
程序员文章站
2024-03-14 16:18:28
...
1.官方API文档中对save()方法的解释:
public class Canvas { /** * Saves the current matrix and clip onto a private stack. Subsequent * calls to translate,scale,rotate,skew,concat or clip Rect,clipPath * will all operate as usual, but when the balancing call to restore() * is made, those calls will be forgotten, and the settings that existed * before the save() will be reinstated. */ /** * 保存当前的矩阵和剪裁到一个私有的堆栈,其实矩阵和剪裁就是当前Canvas的状态State
接着调用位置,缩放,选择,倾斜,concat或者剪辑矩形,剪辑区域等将被正常操作,但是
当restore()被调用,恢复时,这些操作都将被放弃,并且刚才调用save()之前被保存的状态将被重新恢复。
*/ public native int save(); }
public class Canvas { /** * 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. */ /** * 移除自上次保存操作后所做的修改,恢复到之前的状态,因为是堆栈实现,所以pull操作不能不等于push操作,save()和restore()应该成对使用,否则恢复的状态就很有可能是错误的 */ public native void restore(); }
推荐阅读
-
Android 学习 之 Canvas (一) androidapicanvassave()restore()
-
Android学习项目之简易版微信为例(一)
-
Android学习项目之简易版微信为例(一)
-
canvas游戏开发学习之五:运用样式与颜色(一)
-
Android开发之图形图像与动画(一)Paint和Canvas类学习
-
Android开发之图形图像与动画(一)Paint和Canvas类学习
-
android学习笔记之自定义View之实现一个简单的加载动画
-
canvas游戏开发学习之五:运用样式与颜色(一)
-
一、android学习之Hello word
-
一、android学习之Hello word