Android(安卓)学习 之 Canvas (一)
16lz
2021-01-24
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 简单的画图操作
- ()Android中的Activity创建与周期
- android获取/更改gps和WIFI状态
- 使用 Jetpack Security 在 Android(安卓)上进行数据加密
- android内存管理等
- Android利用Dom对XML进行增删改查操作详解
- Android数据库操作的简单封装
- Android(安卓)EditText remove focus 只要頁面中有用到EditText
- 谷歌全新操作系统Pigweed曝光,Android(安卓)11偷跑