Android Guides | Samples

Android.Graphics.Paint Class

The Paint class holds the style and color information about how to draw geometries, text and bitmaps.

See Also: Paint

Syntax

[Android.Runtime.Register("android/graphics/Paint", DoNotGenerateAcw=true)]
public class Paint : Object

Remarks

The Paint class holds the style and color information about how to draw geometries, text and bitmaps.

[Android Documentation]

Requirements

Namespace: Android.Graphics
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Graphics.Paint are listed below.

See Also: Object

Public Constructors

Create a new paint with default settings.
Create a new paint, initialized with the attributes in the specified paint parameter.
Create a new paint with the specified flags.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
HintingOffPaintHinting (0). Font hinter option that disables font hinting.
const
HintingOnPaintHinting (1). Font hinter option that enables font hinting.

Public Properties

AlphaInt32. Helper to getColor() that just returns the color's alpha value.
AntiAliasBoolean. Helper for getFlags(), returning true if ANTI_ALIAS_FLAG bit is set AntiAliasing smooths out the edges of what is being drawn, but is has no impact on the interior of the shape.
ColorColor. Return the paint's color.
[read-only]
ColorFilterColorFilter. Get the paint's colorfilter (maybe be null).
DitherBoolean. Helper for getFlags(), returning true if DITHER_FLAG bit is set Dithering affects how colors that are higher precision than the device are down-sampled.
ElegantTextHeightBoolean. Get the elegant metrics flag.
FakeBoldTextBoolean. Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set
FilterBitmapBoolean. Whether or not the bitmap filter is activated.
FlagsPaintFlags. Return the paint's flags.
FontFeatureSettingsString. Get font feature settings.
[read-only]
FontSpacingSingle. Return the recommend line spacing based on the current typeface and text size.
HintingPaintHinting. Return the paint's hinting mode.
LetterSpacingSingle. Return the paint's letter-spacing for text.
LinearTextBoolean. Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set
[read-only]
MaskFilterMaskFilter. Get the paint's maskfilter object.
[read-only]
PathEffectPathEffect. Get the paint's patheffect object.
[read-only]
RasterizerRasterizer. Get the paint's rasterizer (or null).
[read-only]
ShaderShader. Get the paint's shader object.
StrikeThruTextBoolean. Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set
StrokeCapPaint+Cap. Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated.
StrokeJoinPaint+Join. Return the paint's stroke join type.
StrokeMiterSingle. Return the paint's stroke miter value.
StrokeWidthSingle. Return the width for stroking.
SubpixelTextBoolean. Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set
TextAlignPaint+Align. Return the paint's Align value for drawing text.
TextLocaleLocale. Get the text Locale.
TextScaleXSingle. Return the paint's horizontal scale factor for text.
TextSizeSingle. Return the paint's text size.
TextSkewXSingle. Return the paint's horizontal skew factor for text.
[read-only]
TypefaceTypeface. Get the paint's typeface object.
UnderlineTextBoolean. Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set
[read-only]
XfermodeXfermode. Get the paint's xfermode object.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Ascent() : Single
Return the distance above (negative) the baseline (ascent) based on the current typeface and text size.
BreakText(String, Boolean, Single, Single[]) : Int32
Measure the text, stopping early if the measured width exceeds maxWidth.
BreakText(Char[], Int32, Int32, Single, Single[]) : Int32
Measure the text, stopping early if the measured width exceeds maxWidth.
BreakText(ICharSequence, Int32, Int32, Boolean, Single, Single[]) : Int32
Measure the text, stopping early if the measured width exceeds maxWidth.
BreakText(String, Int32, Int32, Boolean, Single, Single[]) : Int32
ClearShadowLayer()
Clear the shadow layer.
Descent() : Single
Return the distance below (positive) the baseline (descent) based on the current typeface and text size.
GetFillPath(Path, Path) : Boolean
Applies any/all effects (patheffect, stroking) to src, returning the result in dst.
GetFontMetrics() : Paint+FontMetrics
Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object.
GetFontMetrics(Paint+FontMetrics) : Single
Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc.
GetFontMetricsInt() : Paint+FontMetricsInt
GetFontMetricsInt(Paint+FontMetricsInt) : Int32
Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc.
GetStyle() : Paint+Style
Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes FILL_STYLE).
GetTextBounds(Char[], Int32, Int32, Rect)
Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0).
GetTextBounds(String, Int32, Int32, Rect)
Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0).
GetTextPath(Char[], Int32, Int32, Single, Single, Path)
Return the path (outline) for the specified text.
GetTextPath(String, Int32, Int32, Single, Single, Path)
Return the path (outline) for the specified text.
GetTextWidths(String, Single[]) : Int32
Return the advance widths for the characters in the string.
GetTextWidths(ICharSequence, Int32, Int32, Single[]) : Int32
Return the advance widths for the characters in the string.
GetTextWidths(Char[], Int32, Int32, Single[]) : Int32
Return the advance widths for the characters in the string.
GetTextWidths(String, Int32, Int32, Single[]) : Int32
Return the advance widths for the characters in the string.
MeasureText(String) : Single
Return the width of the text.
MeasureText(ICharSequence, Int32, Int32) : Single
Return the width of the text.
MeasureText(Char[], Int32, Int32) : Single
Return the width of the text.
MeasureText(String, Int32, Int32) : Single
Return the width of the text.
Reset()
Restores the paint to its default settings.
Set(Paint)
Copy the fields from src into this paint.
SetARGB(Int32, Int32, Int32, Int32)
Helper to setColor(), that takes a,r,g,b and constructs the color int
SetColorFilter(ColorFilter) : ColorFilter
Set or clear the paint's colorfilter, returning the parameter.
SetMaskFilter(MaskFilter) : MaskFilter
Set or clear the maskfilter object.
SetPathEffect(PathEffect) : PathEffect
Set or clear the patheffect object.
SetRasterizer(Rasterizer) : Rasterizer
Set or clear the rasterizer object.
SetShader(Shader) : Shader
Set or clear the shader object.
SetShadowLayer(Single, Single, Single, Color)
This draws a shadow layer below the main layer, with the specified offset and color, and blur radius.
SetStyle(Paint+Style)
Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill).
SetTypeface(Typeface) : Typeface
Set or clear the typeface object.
SetXfermode(Xfermode) : Xfermode
Set or clear the xfermode object.