Android. Graphics. Path

Source: Internet
Author: User

The path class encapsulates the geometric paths of linear segments, quadratic curves, and Cubic Curves composed of multiple compounds (outlines. It can be drawn with canvas. drawpath (path,
Paint), whether it is fill or touch (paint-based style), or it can be used to ripple or draw text on the path.

In short: You can use it to draw geometric figures, draw curves, and draw path-based texts. This is a drawing path class.

Use the canvas. drawpath (path1, paint) method to complete the drawing.


1. addarc (rectf oval, float startangle, float sweepangle)

Draw slice (ARC ). When the second parameter is 0, the position is the 1/2 height point on the right side of the rectangle, and 90 is the 1/2 width position at the bottom of the rectangle .... the positive value is clockwise and the negative value is clockwise. The third parameter is the drawing angle. The third parameter is 180. If it is-180, the image is reversed.

2. addcircle (float X, float y, float radius, path. Direction DIR)

Circle. The first and second parameters are the coordinates of the center, the third parameter is the radius, and the fourth parameter is clockwise or counterclockwise ?).

3. addoval (rectf oval, path. Direction DIR)

Draw an ellipse.

4. addpath (path SRC, float dx, float Dy)

Copy a path that contains everything about the copied SRC and move the distance between the second and third parameters to the X and Y axes.

5. addrect (rectf rect, path. Direction DIR)

6. addrect (float left, float top, float right, float bottom, path. Direction DIR)

Draw a rectangle. The four parameters correspond to the point at the relative distance from the origin.

7. addroundrect (rectf rect, float RX, float ry, path. Direction DIR)

Draw a rounded rectangle. 2. When the three parameters are 0, they are a rectangle. When they are 360, they are an elliptic. The second parameter refers to the angle of the X axis and determines the cross point between the X axis and the reference rectangle. The 0-determines that the cross point range is a point between the corner point and the line point.

8. arcto (rectf oval, float startangle, float sweepangle)

Equivalent to arcto (rectf oval, float startangle, float sweepangle, Boolean false ). The test found that starting from the last point, draw a line to the start point of the elliptical painting, and then draw an elliptic.

9. arcto (rectf oval, float startangle, float sweepangle, Boolean forcemoveto)

If the last parameter is true, it is equivalent to addarc (rectf oval, float startangle, float sweepangle ).

10. cubicto (float X1, float Y1, float X2, float Y2, float X3, float Y3)

Draw the besell curve. The first four parameters are two control points, and the last two parameters are the termination points. The start point is set using the moveTo (float X, float y) or setlastpoint (float dx, float Dy) methods. For more information about the besell curve, go online. Someone's blog, about this curve.

11. moveTo (float X, float y)

Set the start point of the next graph.

12. setlastpoint (float dx, float Dy)

Set the last vertex position of the image. If a closed image is drawn and the vertex is not online, the link is closed when connected to the last image ., I drew a rounded rectangle, and finally setlastpoint.

13. Close ()

Close the current image. If the last point is not the start point, draw the line from the last point to the start point. In short, you only need to draw two lines for the triangle model, and then adjust this method to complete the triangle model.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.