android paint cap join 理解 图示
来源:互联网 发布:linux windows双系统 编辑:程序博客网 时间:2024/05/29 11:20
网上查了很多资料,对paint的里面的枚举类cap join讲的不是很透彻。在这里自己做一个比较深入的研究。
首先说Cap,比较形象的解释就是 用来控制我们的画笔在离开画板时候留下的最后一点图形,比如矩形,圆形等。不懂?那接着往下看。
先看看源码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* The Cap specifies the treatment for the beginning and ending of
* stroked lines and paths. The default is BUTT.
*/
public
enum
Cap {
/**
* The stroke ends with the path, and does not project beyond it.
*/
BUTT (
0
),
/**
* The stroke projects out as a semicircle, with the center at the
* end of the path.
*/
ROUND (
1
),
/**
* The stroke projects out as a square, with the center at the end
* of the path.
*/
SQUARE (
2
);
private
Cap(
int
nativeInt) {
this
.nativeInt = nativeInt;
}
final
int
nativeInt;
}
这是cap的源码,从源码我们看到BUTT是默认的设置,但是我们看不出BUTT、ROUND、SQUARE的区别。
下面看几张图片,我想足以理解Cap的用途。
BUTTROUNDSQUARE
上表就是三种样式的区别,竖线处即为画笔结束处,图中区别明显,在此不再赘述。
接着我们看Join,Join的理解也很容易,他是用来控制画的图形接触时候的样式的。
看源码:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* The Join specifies the treatment where lines and curve segments
* join on a stroked path. The default is MITER.
*/
public
enum
Join {
/**
* The outer edges of a join meet at a sharp angle
*/
MITER (
0
),
/**
* The outer edges of a join meet in a circular arc.
*/
ROUND (
1
),
/**
* The outer edges of a join meet with a straight line
*/
BEVEL (
2
);
private
Join(
int
nativeInt) {
this
.nativeInt = nativeInt;
}
final
int
nativeInt;
}
和Cap类似,看源码也就看出了默认是MITER,其他具体形状还是难以理解。接着看图:
MITERROUNDBEVEL
上表就是三种样式的区别,区别明显,在此不再赘述。
0 0
- android paint cap join 理解 图示
- android paint cap join 理解 图示
- android paint cap join 理解 图示
- Paint.Join与Paint.Cap
- 理解CAP
- CAP定律理解
- CAP 理论的理解
- CAP 理论的理解
- 再次理解CAP
- CAP定理的理解
- CAP的理解
- CAP理论的理解
- CAP定理简单理解
- android paint
- Android Paint
- Android Paint
- Android Paint
- android-Paint
- iOS 应用件跳转到appstore相关界面
- Android之MessageQueue、Looper、Handler与消息循环
- 该怎样裁切Zbrush中的物体
- 修改Xcode自动生成的文件注释来导出API文档
- re.sub使用[]进行多目标替换
- android paint cap join 理解 图示
- Brillo系统安装指导
- 1.String、Stringbuffer、Stringbuilder之间的区别。
- GC
- Visual Assist X 安装位置
- 物流接口,自己网上拔下来的
- STM32F103RCT6控制LED
- LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
- db2 row_number() over( partition by col1 order by col2 ) 和关于fetch first n row only 的诡异