ArcTo method of path in android

Source: Internet
Author: User

Statement:

Void android. graphics. Path. arcTo (RectF oval, float startAngle, float sweepAngle );

This method draws an arc path.

The first parameter is of the RectF type. What does this parameter do?

First, how does this arc come from? It is to draw an ellipse first, and then truncate a part of the Shape on it. This figure is naturally an arc. So how is this ellipse determined? This is the role of this rectF parameter.

:

After the rectangle is given, the system can calculate the center of the rectangle, and draw an elliptic from the center of the rectangle.

After getting this elliptic, we can take a part of the line and get the final arc. How is this part intercepted?

This is expressed by the following two parameters.

StartAngle is the starting angle. This is easy to understand, but where is the 0-degree line, and in which direction is the rotation of the positive angle degree? The following is a graphic display:

The red line shown in the figure is a 0-degree line.

StartAngle is the starting degree. What does sweepAngle mean?

SweepAngle refers to the degree of rotation, that is, the degree of rotation starting from startAngle. If sweepAngle is a positive number, it is rotated clockwise. If it is a negative number, it is rotated counterclockwise.

For example: startAngle = 0; sweepAngle = 90:

The arc of the red part is the final arc...

Related Article

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.