Android paint cap join

Source: Internet
Author: User

Android paint cap join

 

I checked a lot of information on the Internet, but it was not very thorough about the enumeration class cap join in the paint. Here I will do a more in-depth study.

First of all, Cap is used to control the last image left by the paint brush when it leaves the canvas, such as a rectangle or a circle. Don't you understand? Then let's look down.

First look at the source code:

 

    /**     * The Cap specifies the treatment for the beginning and ending of     * stroked lines and paths. The default is BUTT.     */    public enum Cap {        /**         * The stroke ends with the path, and does not project beyond it.         */        BUTT    (0),        /**         * The stroke projects out as a semicircle, with the center at the         * end of the path.         */        ROUND   (1),        /**         * The stroke projects out as a square, with the center at the end         * of the path.         */        SQUARE  (2);                private Cap(int nativeInt) {            this.nativeInt = nativeInt;        }        final int nativeInt;    }

This is the cap source code. From the source code, we can see that BUTT is the default setting, but we cannot see the difference between BUTT, ROUND, and SQUARE.

 

I want to understand the use of Cap.

 

BUTT
ROUND
SQUARE

 

The above table shows the differences between the three styles. The vertical line is the paint brush end. The difference is obvious in the figure and will not be repeated here.

 

Then let's look at Join. Join is easy to understand. It is used to control the style of the drawing when it comes to contact.

View Source Code:

 

    /**     * The Join specifies the treatment where lines and curve segments     * join on a stroked path. The default is MITER.     */    public enum Join {        /**         * The outer edges of a join meet at a sharp angle         */        MITER   (0),        /**         * The outer edges of a join meet in a circular arc.         */        ROUND   (1),        /**         * The outer edges of a join meet with a straight line         */        BEVEL   (2);                private Join(int nativeInt) {            this.nativeInt = nativeInt;        }        final int nativeInt;    }

Similar to Cap, the source code shows that the default is MITER, and other specific shapes are hard to understand. See the figure below:

 

 

MITER
ROUND
BEVEL

 

The above table shows the differences among the three styles. The differences are obvious and we will not repeat them here.

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.