canvas的save()和restore()运用
2015-09-28 13:45
525 查看
关键字:Android,Canvas,save(),restore()3
p) v8 n* \7 d6 r+ Z
int android.graphics.Canvas.save()4
A4 K- S+ r; p* B4 x" f+ k( ^0 d
Saves the current matrix and clip onto a private stack. Subsequent calls to translate,scale,rotate,skew,concat or clipRect,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.
; [( ~4 t6 g8 k; ]! W. `. n: Z2 W- L
Returns:
The value to pass to restoreToCount() to balance this save()-
J. A7 f% r0 o5 x
void android.graphics.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.4 h& V, V) Z( j F
Canvas的save()和restore()只是对Canvas的Matrix和Clip相关的内容进行保存和恢复。/
h1 P6 U. }+ v! J
l$ u$ f% U: J5 h
在下面的示例代码中,原始的样子是这样的:.
a4 [, ^: y2 q
如果注释掉了canvas.save();和canvas.restore();就会变成下面这样:9
l" g* L+ i) ]. t. v* Z
p) v8 n* \7 d6 r+ Z
int android.graphics.Canvas.save()4
A4 K- S+ r; p* B4 x" f+ k( ^0 d
Saves the current matrix and clip onto a private stack. Subsequent calls to translate,scale,rotate,skew,concat or clipRect,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.
; [( ~4 t6 g8 k; ]! W. `. n: Z2 W- L
Returns:
The value to pass to restoreToCount() to balance this save()-
J. A7 f% r0 o5 x
void android.graphics.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.4 h& V, V) Z( j F
Canvas的save()和restore()只是对Canvas的Matrix和Clip相关的内容进行保存和恢复。/
h1 P6 U. }+ v! J
l$ u$ f% U: J5 h
在下面的示例代码中,原始的样子是这样的:.
a4 [, ^: y2 q
如果注释掉了canvas.save();和canvas.restore();就会变成下面这样:9
l" g* L+ i) ]. t. v* Z
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories