Introduction to the

The Path can be viewed as the Path of the brush to move,or the Path to draw. You can preset the Path of a custom shape for Paint to draw directly.

Commonly used functions

methods function note
moveTo(float x,float y) The pen moves to the point x,y No canvas is touched, no drawing result is generated
rMoveTo(float x,float y) Move the brush to the point (x0+x,y0+y) based on the current pen position (x0,y0) by moving x and y, respectively No canvas is touched, no drawing result is generated
setLastPoint(float x,float y) Changes the end point of the previous operation No drawing
lineTo(float x,float y) Draw a line from the current point to x and y When the pen touches the canvas, it has the actual drawing effect
rLineTo(float x,float y) From the current point (x0,y0), underline to the point (x0+x,y0+y) Have drawn
addPath(Path src) Add a path
addPath(path src,float x,float y) SRC moves (x,y) distances before adding
addPath(Path src,Matrix matrix) Use Matrix to transform and then add
close() Connect the starting point and end point of Path to form a closed graph
set(Path src) Set/replace path
offset(float dx,float dy) Path shift (x,y)
offset(float dx,float dy,Path dst) The status after path translation is saved to DST. The original path is not used. If DST is null, the original path is used
quadTo(float x1,float y1,float x2,float y2) (x1,y1) is the control point and (x2,y2) is the end point
rQuadTo(float x1,float y1,float x2,float y2) (x1,y1) is the offset from the control point to the starting point, and (x2,y2) is the offset from the end point to the starting point
cubicTo(float x1,float y1,float x2,float y2,float x3,float y3) Draw the third-order Bessel curve (x1,y1)(x2,y2) as the control point (x3,y3) as the end point
rCubicTo(float x1,float y1,float x2,float y2,float x3,float y3) The third-order Bessel curve (X1,y1)(x2,y2) is the offset of the control point from the starting point, and (x3,y3) is the offset of the end point from the starting point
addRect(RecF rect,Path.Direction dir) Draw a rectangular
addRect(float left,float top,float right,float bottom,Path.Direction dir) Draw a rectangular
addRoundRect(RectF rect,float rx,float ry,Path.Direction dir) Draw a rounded rectangle
addRoundRect(float left,float top,float right,float bottom,float rx,float ry,Path.Direction dir) Draw a rounded rectangle
addRoundRect(RectF rect,float[] radii,Path.Direction dir) Draw a rounded rectangle
addRoundRect(float left,float top,float right,float bottom,float[] radii,Path.Direction dir) Draw a rounded rectangle
addArc(RectF oval,float startAngle,float sweepAngle) Draw arc
addArc(float left,float top,float right,float bottom,float startAngle,float sweepAngle) Draw arc
arcTo(RectF oval,float startAngle,float sweepAngle,boolean forceMoveTo) Draw arc
arcTo(RectF oval,float startAngle,float sweepAngle)
arcTo(float left,float top,float right,float bottom,float startAngle,float sweepAngle,boomean forceMoveTo)
addCircle(float x,float y,float radius,Path.Direction dir) A circle
addOval(RectF oval,Path.Direction dir) Draw the ellipse
addOval(float left,float top,float right,float bottom,Path.Direction dir) The ellipse