//设置去锯齿
paint.setAntiAlias()
//设置线条宽度
paint.setStrokeWidth:
canvas.drawCircle(40,40,30,paint)//画圆
//public void drawCircle (float cx, float cy, float radius, Paint paint)
/*
cx The x-coordinate of the center of the cirle to be drawn
cy The y-coordinate of the center of the cirle to be drawn
radius The radius of the cirle to be drawn
paint The paint used to draw the circle*/
canvas.drawRect (float left, float top, float right, float bottom, Paint paint)//矩形
//画多边形
path.moveTo(float x, float y)
//Set the beginning of the next contour to the point (x,y).
path.lineTo(float x, float y)
//Add a line from the last point to the specified point (x,y).
path.Close();
/*Close the current contour. If the current point is not equal to the first point of the contour,
a line segment is automatically added.*/
canvas.drawPath (Path path, Paint paint)
/*--------------设置渐变器后绘制-------------------*/
Shader shader=public LinearGradient (float x0, float y0, float x1, float y1, int[] colors, float[] positions, Shader.TileMode tile)
paint.setShader(shader);
//设置阴影层
paint.setShaderLayer();
---------------------Path类-----------------------------
PathEffect effects=new PathEffect();
effects[1]=new CornerPathEffect(10);
effects[2]=new
/*
public CornerPathEffect (float radius)
Transforms geometries that are drawn (either STROKE or FILL styles) by replacing any sharp angles between line segments into rounded angles of the specified radius.
Parameters
radius Amount to round sharp angles between line segments. */
/*public DashPathEffect (float[] intervals, float phase)
The intervals array must contain an even number of entries (>=2), with the even indices specifying the "on" intervals, and the odd indices specifying the "off" intervals. phase is an offset into the intervals array (mod the sum of all of the intervals). The intervals array controls the length of the dashes. The paint's strokeWidth controls the thickness of the dashes. Note: this patheffect only affects drawing with the paint's style is set to STROKE or FILL_AND_STROKE. It is ignored if the drawing is done with style == FILL.
Parameters
intervals array of ON and OFF distances
phase offset into the intervals array
*/
Drawable
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 系统启动调用drawable中图片的过程图,如果图片过大,放置文件夹不对,会加重cpu计算负担,造成卡顿: 怎么在...
- 1. 概述 对于Drawable,相信大家都不陌生,而且用起来非常方便。在Android中Drawable代表可以...
- http://blog.csdn.net/guolin_blog/article/details/50727753
- 我发现android studio有一个奇怪的现象,不知是不是bug。当我使用, 用单独标签“color”,用te...