java.lang.Object | ||
android.graphics.Paint |
The Paint class holds the style and color information about how to draw geometries, text and bitmaps.
Paint.Align | Align specifies how drawText aligns its text relative to the [x,y] coordinates. |
Paint.Cap | The Cap specifies the treatment for the beginning and ending of stroked lines and paths. |
Paint.FontMetrics | Class that describes the various metrics for a font at a given text size. |
Paint.FontMetricsInt | Convenience method for callers that want to have FontMetrics values as integers. |
Paint.Join | The Join specifies the treatment where lines and curve segments join on a stroked path. |
Paint.Style | The Style specifies if the primitive being drawn is filled, stroked, or both (in the same color). |
Value | ||||
---|---|---|---|---|
int | ANTI_ALIAS_FLAG | bit mask for the flag enabling antialiasing | 1 | 0x00000001 |
int | DEV_KERN_TEXT_FLAG | bit mask for the flag enabling device kerning for text | 256 | 0x00000100 |
int | DITHER_FLAG | bit mask for the flag enabling dithering | 4 | 0x00000004 |
int | FAKE_BOLD_TEXT_FLAG | bit mask for the flag enabling fake-bold text | 32 | 0x00000020 |
int | FILTER_BITMAP_FLAG | bit mask for the flag enabling bitmap filtering | 2 | 0x00000002 |
int | LINEAR_TEXT_FLAG | bit mask for the flag enabling linear-text (no caching) | 64 | 0x00000040 |
int | STRIKE_THRU_TEXT_FLAG | bit mask for the flag enabling strike-thru text | 16 | 0x00000010 |
int | SUBPIXEL_TEXT_FLAG | bit mask for the flag enabling subpixel-text | 128 | 0x00000080 |
int | UNDERLINE_TEXT_FLAG | bit mask for the flag enabling underline text | 8 | 0x00000008 |
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(CharSequence text, int start, int end, boolean measureForwards, float maxWidth, float[] measuredWidth) | |||||
Measure the text, stopping early if the measured width exceeds maxWidth. | ||||||
int | breakText(char[] text, int index, int count, float maxWidth, float[] measuredWidth) | |||||
Measure the text, stopping early if the measured width exceeds maxWidth. | ||||||
int | breakText(String text, boolean measureForwards, float maxWidth, float[] measuredWidth) | |||||
Measure the text, stopping early if the measured width exceeds maxWidth. | ||||||
void | clearShadowLayer() | |||||
Temporary API to 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. | ||||||
ColorFilter | getColorFilter() | |||||
Get the paint's colorfilter (maybe be null). | ||||||
boolean | getFillPath(Path src, Path dst) | |||||
Applies any/all effects (patheffect, stroking) to src, returning the result in dst. | ||||||
int | getFlags() | |||||
Return the paint's flags. | ||||||
float | getFontMetrics(Paint.FontMetrics metrics) | |||||
Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc. | ||||||
Paint.FontMetrics | getFontMetrics() | |||||
Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object. | ||||||
Paint.FontMetricsInt | getFontMetricsInt() | |||||
int | getFontMetricsInt(Paint.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. | ||||||
MaskFilter | getMaskFilter() | |||||
Get the paint's maskfilter object. | ||||||
PathEffect | getPathEffect() | |||||
Get the paint's patheffect object. | ||||||
Rasterizer | getRasterizer() | |||||
Get the paint's rasterizer (or null). | ||||||
Shader | getShader() | |||||
Get the paint's shader object. | ||||||
Paint.Cap | getStrokeCap() | |||||
Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated. | ||||||
Paint.Join | getStrokeJoin() | |||||
Return the paint's stroke join type. | ||||||
float | getStrokeMiter() | |||||
Return the paint's stroke miter value. | ||||||
float | getStrokeWidth() | |||||
Return the width for stroking. | ||||||
Paint.Style | getStyle() | |||||
Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes FILL_STYLE). | ||||||
Paint.Align | getTextAlign() | |||||
Return the paint's Align value for drawing text. | ||||||
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 | 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 | getTextPath(String text, int start, int end, float x, float y, Path path) | |||||
Return the path (outline) for the specified text. | ||||||
void | getTextPath(char[] text, int index, int count, float x, float y, Path path) | |||||
Return the path (outline) for the specified text. | ||||||
float | getTextScaleX() | |||||
Return the paint's horizontal scale factor for text. | ||||||
float | getTextSize() | |||||
Return the paint's text size. | ||||||
float | getTextSkewX() | |||||
Return the paint's horizontal skew factor for text. | ||||||
int | getTextWidths(CharSequence text, int start, int end, float[] widths) | |||||
Return the advance widths for the characters in the string. | ||||||
int | getTextWidths(char[] text, int index, int count, float[] widths) | |||||
Return the advance widths for the characters in the string. | ||||||
int | getTextWidths(String text, int start, int end, float[] widths) | |||||
Return the advance widths for the characters in the string. | ||||||
int | getTextWidths(String text, float[] widths) | |||||
Return the advance widths for the characters in the string. | ||||||
Typeface | getTypeface() | |||||
Get the paint's typeface object. | ||||||
Xfermode | getXfermode() | |||||
Get the paint's xfermode object. | ||||||
final | boolean | isAntiAlias() | ||||
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. | ||||||
final | boolean | isDither() | ||||
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. | ||||||
final | boolean | isFakeBoldText() | ||||
Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set | ||||||
final | boolean | isFilterBitmap() | ||||
Whether or not the bitmap filter is activated. | ||||||
final | boolean | isLinearText() | ||||
Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set | ||||||
final | boolean | isStrikeThruText() | ||||
Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set | ||||||
final | boolean | isSubpixelText() | ||||
Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set | ||||||
final | boolean | isUnderlineText() | ||||
Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set | ||||||
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. | ||||||
float | measureText(String text) | |||||
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 | setARGB(int a, int r, int g, int b) | |||||
Helper to setColor(), that takes a,r,g,b and constructs the color int | ||||||
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 | setColor(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 STRIKE_THRU_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. | ||||||
void | setLinearText(boolean linearText) | |||||
Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit | ||||||
MaskFilter | setMaskFilter(MaskFilter maskfilter) | |||||
Set or clear the maskfilter object. | ||||||
PathEffect | setPathEffect(PathEffect effect) | |||||
Set or clear the patheffect object. | ||||||
Rasterizer | setRasterizer(Rasterizer rasterizer) | |||||
Set or clear the rasterizer object. | ||||||
Shader | setShader(Shader shader) | |||||
Set or clear the shader object. | ||||||
void | setShadowLayer(float radius, float dx, float dy, int color) | |||||
Temporary API to expose layer drawing. | ||||||
void | setStrikeThruText(boolean strikeThruText) | |||||
Helper for setFlags(), setting or clearing the STRIKE_THRU_TEXT_FLAG bit | ||||||
void | setStrokeCap(Paint.Cap cap) | |||||
Set the paint's Cap. | ||||||
void | setStrokeJoin(Paint.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(Paint.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(Paint.Align align) | |||||
Set the paint's text alignment. | ||||||
void | setTextScaleX(float scaleX) | |||||
Set the paint's horizontal scale factor for text. | ||||||
void | setTextSize(float textSize) | |||||
Set the paint's text size. | ||||||
void | setTextSkewX(float skewX) | |||||
Set the paint's horizontal skew factor for text. | ||||||
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 xfermode object. |
void | finalize() | |||||
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. |
flags | initial flag bits, as if they were passed via setFlags(). |
---|
paint | Existing paint used to initialized the attributes of the new paint. |
---|
text | The text to measure |
---|---|
start | The offset into text to begin measuring at |
end | The end of the text slice to measure. |
measureForwards | If true, measure forwards, starting at start. Otherwise, measure backwards, starting with end. |
maxWidth | The maximum width to accumulate. |
measuredWidth | Optional. If not null, returns the actual width measured. |
text | The text to measure |
---|---|
index | The offset into text to begin measuring at |
count | The number of maximum number of entries to measure. If count is negative, then the characters before index are measured in reverse order. This allows for measuring the end of string. |
maxWidth | The maximum width to accumulate. |
measuredWidth | Optional. If not null, returns the actual width measured. |
text | The text to measure |
---|---|
measureForwards | If true, measure forwards, starting at index. Otherwise, measure backwards, starting with the last character in the string. |
maxWidth | The maximum width to accumulate. |
measuredWidth | Optional. If not null, returns the actual width measured. |
src | input path |
---|---|
dst | output path (may be the same as src) |
metrics | If this object is not null, its fields are filled with the appropriate values given the paint's text attributes. |
---|
text | Array of chars to measure and return their unioned bounds |
---|---|
index | Index of the first char in the array to measure |
count | The number of chars, beginning at index, to measure |
bounds | Returns the unioned bounds of all the text. Must be allocated by the caller. |
text | String to measure and return its bounds |
---|---|
start | Index of the first char in the string to measure |
end | 1 past the last char in the string measure |
bounds | Returns the unioned bounds of all the text. Must be allocated by the caller. |
text | The text to retrieve the path from |
---|---|
start | The first character in the text |
end | 1 past the last charcter in the text |
x | The x coordinate of the text's origin |
y | The y coordinate of the text's origin |
path | The path to receive the data describing the text. Must be allocated by the caller. |
text | The text to retrieve the path from |
---|---|
index | The index of the first character in text |
count | The number of characterss starting with index |
x | The x coordinate of the text's origin |
y | The y coordinate of the text's origin |
path | The path to receive the data describing the text. Must be allocated by the caller. |
text | The text to measure |
---|---|
start | The index of the first char to to measure |
end | The end of the text slice to measure |
widths | array to receive the advance widths of the characters. Must be at least a large as (end - start). |
text | The text to measure |
---|---|
index | The index of the first char to to measure |
count | The number of chars starting with index to measure |
widths | array to receive the advance widths of the characters. Must be at least a large as count. |
text | The text to measure |
---|---|
start | The index of the first char to to measure |
end | The end of the text slice to measure |
widths | array to receive the advance widths of the characters. Must be at least a large as the text. |
text | The text to measure |
---|---|
widths | array to receive the advance widths of the characters. Must be at least a large as the text. |
text | The text to measure |
---|---|
index | The index of the first character to start measuring |
count | THe number of characters to measure, beginning with start |
text | The text to measure |
---|---|
start | The index of the first character to start measuring |
end | 1 beyond the index of the last character to measure |
text | The text to measure |
---|---|
start | The index of the first character to start measuring |
end | 1 beyond the index of the last character to measure |
text | The text to measure |
---|
a | The new alpha component (0..255) of the paint's color. |
---|---|
r | The new red component (0..255) of the paint's color. |
g | The new green component (0..255) of the paint's color. |
b | The new blue component (0..255) of the paint's color. |
a | set the alpha component [0..255] of the paint's color. |
---|
aa | true to set the antialias bit in the flags, false to clear it |
---|
color | The new color (including alpha) to set in the paint. |
---|
filter | May be null. The new filter to be installed in the paint |
---|
dither | true to set the dithering bit in flags, false to clear it |
---|
fakeBoldText | true to set the fakeBoldText bit in the paint's flags, false to clear it. |
---|
filter | true to set the FILTER_BITMAP_FLAG bit in the paint's flags, false to clear it. |
---|
flags | The new flag bits for the paint |
---|
linearText | true to set the linearText bit in the paint's flags, false to clear it. |
---|
maskfilter | May be null. The maskfilter to be installed in the paint |
---|
effect | May be null. The patheffect to be installed in the paint |
---|
rasterizer | May be null. The new rasterizer to be installed in the paint. |
---|
shader | May be null. the new shader to be installed in the paint |
---|
strikeThruText | true to set the strikeThruText bit in the paint's flags, false to clear it. |
---|
cap | set the paint's line cap style, used whenever the paint's style is Stroke or StrokeAndFill. |
---|
join | set the paint's Join, used whenever the paint's style is Stroke or StrokeAndFill. |
---|
miter | set the miter limit on the paint, used whenever the paint's style is Stroke or StrokeAndFill. |
---|
width | set the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill. |
---|
style | The new style to set in the paint |
---|
subpixelText | true to set the subpixelText bit in the paint's flags, false to clear it. |
---|
align | set the paint's Align value for drawing text. |
---|
scaleX | set the paint's scale in X for drawing/measuring text. |
---|
textSize | set the paint's text size. |
---|
skewX | set the paint's skew factor in X for drawing text. |
---|
typeface | May be null. The typeface to be installed in the paint |
---|
underlineText | true to set the underlineText bit in the paint's flags, false to clear it. |
---|
xfermode | May be null. The xfermode to be installed in the paint |
---|
Note: The virtual machine assumes that the implementation in class Object is empty.
Throwable |
---|
Copyright 2007 Google Inc. | Build 0.9_r1-98467 - 14 Aug 2008 18:56 |