http://developer.android.com/reference/android/graphics/Path.html
java.lang.Object | |
↳ | android.graphics.Path |
Class Overview
The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. It can be drawn with canvas.drawPath(path, paint), either filled or stroked (based on the paint's Style), or it can be used for clipping or to draw text on a path.
Path类封装了多个化合物(轮廓)的直线段,二次曲线,三次曲线组成的几何路径。它可以绘制canvas.drawPath(路径,paint),要么填充或描边(基于paint's 风格),或者它可以用于裁剪或绘制路径上的文本。
public void moveTo (float x, float y)
Set the beginning of the next contour to the point (x,y).设定next的轮廓开始的点(X,Y)。
Parameters
x | The x-coordinate of the start of a new contour |
---|---|
y | The y-coordinate of the start of a new contour |
public void lineTo (float x, float y)
Add a line from the last point to the specified point (x,y). If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
添加一行从最后一点到指定点(X,Y)。如果没有moveTo()调用中已作出这个轮廓,第一点被自动设置为(0,0)。
添加一行从最后一点到指定点(X,Y)。如果没有moveTo()调用中已作出这个轮廓,第一点被自动设置为(0,0)。
Parameters
x | The x-coordinate of the end of a line |
---|---|
y | The y-coordinate of the end of a line |
public void reset ()
Clear any lines and curves from the path, making it empty. This does NOT change the fill-type setting.
清除任何直线和曲线路径,使它成为空的。这并没有清除填充类型设置。
public void quadTo (float x1, float y1, float x2, float y2)
Add a quadratic bezier from the last point, approaching control point (x1,y1), and ending at (x2,y2). If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).
Parameters
x1 | The x-coordinate of the control point on a quadratic curve |
---|---|
y1 | The y-coordinate of the control point on a quadratic curve |
x2 | The x-coordinate of the end point on a quadratic curve |
y2 | The y-coordinate of the end point on a quadratic curve |
二次贝塞尔加入最后一点,接近控制点(X1,Y1),和结束时(X2,Y2)。如果没有moveTo()调用中已作出这个轮廓,第一点被自动设置为(0,0)。
参数
X1 | 二次曲线的控制点的x坐标 |
---|---|
Y1 | 二次曲线的控制点上的y坐标 |
X2 | 二次曲线的终点的x坐标 |
Y2 | 二次曲线的终点y坐标 |