Java android.graphics Paint fields, constructors, methods, implement or subclass

Example usage for Java android.graphics Paint fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.graphics Paint.

The text is from its open source code.

Field

intANTI_ALIAS_FLAG
Paint flag that enables antialiasing when drawing.
intFILTER_BITMAP_FLAG
Paint flag that enables bilinear sampling on scaled bitmaps.
intDITHER_FLAG
Paint flag that enables dithering when blitting.
intUNDERLINE_TEXT_FLAG
Paint flag that applies an underline decoration to drawn text.
intSTRIKE_THRU_TEXT_FLAG
Paint flag that applies a strike-through decoration to drawn text.
intFAKE_BOLD_TEXT_FLAG
Paint flag that applies a synthetic bolding effect to drawn text.
intLINEAR_TEXT_FLAG
Paint flag that enables smooth linear scaling of text.
intSUBPIXEL_TEXT_FLAG
Paint flag that enables subpixel positioning of text.
intDEV_KERN_TEXT_FLAG
Legacy Paint flag, no longer used.
intHINTING_ON
Font hinter option that enables font hinting.

Constructor

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.

Method

floatascent()
Return the distance above (negative) the baseline (ascent) based on the current typeface and text size.
intbreakText(String text, boolean measureForwards, float maxWidth, float[] measuredWidth)
Measure the text, stopping early if the measured width exceeds maxWidth.
voidclearShadowLayer()
Clear the shadow layer.
floatdescent()
Return the distance below (positive) the baseline (descent) based on the current typeface and text size.
intgetAlpha()
Helper to getColor() that just returns the color's alpha value.
intgetColor()
Return the paint's color.
FontMetricsgetFontMetrics()
Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object.
floatgetFontMetrics(FontMetrics metrics)
Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc.
FontMetricsIntgetFontMetricsInt()
intgetFontMetricsInt(FontMetricsInt fmi)
Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc.
floatgetFontSpacing()
Return the recommend line spacing based on the current typeface and text size.
CapgetStrokeCap()
Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated.
floatgetStrokeWidth()
Return the width for stroking.
StylegetStyle()
Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes FILL_STYLE).
AligngetTextAlign()
Return the paint's Align value for drawing text.
voidgetTextBounds(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).
voidgetTextBounds(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).
voidgetTextBounds(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).
voidgetTextPath(char[] text, int index, int count, float x, float y, Path path)
Return the path (outline) for the specified text.
voidgetTextPath(String text, int start, int end, float x, float y, Path path)
Return the path (outline) for the specified text.
floatgetTextSize()
Return the paint's text size.
intgetTextWidths(String text, float[] widths)
Return the advance widths for the characters in the string.
TypefacegetTypeface()
Get the paint's typeface object.
booleanhasGlyph(String string)
Determine whether the typeface set on the paint has a glyph supporting the string.
floatmeasureText(String text)
Return the width of the text.
floatmeasureText(char[] text, int index, int count)
Return the width of the text.
floatmeasureText(String text, int start, int end)
Return the width of the text.
floatmeasureText(CharSequence text, int start, int end)
Return the width of the text.
voidreset()
Restores the paint to its default settings.
voidset(Paint src)
Copy the fields from src into this paint.
voidsetAlpha(int a)
Helper to setColor(), that only assigns the color's alpha value, leaving its r,g,b values unchanged.
voidsetAntiAlias(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.
voidsetARGB(int a, int r, int g, int b)
Helper to setColor(), that takes a,r,g,b and constructs the color int
voidsetColor(@ColorInt int color)
Set the paint's color.
ColorFiltersetColorFilter(ColorFilter filter)
Set or clear the paint's colorfilter, returning the parameter.
voidsetDither(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.
voidsetFakeBoldText(boolean fakeBoldText)
Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit
voidsetFilterBitmap(boolean filter)
Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit.
voidsetFlags(int flags)
Set the paint's flags.
MaskFiltersetMaskFilter(MaskFilter maskfilter)
Set or clear the maskfilter object.
PathEffectsetPathEffect(PathEffect effect)
Set or clear the patheffect object.
ShadersetShader(Shader shader)
Set or clear the shader object.
voidsetShadowLayer(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.
voidsetStrokeCap(Cap cap)
Set the paint's Cap.
voidsetStrokeJoin(Join join)
Set the paint's Join.
voidsetStrokeMiter(float miter)
Set the paint's stroke miter value.
voidsetStrokeWidth(float width)
Set the width for stroking.
voidsetStyle(Style style)
Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill).
voidsetSubpixelText(boolean subpixelText)
Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit
voidsetTextAlign(Align align)
Set the paint's text alignment.
voidsetTextSize(float textSize)
Set the paint's text size.
TypefacesetTypeface(Typeface typeface)
Set or clear the typeface object.
voidsetUnderlineText(boolean underlineText)
Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit
XfermodesetXfermode(Xfermode xfermode)
Set or clear the transfer mode object.