Paint
declare class Paint {}
The Paint class holds the style and color information about how to draw geometries, text and bitmaps.
Static Property
UNDERLINE_TEXT_FLAG
Type
declare class Paint {
static UNDERLINE_TEXT_FLAG: number;
}
Description
Paint flag that applies an underline decoration to drawn text.
STRIKE_THRU_TEXT_FLAG
Type
declare class Paint {
static STRIKE_THRU_TEXT_FLAG: number;
}
Description
Paint flag that applies a strike-through decoration to drawn text.
Instance Method
measureText
Signature
declare class Paint {
measureText(text: CharSequence): number;
measureText(text: CharSequence, start: number, end: number): number;
}
Description
Return the width of the text.
breakText
Signature
declare class Paint {
breakText(text: CharSequence, measureForwards: boolean, maxWidth: number, measuredWidth: number[]): number;
breakText(text: CharSequence, start: number, end: number, measureForwards: boolean, maxWidth: number, measuredWidth: number[]): number;
}
Description
Measure the text, stopping early if the measured width exceeds maxWidth.
getTextWidths
Signature
declare class Paint {
getTextWidths(text: TextString, widths: number[]): number;
getTextWidths(text: TextString, start: number, end: number, widths: number[]): number;
}
Description
Return the advance widths for the characters in the string.
getTextBounds
Signature
declare class Paint {
getTextBounds(text: CharSequence, bounds: Rect): void;
getTextBounds(text: CharSequence, start: number, end: number, bounds: Rect): void;
}
Description
Retrieve the text boundary box and store to bounds.
getStyle
Signature
declare class Paint {
getStyle(): Paint.Style
}
Description
Return the paint's style, used for controlling how primitives' geometries are interpreted.
getFlags
Signature
declare class Paint {
getFlags(): number
}
Description
Return the paint's flags.
getColor
Signature
declare class Paint {
getColor(): number
}
Description
RReturn the paint's color in sRGB.
getAlpha
Signature
declare class Paint {
getAlpha(): number
}
Description
Helper to getColor() that just returns the color's alpha value.
getTextAlign
Signature
declare class Paint {
getTextAlign(): Paint.Align
}
Description
Return the paint's Align value for drawing text.
getStrokeJoin
Signature
declare class Paint {
getStrokeJoin(): Paint.Join
}
Description
Return the paint's stroke join type.
getStrokeCap
Signature
declare class Paint {
getStrokeCap(): Paint.Cap
}
Description
Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated.
getTextSize
Signature
declare class Paint {
getTextSize(): number
}
Description
Return the paint's text size.
getStrokeWidth
Signature
declare class Paint {
getStrokeWidth(): number;
}
Description
Return the width for stroking.
getTypeface
Signature
declare class Paint {
getTypeface(): Typeface;
}
Description
Get the paint's typeface object.
getTextFontMetrics
Signature
declare class Paint {
getTextFontMetrics(text: CharSequence): Paint.FontMetrics;
getTextFontMetrics(text: CharSequence, fontMetrics: Paint.FontMetrics): number;
}
Description
Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc.
set
Signature
declare class Paint {
set(paint: Paint): Paint
}
Description
Copy the fields from src into this paint.
setAlpha
Signature
declare class Paint {
setAlpha(a: number): void;
}
Description
Helper to setColor(), that only assigns the color's alpha value, leaving its r,g,b values unchanged.
setFlags
Signature
declare class Paint {
setFlags(flags: number): void;
}
Description
Set the paint's flags.
setStrokeWidth
Signature
declare class Paint {
setStrokeWidth(width: number): void;
}
Description
Set the width for stroking.
setColor
Signature
declare class Paint {
setColor(color: number): void
}
Description
Set the paint's color.
setStyle
Signature
declare class Paint {
setStyle(style: Paint.Style): void
}
Description
Set the paint's style, used for controlling how primitives' geometries are interpreted.
setStrokeCap
Signature
declare class Paint {
setStrokeCap(cap: Paint.Cap): void
}
Description
Set the paint's Cap.
setARGB
Signature
declare class Paint {
setARGB(a: number, r: number, g: number, b: number): void
}
Description
Helper to setColor(), that takes a,r,g,b and constructs the color int.
setStrokeJoin
Signature
declare class Paint {
setStrokeJoin(join: Paint.Join): void
}
Description
Set the paint's Join.
setTextSize
Signature
declare class Paint {
setTextSize(textSize: number): void
}
Description
Set the paint's text size.
setTypeface
Signature
declare class Paint {
setTypeface(typeface: Typeface): void
}
Description
Set or clear the typeface object.
setTextAlign
Signature
declare class Paint {
setTextAlign(textAlign: Paint.Align): void
}
Description
Set the paint's text alignment.