Paint Paint Class

Definition

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

[Android.Runtime.Register("android/graphics/Paint", ApiSince=1, DoNotGenerateAcw=true)]
public class Paint : Java.Lang.Object
type Paint = class
    inherit Object
Inheritance
Derived
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Paint() Paint()

Create a new paint with default settings.

Paint(IntPtr, JniHandleOwnership) Paint(IntPtr, JniHandleOwnership)

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

Paint(Paint) Paint(Paint)

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

Paint(PaintFlags) Paint(PaintFlags)

Create a new paint with the specified flags.

Fields

HintingOff HintingOff

Font hinter option that disables font hinting.

HintingOn HintingOn

Font hinter option that enables font hinting.

Properties

Alpha Alpha

Helper to getColor() that just returns the color's alpha value.

AntiAlias AntiAlias

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.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Color Color

Return the paint's color.

ColorFilter ColorFilter

Get the paint's colorfilter (maybe be null).

Dither Dither

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.

ElegantTextHeight ElegantTextHeight

Get the elegant metrics flag.

FakeBoldText FakeBoldText

Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set

FilterBitmap FilterBitmap

Whether or not the bitmap filter is activated.

Flags Flags

Return the paint's flags.

FontFeatureSettings FontFeatureSettings

Get font feature settings.

FontSpacing FontSpacing

Return the recommend line spacing based on the current typeface and text size.

FontVariationSettings FontVariationSettings
Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
Hinting Hinting

Return the paint's hinting mode.

IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
LetterSpacing LetterSpacing

Return the paint's letter-spacing for text.

LinearText LinearText

Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set

MaskFilter MaskFilter

Get the paint's maskfilter object.

PathEffect PathEffect

Get the paint's patheffect object.

PeerReference PeerReference Inherited from Object
Rasterizer Rasterizer

Get the paint's rasterizer (or null).

Shader Shader

Get the paint's shader object.

StrikeThruText StrikeThruText

Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set

StrokeCap StrokeCap

Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated.

StrokeJoin StrokeJoin

Return the paint's stroke join type.

StrokeMiter StrokeMiter

Return the paint's stroke miter value.

StrokeWidth StrokeWidth

Return the width for stroking.

SubpixelText SubpixelText

Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set

TextAlign TextAlign

Return the paint's Align value for drawing text.

TextLocale TextLocale

Get the text Locale.

TextLocales TextLocales
TextScaleX TextScaleX

Return the paint's horizontal scale factor for text.

TextSize TextSize

Return the paint's text size.

TextSkewX TextSkewX

Return the paint's horizontal skew factor for text.

ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Typeface Typeface

Get the paint's typeface object.

UnderlineText UnderlineText

Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set

Xfermode Xfermode

Get the paint's xfermode object.

Methods

Ascent() Ascent()

Return the distance above (negative) the baseline (ascent) based on the current typeface and text size.

BreakText(Char[], Int32, Int32, Single, Single[]) BreakText(Char[], Int32, Int32, Single, Single[])

Measure the text, stopping early if the measured width exceeds maxWidth.

BreakText(ICharSequence, Int32, Int32, Boolean, Single, Single[]) BreakText(ICharSequence, Int32, Int32, Boolean, Single, Single[])

Measure the text, stopping early if the measured width exceeds maxWidth.

BreakText(String, Boolean, Single, Single[]) BreakText(String, Boolean, Single, Single[])

Measure the text, stopping early if the measured width exceeds maxWidth.

BreakText(String, Int32, Int32, Boolean, Single, Single[]) BreakText(String, Int32, Int32, Boolean, Single, Single[])
ClearShadowLayer() ClearShadowLayer()

Clear the shadow layer.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Descent() Descent()

Return the distance below (positive) the baseline (descent) based on the current typeface and text size.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
GetFillPath(Path, Path) GetFillPath(Path, Path)

Applies any/all effects (patheffect, stroking) to src, returning the result in dst.

GetFontMetrics() GetFontMetrics()

Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object.

GetFontMetrics(Paint+FontMetrics) GetFontMetrics(Paint+FontMetrics)

Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc.

