Definition and use of several enumeration in paint. Java of Android

Source: Internet
Author: User
Definition and use of several enumeration in paint. Java of Android

Frameworks \ base \ graphics \ Java \ Android \ graphics \ paint. Java

Definition:

    /**     * The Style specifies if the primitive being drawn is filled,     * stroked, or both (in the same color). The default is FILL.     */    public enum Style {        /**         * Geometry and text drawn with this style will be filled, ignoring all         * stroke-related settings in the paint.         */        FILL            (0),        /**         * Geometry and text drawn with this style will be stroked, respecting         * the stroke-related fields on the paint.         */        STROKE          (1),        /**         * Geometry and text drawn with this style will be both filled and         * stroked at the same time, respecting the stroke-related fields on         * the paint.         */        FILL_AND_STROKE (2);                Style(int nativeInt) {            this.nativeInt = nativeInt;        }        final int nativeInt;    }    /**     * 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;    }    /**     * 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;    }    /**     * Align specifies how drawText aligns its text relative to the     * [x,y] coordinates. The default is LEFT.     */    public enum Align {        /**         * The text is drawn to the right of the x,y origin         */        LEFT    (0),        /**         * The text is drawn centered horizontally on the x,y origin         */        CENTER  (1),        /**         * The text is drawn to the left of the x,y origin         */        RIGHT   (2);                private Align(int nativeInt) {            this.nativeInt = nativeInt;        }        final int nativeInt;    }

Usage:

    private static final Style[] sStyleArray = {        Style.FILL, Style.STROKE, Style.FILL_AND_STROKE    };    private static final Cap[] sCapArray = {        Cap.BUTT, Cap.ROUND, Cap.SQUARE    };    private static final Join[] sJoinArray = {        Join.MITER, Join.ROUND, Join.BEVEL    };    private static final Align[] sAlignArray = {        Align.LEFT, Align.CENTER, Align.RIGHT    };

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.