The ArcTo method of path in Android

Source: Internet
Author: User

Declared as:

void Android.graphics.Path.arcTo (RECTF oval, float startangle, float sweepangle);

The method is to draw an arc of the path.

The first parameter is a RECTF type. What is this parameter?

First of all, how does this arc come from? It is to draw an ellipse first and then intercept part of the shape above the ellipse. This graph is naturally an arc. So how does this ellipse work? This is what this RECTF parameter does.

As shown in the figure:

Given this rectangle, the system can work out the center of the rectangle and then draw an ellipse with the center of the moment.

After you get this ellipse, then you intercept a portion of the line, and you get the final arc. How is this part intercepted?

This is the following two parameters to express together.

StartAngle This argument is about the starting angle. This is a good understanding, but where is the 0 degree, and in which direction rotation is the positive angle number? The following graphic shows:

The red line shown on the figure is 0 degrees.

StartAngle is the beginning of the degree, what is the sweepangle?

Sweepangle refers to the degree of rotation, that is, starting with startangle, how many degrees of rotation, if the sweepangle is a positive number, it is clockwise rotation, if the negative number is in the counterclockwise direction of rotation.

If the example: startangle = 0; When 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.