GetFontMetricsInt() GetFontMetricsInt()
GetFontMetricsInt(Paint+FontMetricsInt) GetFontMetricsInt(Paint+FontMetricsInt)

Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetOffsetForAdvance(Char[], Int32, Int32, Int32, Int32, Boolean, Single) GetOffsetForAdvance(Char[], Int32, Int32, Int32, Int32, Boolean, Single)
GetOffsetForAdvance(ICharSequence, Int32, Int32, Int32, Int32, Boolean, Single) GetOffsetForAdvance(ICharSequence, Int32, Int32, Int32, Int32, Boolean, Single)
GetOffsetForAdvance(String, Int32, Int32, Int32, Int32, Boolean, Single) GetOffsetForAdvance(String, Int32, Int32, Int32, Int32, Boolean, Single)
GetRunAdvance(Char[], Int32, Int32, Int32, Int32, Boolean, Int32) GetRunAdvance(Char[], Int32, Int32, Int32, Int32, Boolean, Int32)
GetRunAdvance(ICharSequence, Int32, Int32, Int32, Int32, Boolean, Int32) GetRunAdvance(ICharSequence, Int32, Int32, Int32, Int32, Boolean, Int32)
GetRunAdvance(String, Int32, Int32, Int32, Int32, Boolean, Int32) GetRunAdvance(String, Int32, Int32, Int32, Int32, Boolean, Int32)
GetStyle() GetStyle()

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) 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) 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) GetTextPath(Char[], Int32, Int32, Single, Single, Path)

Return the path (outline) for the specified text.

GetTextPath(String, Int32, Int32, Single, Single, Path) GetTextPath(String, Int32, Int32, Single, Single, Path)

Return the path (outline) for the specified text.

GetTextWidths(Char[], Int32, Int32, Single[]) GetTextWidths(Char[], Int32, Int32, Single[])

Return the advance widths for the characters in the string.

GetTextWidths(ICharSequence, Int32, Int32, Single[]) GetTextWidths(ICharSequence, Int32, Int32, Single[])

Return the advance widths for the characters in the string.

GetTextWidths(String, Int32, Int32, Single[]) GetTextWidths(String, Int32, Int32, Single[])

Return the advance widths for the characters in the string.

GetTextWidths(String, Single[]) GetTextWidths(String, Single[])

Return the advance widths for the characters in the string.

HasGlyph(String) HasGlyph(String)
JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
MeasureText(Char[], Int32, Int32) MeasureText(Char[], Int32, Int32)

Return the width of the text.

MeasureText(ICharSequence, Int32, Int32) MeasureText(ICharSequence, Int32, Int32)

Return the width of the text.

MeasureText(String) MeasureText(String)

Return the width of the text.

MeasureText(String, Int32, Int32) MeasureText(String, Int32, Int32)

Return the width of the text.

Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
Reset() Reset()

Restores the paint to its default settings.

Set(Paint) Set(Paint)

Copy the fields from src into this paint.

SetARGB(Int32, Int32, Int32, Int32) SetARGB(Int32, Int32, Int32, Int32)

Helper to setColor(), that takes a,r,g,b and constructs the color int

SetColorFilter(ColorFilter) SetColorFilter(ColorFilter)

Set or clear the paint's colorfilter, returning the parameter.

SetFontVariationSettings(String) SetFontVariationSettings(String)
SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetMaskFilter(MaskFilter) SetMaskFilter(MaskFilter)

Set or clear the maskfilter object.

SetPathEffect(PathEffect) SetPathEffect(PathEffect)

Set or clear the patheffect object.

SetRasterizer(Rasterizer) SetRasterizer(Rasterizer)

Set or clear the rasterizer object.

SetShader(Shader) SetShader(Shader)

Set or clear the shader object.

SetShadowLayer(Single, Single, Single, Color) 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) 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) SetTypeface(Typeface)

Set or clear the typeface object.

SetXfermode(Xfermode) SetXfermode(Xfermode)

Set or clear the xfermode object.

ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to