Example usage for Java android.graphics Paint fields, constructors, methods, implement or subclass
The text is from its open source code.
int | ANTI_ALIAS_FLAG Paint flag that enables antialiasing when drawing. |
int | FILTER_BITMAP_FLAG Paint flag that enables bilinear sampling on scaled bitmaps. |
int | DITHER_FLAG Paint flag that enables dithering when blitting. |
int | UNDERLINE_TEXT_FLAG Paint flag that applies an underline decoration to drawn text. |
int | STRIKE_THRU_TEXT_FLAG Paint flag that applies a strike-through decoration to drawn text. |
int | FAKE_BOLD_TEXT_FLAG Paint flag that applies a synthetic bolding effect to drawn text. |
int | LINEAR_TEXT_FLAG Paint flag that enables smooth linear scaling of text. |
int | SUBPIXEL_TEXT_FLAG Paint flag that enables subpixel positioning of text. |
int | DEV_KERN_TEXT_FLAG Legacy Paint flag, no longer used. |
int | HINTING_ON Font hinter option that enables font hinting. |
Paint() Create a new paint with default settings. | |
Paint(int flags) Create a new paint with the specified flags. | |
Paint(Paint paint) Create a new paint, initialized with the attributes in the specified paint parameter. |
float | ascent() Return the distance above (negative) the baseline (ascent) based on the current typeface and text size. |
int | breakText(String text, boolean measureForwards, float maxWidth, float[] measuredWidth) Measure the text, stopping early if the measured width exceeds maxWidth. |
void | clearShadowLayer() Clear the shadow layer. |
float | descent() Return the distance below (positive) the baseline (descent) based on the current typeface and text size. |
int | getAlpha() Helper to getColor() that just returns the color's alpha value. |
int | getColor() Return the paint's color. |
FontMetrics | getFontMetrics() Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object. |
float | getFontMetrics(FontMetrics metrics) Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc. |
FontMetricsInt | getFontMetricsInt() |
int | getFontMetricsInt(FontMetricsInt fmi) Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc. |
float | getFontSpacing() Return the recommend line spacing based on the current typeface and text size. |
Cap | getStrokeCap() Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated. |
float | getStrokeWidth() Return the width for stroking. |
Style | getStyle() Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes FILL_STYLE). |
Align | getTextAlign() Return the paint's Align value for drawing text. |
void | getTextBounds(String text, int start, int end, Rect bounds) Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). |
void | getTextBounds(CharSequence text, int start, int end, Rect bounds) Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). |
void | getTextBounds(char[] text, int index, int count, Rect bounds) Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0). |
void | getTextPath(char[] text, int index, int count, float x, float y, Path path) Return the path (outline) for the specified text. |
void | getTextPath(String text, int start, int end, float x, float y, Path path) Return the path (outline) for the specified text. |
float | getTextSize() Return the paint's text size. |
int | getTextWidths(String text, float[] widths) Return the advance widths for the characters in the string. |
Typeface | getTypeface() Get the paint's typeface object. |
boolean | hasGlyph(String string) Determine whether the typeface set on the paint has a glyph supporting the string. |
float | measureText(String text) Return the width of the text. |
float | measureText(char[] text, int index, int count) Return the width of the text. |
float | measureText(String text, int start, int end) Return the width of the text. |
float | measureText(CharSequence text, int start, int end) Return the width of the text. |
void | reset() Restores the paint to its default settings. |
void | set(Paint src) Copy the fields from src into this paint. |
void | setAlpha(int a) Helper to setColor(), that only assigns the color's alpha value, leaving its r,g,b values unchanged. |
void | setAntiAlias(boolean aa) Helper for setFlags(), setting or clearing the ANTI_ALIAS_FLAG bit AntiAliasing smooths out the edges of what is being drawn, but is has no impact on the interior of the shape. |
void | setARGB(int a, int r, int g, int b) Helper to setColor(), that takes a,r,g,b and constructs the color int |
void | setColor(@ColorInt int color) Set the paint's color. |
ColorFilter | setColorFilter(ColorFilter filter) Set or clear the paint's colorfilter, returning the parameter. |
void | setDither(boolean dither) Helper for setFlags(), setting or clearing the DITHER_FLAG bit Dithering affects how colors that are higher precision than the device are down-sampled. |
void | setFakeBoldText(boolean fakeBoldText) Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit |
void | setFilterBitmap(boolean filter) Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit. |
void | setFlags(int flags) Set the paint's flags. |
MaskFilter | setMaskFilter(MaskFilter maskfilter) Set or clear the maskfilter object. |
PathEffect | setPathEffect(PathEffect effect) Set or clear the patheffect object. |
Shader | setShader(Shader shader) Set or clear the shader object. |
void | setShadowLayer(float radius, float dx, float dy, int shadowColor) This draws a shadow layer below the main layer, with the specified offset and color, and blur radius. |
void | setStrokeCap(Cap cap) Set the paint's Cap. |
void | setStrokeJoin(Join join) Set the paint's Join. |
void | setStrokeMiter(float miter) Set the paint's stroke miter value. |
void | setStrokeWidth(float width) Set the width for stroking. |
void | setStyle(Style style) Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill). |
void | setSubpixelText(boolean subpixelText) Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit |
void | setTextAlign(Align align) Set the paint's text alignment. |
void | setTextSize(float textSize) Set the paint's text size. |
Typeface | setTypeface(Typeface typeface) Set or clear the typeface object. |
void | setUnderlineText(boolean underlineText) Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit |
Xfermode | setXfermode(Xfermode xfermode) Set or clear the transfer mode object. |