code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public int getBidiFlags() {
return mBidiFlags;
} |
Return the bidi flags on the paint.
@return the bidi flags on the paint
@hide
| Align::getBidiFlags | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setBidiFlags(int flags) {
// only flag value is the 3-bit BIDI control setting
flags &= BIDI_FLAG_MASK;
if (flags > BIDI_MAX_FLAG_VALUE) {
throw new IllegalArgumentException("unknown bidi flag: " + flags);
}
mBidiFlags = flags;
} |
Set the bidi flags on the paint.
@hide
| Align::setBidiFlags | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @PaintFlag int getFlags() {
return nGetFlags(mNativePaint);
} |
Return the paint's flags. Use the Flag enum to test flag values.
@return the paint's flags (see enums ending in _Flag for bit masks)
| Align::getFlags | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setFlags(@PaintFlag int flags) {
nSetFlags(mNativePaint, flags);
} |
Set the paint's flags. Use the Flag enum to specific flag values.
@param flags The new flag bits for the paint
| Align::setFlags | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public int getHinting() {
return nGetHinting(mNativePaint);
} |
Return the paint's hinting mode. Returns either
{@link #HINTING_OFF} or {@link #HINTING_ON}.
| Align::getHinting | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setHinting(int mode) {
nSetHinting(mNativePaint, mode);
} |
Set the paint's hinting mode. May be either
{@link #HINTING_OFF} or {@link #HINTING_ON}.
| Align::setHinting | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isAntiAlias() {
return (getFlags() & ANTI_ALIAS_FLAG) != 0;
} |
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. See setDither() and
setFilterBitmap() to affect how colors are treated.
@return true if the antialias bit is set in the paint's flags.
| Align::isAntiAlias | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setAntiAlias(boolean aa) {
nSetAntiAlias(mNativePaint, 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. See setDither() and
setFilterBitmap() to affect how colors are treated.
@param aa true to set the antialias bit in the flags, false to clear it
| Align::setAntiAlias | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isDither() {
return (getFlags() & DITHER_FLAG) != 0;
} |
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. No dithering is generally faster, but higher precision
colors are just truncated down (e.g. 8888 -> 565). Dithering tries to
distribute the error inherent in this process, to reduce the visual
artifacts.
@return true if the dithering bit is set in the paint's flags.
| Align::isDither | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setDither(boolean dither) {
nSetDither(mNativePaint, 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. No dithering is generally faster, but higher precision
colors are just truncated down (e.g. 8888 -> 565). Dithering tries to
distribute the error inherent in this process, to reduce the visual
artifacts.
@param dither true to set the dithering bit in flags, false to clear it
| Align::setDither | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isLinearText() {
return (getFlags() & LINEAR_TEXT_FLAG) != 0;
} |
Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set
@return true if the lineartext bit is set in the paint's flags
| Align::isLinearText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setLinearText(boolean linearText) {
nSetLinearText(mNativePaint, linearText);
} |
Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit
@param linearText true to set the linearText bit in the paint's flags,
false to clear it.
| Align::setLinearText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isSubpixelText() {
return (getFlags() & SUBPIXEL_TEXT_FLAG) != 0;
} |
Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set
@return true if the subpixel bit is set in the paint's flags
| Align::isSubpixelText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setSubpixelText(boolean subpixelText) {
nSetSubpixelText(mNativePaint, subpixelText);
} |
Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit
@param subpixelText true to set the subpixelText bit in the paint's
flags, false to clear it.
| Align::setSubpixelText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isUnderlineText() {
return (getFlags() & UNDERLINE_TEXT_FLAG) != 0;
} |
Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set
@return true if the underlineText bit is set in the paint's flags.
@see #getUnderlinePosition()
@see #getUnderlineThickness()
@see #setUnderlineText(boolean)
| Align::isUnderlineText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @Px float getUnderlinePosition() {
return nGetUnderlinePosition(mNativePaint);
} |
Returns the distance from top of the underline to the baseline in pixels.
The result is positive for positions that are below the baseline.
This method returns where the underline should be drawn independent of if the {@link
#UNDERLINE_TEXT_FLAG} bit is set.
@return the position of the underline in pixels
@see #isUnderlineText()
@see #getUnderlineThickness()
@see #setUnderlineText(boolean)
| Align::getUnderlinePosition | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @Px float getUnderlineThickness() {
return nGetUnderlineThickness(mNativePaint);
} |
Returns the thickness of the underline in pixels.
@return the thickness of the underline in pixels
@see #isUnderlineText()
@see #getUnderlinePosition()
@see #setUnderlineText(boolean)
| Align::getUnderlineThickness | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setUnderlineText(boolean underlineText) {
nSetUnderlineText(mNativePaint, underlineText);
} |
Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit
@param underlineText true to set the underlineText bit in the paint's
flags, false to clear it.
@see #isUnderlineText()
@see #getUnderlinePosition()
@see #getUnderlineThickness()
| Align::setUnderlineText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isStrikeThruText() {
return (getFlags() & STRIKE_THRU_TEXT_FLAG) != 0;
} |
Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set
@return true if the {@link #STRIKE_THRU_TEXT_FLAG} bit is set in the paint's flags.
@see #getStrikeThruPosition()
@see #getStrikeThruThickness()
@see #setStrikeThruText(boolean)
| Align::isStrikeThruText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @Px float getStrikeThruPosition() {
return nGetStrikeThruPosition(mNativePaint);
} |
Distance from top of the strike-through line to the baseline in pixels.
The result is negative for positions that are above the baseline.
This method returns where the strike-through line should be drawn independent of if the
{@link #STRIKE_THRU_TEXT_FLAG} bit is set.
@return the position of the strike-through line in pixels
@see #getStrikeThruThickness()
@see #setStrikeThruText(boolean)
@see #isStrikeThruText()
| Align::getStrikeThruPosition | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @Px float getStrikeThruThickness() {
return nGetStrikeThruThickness(mNativePaint);
} |
Returns the thickness of the strike-through line in pixels.
@return the position of the strike-through line in pixels
@see #getStrikeThruPosition()
@see #setStrikeThruText(boolean)
@see #isStrikeThruText()
| Align::getStrikeThruThickness | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStrikeThruText(boolean strikeThruText) {
nSetStrikeThruText(mNativePaint, strikeThruText);
} |
Helper for setFlags(), setting or clearing the STRIKE_THRU_TEXT_FLAG bit
@param strikeThruText true to set the strikeThruText bit in the paint's
flags, false to clear it.
@see #getStrikeThruPosition()
@see #getStrikeThruThickness()
@see #isStrikeThruText()
| Align::setStrikeThruText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isFakeBoldText() {
return (getFlags() & FAKE_BOLD_TEXT_FLAG) != 0;
} |
Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set
@return true if the fakeBoldText bit is set in the paint's flags.
| Align::isFakeBoldText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setFakeBoldText(boolean fakeBoldText) {
nSetFakeBoldText(mNativePaint, fakeBoldText);
} |
Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit
@param fakeBoldText true to set the fakeBoldText bit in the paint's
flags, false to clear it.
| Align::setFakeBoldText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public final boolean isFilterBitmap() {
return (getFlags() & FILTER_BITMAP_FLAG) != 0;
} |
Whether or not the bitmap filter is activated.
Filtering affects the sampling of bitmaps when they are transformed.
Filtering does not affect how the colors in the bitmap are converted into
device pixels. That is dependent on dithering and xfermodes.
@see #setFilterBitmap(boolean) setFilterBitmap()
@see #FILTER_BITMAP_FLAG
| Align::isFilterBitmap | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setFilterBitmap(boolean filter) {
nSetFilterBitmap(mNativePaint, filter);
} |
Helper for setFlags(), setting or clearing the FILTER_BITMAP_FLAG bit.
Filtering affects the sampling of bitmaps when they are transformed.
Filtering does not affect how the colors in the bitmap are converted into
device pixels. That is dependent on dithering and xfermodes.
@param filter true to set the FILTER_BITMAP_FLAG bit in the paint's
flags, false to clear it.
@see #FILTER_BITMAP_FLAG
| Align::setFilterBitmap | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Style getStyle() {
return sStyleArray[nGetStyle(mNativePaint)];
} |
Return the paint's style, used for controlling how primitives'
geometries are interpreted (except for drawBitmap, which always assumes
FILL_STYLE).
@return the paint's style setting (Fill, Stroke, StrokeAndFill)
| Align::getStyle | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStyle(Style style) {
nSetStyle(mNativePaint, style.nativeInt);
} |
Set the paint's style, used for controlling how primitives'
geometries are interpreted (except for drawBitmap, which always assumes
Fill).
@param style The new style to set in the paint
| Align::setStyle | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setColor(@ColorInt int color) {
nSetColor(mNativePaint, color);
mColor = Color.pack(color);
} |
Set the paint's color. Note that the color is an int containing alpha
as well as r,g,b. This 32bit value is not premultiplied, meaning that
its alpha can be any value, regardless of the values of r,g,b.
See the Color class for more details.
@param color The new color (including alpha) to set in the paint.
| Align::setColor | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setColor(@ColorLong long color) {
ColorSpace cs = Color.colorSpace(color);
nSetColor(mNativePaint, cs.getNativeInstance(), color);
mColor = color;
} |
Set the paint's color with a {@code ColorLong}. Note that the color is
a long with an encoded {@link ColorSpace} as well as alpha and r,g,b.
These values are not premultiplied, meaning that alpha can be any value,
regardless of the values of r,g,b. See the {@link Color} class for more
details.
@param color The new color (including alpha and {@link ColorSpace})
to set in the paint.
@throws IllegalArgumentException if the color space encoded in the
{@code ColorLong} is invalid or unknown.
| Align::setColor | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public int getAlpha() {
return Math.round(Color.alpha(mColor) * 255.0f);
} |
Helper to getColor() that just returns the color's alpha value. This is
the same as calling getColor() >>> 24. It always returns a value between
0 (completely transparent) and 255 (completely opaque).
@return the alpha component of the paint's color.
| Align::getAlpha | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setAlpha(int a) {
// FIXME: No need to unpack this. Instead, just update the alpha bits.
// b/122959599
ColorSpace cs = Color.colorSpace(mColor);
float r = Color.red(mColor);
float g = Color.green(mColor);
float b = Color.blue(mColor);
mColor = Color.pack(r, g, b, a * (1.0f / 255), cs);
nSetAlpha(mNativePaint, a);
} |
Helper to setColor(), that only assigns the color's alpha value,
leaving its r,g,b values unchanged. Results are undefined if the alpha
value is outside of the range [0..255]
@param a set the alpha component [0..255] of the paint's color.
| Align::setAlpha | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setARGB(int a, int r, int g, int b) {
setColor((a << 24) | (r << 16) | (g << 8) | b);
} |
Helper to setColor(), that takes a,r,g,b and constructs the color int
@param a The new alpha component (0..255) of the paint's color.
@param r The new red component (0..255) of the paint's color.
@param g The new green component (0..255) of the paint's color.
@param b The new blue component (0..255) of the paint's color.
| Align::setARGB | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getStrokeWidth() {
return nGetStrokeWidth(mNativePaint);
} |
Return the width for stroking.
<p />
A value of 0 strokes in hairline mode.
Hairlines always draws a single pixel independent of the canvas's matrix.
@return the paint's stroke width, used whenever the paint's style is
Stroke or StrokeAndFill.
| Align::getStrokeWidth | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStrokeWidth(float width) {
nSetStrokeWidth(mNativePaint, width);
} |
Set the width for stroking.
Pass 0 to stroke in hairline mode.
Hairlines always draws a single pixel independent of the canvas's matrix.
@param width set the paint's stroke width, used whenever the paint's
style is Stroke or StrokeAndFill.
| Align::setStrokeWidth | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getStrokeMiter() {
return nGetStrokeMiter(mNativePaint);
} |
Return the paint's stroke miter value. Used to control the behavior
of miter joins when the joins angle is sharp.
@return the paint's miter limit, used whenever the paint's style is
Stroke or StrokeAndFill.
| Align::getStrokeMiter | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStrokeMiter(float miter) {
nSetStrokeMiter(mNativePaint, miter);
} |
Set the paint's stroke miter value. This is used to control the behavior
of miter joins when the joins angle is sharp. This value must be >= 0.
@param miter set the miter limit on the paint, used whenever the paint's
style is Stroke or StrokeAndFill.
| Align::setStrokeMiter | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Cap getStrokeCap() {
return sCapArray[nGetStrokeCap(mNativePaint)];
} |
Return the paint's Cap, controlling how the start and end of stroked
lines and paths are treated.
@return the line cap style for the paint, used whenever the paint's
style is Stroke or StrokeAndFill.
| Align::getStrokeCap | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStrokeCap(Cap cap) {
nSetStrokeCap(mNativePaint, cap.nativeInt);
} |
Set the paint's Cap.
@param cap set the paint's line cap style, used whenever the paint's
style is Stroke or StrokeAndFill.
| Align::setStrokeCap | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Join getStrokeJoin() {
return sJoinArray[nGetStrokeJoin(mNativePaint)];
} |
Return the paint's stroke join type.
@return the paint's Join.
| Align::getStrokeJoin | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStrokeJoin(Join join) {
nSetStrokeJoin(mNativePaint, join.nativeInt);
} |
Set the paint's Join.
@param join set the paint's Join, used whenever the paint's style is
Stroke or StrokeAndFill.
| Align::setStrokeJoin | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public boolean getFillPath(Path src, Path dst) {
return nGetFillPath(mNativePaint, src.readOnlyNI(), dst.mutateNI());
} |
Applies any/all effects (patheffect, stroking) to src, returning the
result in dst. The result is that drawing src with this paint will be
the same as drawing dst with a default paint (at least from the
geometric perspective).
@param src input path
@param dst output path (may be the same as src)
@return true if the path should be filled, or false if it should be
drawn with a hairline (width == 0)
| Align::getFillPath | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Shader getShader() {
return mShader;
} |
Get the paint's shader object.
@return the paint's shader (or null)
| Align::getShader | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Shader setShader(Shader shader) {
// If mShader changes, cached value of native shader aren't valid, since
// old shader's pointer may be reused by another shader allocation later
if (mShader != shader) {
mNativeShader = -1;
// Release any native references to the old shader content
nSetShader(mNativePaint, 0);
}
// Defer setting the shader natively until getNativeInstance() is called
mShader = shader;
return shader;
} |
Set or clear the shader object.
<p />
Pass null to clear any previous shader.
As a convenience, the parameter passed is also returned.
@param shader May be null. the new shader to be installed in the paint
@return shader
| Align::setShader | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public ColorFilter getColorFilter() {
return mColorFilter;
} |
Get the paint's colorfilter (maybe be null).
@return the paint's colorfilter (maybe be null)
| Align::getColorFilter | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public ColorFilter setColorFilter(ColorFilter filter) {
// If mColorFilter changes, cached value of native shader aren't valid, since
// old shader's pointer may be reused by another shader allocation later
if (mColorFilter != filter) {
mNativeColorFilter = -1;
}
// Defer setting the filter natively until getNativeInstance() is called
mColorFilter = filter;
return filter;
} |
Set or clear the paint's colorfilter, returning the parameter.
@param filter May be null. The new filter to be installed in the paint
@return filter
| Align::setColorFilter | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Xfermode getXfermode() {
return mXfermode;
} |
Get the paint's transfer mode object.
@return the paint's transfer mode (or null)
| Align::getXfermode | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Xfermode setXfermode(Xfermode xfermode) {
return installXfermode(xfermode);
} |
Set or clear the transfer mode object. A transfer mode defines how
source pixels (generate by a drawing command) are composited with
the destination pixels (content of the render target).
<p />
Pass null to clear any previous transfer mode.
As a convenience, the parameter passed is also returned.
<p />
{@link PorterDuffXfermode} is the most common transfer mode.
@param xfermode May be null. The xfermode to be installed in the paint
@return xfermode
| Align::setXfermode | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setBlendMode(@Nullable BlendMode blendmode) {
installXfermode(blendmode != null ? blendmode.getXfermode() : null);
} |
Set or clear the blend mode. A blend mode defines how source pixels
(generated by a drawing command) are composited with the destination pixels
(content of the render target).
<p />
Pass null to clear any previous blend mode.
<p />
@see BlendMode
@param blendmode May be null. The blend mode to be installed in the paint
| Align::setBlendMode | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public PathEffect getPathEffect() {
return mPathEffect;
} |
Get the paint's patheffect object.
@return the paint's patheffect (or null)
| Align::getPathEffect | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public PathEffect setPathEffect(PathEffect effect) {
long effectNative = 0;
if (effect != null) {
effectNative = effect.native_instance;
}
nSetPathEffect(mNativePaint, effectNative);
mPathEffect = effect;
return effect;
} |
Set or clear the patheffect object.
<p />
Pass null to clear any previous patheffect.
As a convenience, the parameter passed is also returned.
@param effect May be null. The patheffect to be installed in the paint
@return effect
| Align::setPathEffect | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public MaskFilter getMaskFilter() {
return mMaskFilter;
} |
Get the paint's maskfilter object.
@return the paint's maskfilter (or null)
| Align::getMaskFilter | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public MaskFilter setMaskFilter(MaskFilter maskfilter) {
long maskfilterNative = 0;
if (maskfilter != null) {
maskfilterNative = maskfilter.native_instance;
}
nSetMaskFilter(mNativePaint, maskfilterNative);
mMaskFilter = maskfilter;
return maskfilter;
} |
Set or clear the maskfilter object.
<p />
Pass null to clear any previous maskfilter.
As a convenience, the parameter passed is also returned.
@param maskfilter May be null. The maskfilter to be installed in the
paint
@return maskfilter
| Align::setMaskFilter | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Typeface getTypeface() {
return mTypeface;
} |
Get the paint's typeface object.
<p />
The typeface object identifies which font to use when drawing or
measuring text.
@return the paint's typeface (or null)
| Align::getTypeface | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Typeface setTypeface(Typeface typeface) {
final long typefaceNative = typeface == null ? 0 : typeface.native_instance;
nSetTypeface(mNativePaint, typefaceNative);
mTypeface = typeface;
return typeface;
} |
Set or clear the typeface object.
<p />
Pass null to clear any previous typeface.
As a convenience, the parameter passed is also returned.
@param typeface May be null. The typeface to be installed in the paint
@return typeface
| Align::setTypeface | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setShadowLayer(float radius, float dx, float dy, @ColorInt int shadowColor) {
setShadowLayer(radius, dx, dy, Color.pack(shadowColor));
} |
This draws a shadow layer below the main layer, with the specified
offset and color, and blur radius. If radius is 0, then the shadow
layer is removed.
<p>
Can be used to create a blurred shadow underneath text. Support for use
with other drawing operations is constrained to the software rendering
pipeline.
<p>
The alpha of the shadow will be the paint's alpha if the shadow color is
opaque, or the alpha from the shadow color if not.
| Align::setShadowLayer | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setShadowLayer(float radius, float dx, float dy, @ColorLong long shadowColor) {
ColorSpace cs = Color.colorSpace(shadowColor);
nSetShadowLayer(mNativePaint, radius, dx, dy, cs.getNativeInstance(), shadowColor);
mShadowLayerRadius = radius;
mShadowLayerDx = dx;
mShadowLayerDy = dy;
mShadowLayerColor = shadowColor;
} |
This draws a shadow layer below the main layer, with the specified
offset and color, and blur radius. If radius is 0, then the shadow
layer is removed.
<p>
Can be used to create a blurred shadow underneath text. Support for use
with other drawing operations is constrained to the software rendering
pipeline.
<p>
The alpha of the shadow will be the paint's alpha if the shadow color is
opaque, or the alpha from the shadow color if not.
@throws IllegalArgumentException if the color space encoded in the
{@code ColorLong} is invalid or unknown.
| Align::setShadowLayer | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void clearShadowLayer() {
setShadowLayer(0, 0, 0, 0);
} |
Clear the shadow layer.
| Align::clearShadowLayer | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public boolean hasShadowLayer() {
return nHasShadowLayer(mNativePaint);
} |
Checks if the paint has a shadow layer attached
@return true if the paint has a shadow layer attached and false otherwise
@hide
| Align::hasShadowLayer | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getShadowLayerRadius() {
return mShadowLayerRadius;
} |
Returns the blur radius of the shadow layer.
@see #setShadowLayer(float,float,float,int)
@see #setShadowLayer(float,float,float,long)
| Align::getShadowLayerRadius | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getShadowLayerDx() {
return mShadowLayerDx;
} |
Returns the x offset of the shadow layer.
@see #setShadowLayer(float,float,float,int)
@see #setShadowLayer(float,float,float,long)
| Align::getShadowLayerDx | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getShadowLayerDy() {
return mShadowLayerDy;
} |
Returns the y offset of the shadow layer.
@see #setShadowLayer(float,float,float,int)
@see #setShadowLayer(float,float,float,long)
| Align::getShadowLayerDy | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @ColorInt int getShadowLayerColor() {
return Color.toArgb(mShadowLayerColor);
} |
Returns the color of the shadow layer.
@see #setShadowLayer(float,float,float,int)
@see #setShadowLayer(float,float,float,long)
| Align::getShadowLayerColor | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @ColorLong long getShadowLayerColorLong() {
return mShadowLayerColor;
} |
Returns the color of the shadow layer.
@return the shadow layer's color encoded as a {@link ColorLong}.
@see #setShadowLayer(float,float,float,int)
@see #setShadowLayer(float,float,float,long)
@see Color
| Align::getShadowLayerColorLong | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public Align getTextAlign() {
return sAlignArray[nGetTextAlign(mNativePaint)];
} |
Return the paint's Align value for drawing text. This controls how the
text is positioned relative to its origin. LEFT align means that all of
the text will be drawn to the right of its origin (i.e. the origin
specifieds the LEFT edge of the text) and so on.
@return the paint's Align value for drawing text.
| Align::getTextAlign | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setTextAlign(Align align) {
nSetTextAlign(mNativePaint, align.nativeInt);
} |
Set the paint's text alignment. This controls how the
text is positioned relative to its origin. LEFT align means that all of
the text will be drawn to the right of its origin (i.e. the origin
specifieds the LEFT edge of the text) and so on.
@param align set the paint's Align value for drawing text.
| Align::setTextAlign | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setTextLocale(@NonNull Locale locale) {
if (locale == null) {
throw new IllegalArgumentException("locale cannot be null");
}
if (mLocales != null && mLocales.size() == 1 && locale.equals(mLocales.get(0))) {
return;
}
mLocales = new LocaleList(locale);
syncTextLocalesWithMinikin();
} |
Set the text locale list to a one-member list consisting of just the locale.
See {@link #setTextLocales(LocaleList)} for how the locale list affects
the way the text is drawn for some languages.
@param locale the paint's locale value for drawing text, must not be null.
| Align::setTextLocale | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setTextLocales(@NonNull @Size(min=1) LocaleList locales) {
if (locales == null || locales.isEmpty()) {
throw new IllegalArgumentException("locales cannot be null or empty");
}
if (locales.equals(mLocales)) return;
mLocales = locales;
syncTextLocalesWithMinikin();
} |
Set the text locale list.
The text locale list affects how the text is drawn for some languages.
For example, if the locale list contains {@link Locale#CHINESE} or {@link Locale#CHINA},
then the text renderer will prefer to draw text using a Chinese font. Likewise,
if the locale list contains {@link Locale#JAPANESE} or {@link Locale#JAPAN}, then the text
renderer will prefer to draw text using a Japanese font. If the locale list contains both,
the order those locales appear in the list is considered for deciding the font.
This distinction is important because Chinese and Japanese text both use many
of the same Unicode code points but their appearance is subtly different for
each language.
By default, the text locale list is initialized to a one-member list just containing the
system locales. This assumes that the text to be rendered will most likely be in the user's
preferred language.
If the actual language or languages of the text is/are known, then they can be provided to
the text renderer using this method. The text renderer may attempt to guess the
language script based on the contents of the text to be drawn independent of
the text locale here. Specifying the text locales just helps it do a better
job in certain ambiguous cases.
@param locales the paint's locale list for drawing text, must not be null or empty.
| Align::setTextLocales | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public boolean isElegantTextHeight() {
return nIsElegantTextHeight(mNativePaint);
} |
Get the elegant metrics flag.
@return true if elegant metrics are enabled for text drawing.
| Align::isElegantTextHeight | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setElegantTextHeight(boolean elegant) {
nSetElegantTextHeight(mNativePaint, elegant);
} |
Set the paint's elegant height metrics flag. This setting selects font
variants that have not been compacted to fit Latin-based vertical
metrics, and also increases top and bottom bounds to provide more space.
@param elegant set the paint's elegant metrics flag for drawing text.
| Align::setElegantTextHeight | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getTextSize() {
return nGetTextSize(mNativePaint);
} |
Return the paint's text size.
@return the paint's text size in pixel units.
| Align::getTextSize | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setTextSize(float textSize) {
nSetTextSize(mNativePaint, textSize);
} |
Set the paint's text size. This value must be > 0
@param textSize set the paint's text size in pixel units.
| Align::setTextSize | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getTextScaleX() {
return nGetTextScaleX(mNativePaint);
} |
Return the paint's horizontal scale factor for text. The default value
is 1.0.
@return the paint's scale factor in X for drawing/measuring text
| Align::getTextScaleX | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setTextScaleX(float scaleX) {
nSetTextScaleX(mNativePaint, scaleX);
} |
Set the paint's horizontal scale factor for text. The default value
is 1.0. Values > 1.0 will stretch the text wider. Values < 1.0 will
stretch the text narrower.
@param scaleX set the paint's scale in X for drawing/measuring text.
| Align::setTextScaleX | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getTextSkewX() {
return nGetTextSkewX(mNativePaint);
} |
Return the paint's horizontal skew factor for text. The default value
is 0.
@return the paint's skew factor in X for drawing text.
| Align::getTextSkewX | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setTextSkewX(float skewX) {
nSetTextSkewX(mNativePaint, skewX);
} |
Set the paint's horizontal skew factor for text. The default value
is 0. For approximating oblique text, use values around -0.25.
@param skewX set the paint's skew factor in X for drawing text.
| Align::setTextSkewX | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getLetterSpacing() {
return nGetLetterSpacing(mNativePaint);
} |
Return the paint's letter-spacing for text. The default value
is 0.
@return the paint's letter-spacing for drawing text.
| Align::getLetterSpacing | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setLetterSpacing(float letterSpacing) {
nSetLetterSpacing(mNativePaint, letterSpacing);
} |
Set the paint's letter-spacing for text. The default value
is 0. The value is in 'EM' units. Typical values for slight
expansion will be around 0.05. Negative values tighten text.
@param letterSpacing set the paint's letter-spacing for drawing text.
| Align::setLetterSpacing | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @Px float getWordSpacing() {
return nGetWordSpacing(mNativePaint);
} |
Return the paint's extra word-spacing for text.
The default value is 0.
@return the paint's extra word-spacing for drawing text in pixels.
@see #setWordSpacing(float)
| Align::getWordSpacing | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setWordSpacing(@Px float wordSpacing) {
nSetWordSpacing(mNativePaint, wordSpacing);
} |
Set the paint's extra word-spacing for text.
Increases the white space width between words with the given amount of pixels.
The default value is 0.
@param wordSpacing set the paint's extra word-spacing for drawing text in pixels.
@see #getWordSpacing()
| Align::setWordSpacing | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public String getFontFeatureSettings() {
return mFontFeatureSettings;
} |
Returns the font feature settings. The format is the same as the CSS
font-feature-settings attribute:
<a href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop">
https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop</a>
@return the paint's currently set font feature settings. Default is null.
@see #setFontFeatureSettings(String)
| Align::getFontFeatureSettings | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setFontFeatureSettings(String settings) {
if (settings != null && settings.equals("")) {
settings = null;
}
if ((settings == null && mFontFeatureSettings == null)
|| (settings != null && settings.equals(mFontFeatureSettings))) {
return;
}
mFontFeatureSettings = settings;
nSetFontFeatureSettings(mNativePaint, settings);
} |
Set font feature settings.
The format is the same as the CSS font-feature-settings attribute:
<a href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop">
https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop</a>
@see #getFontFeatureSettings()
@param settings the font feature settings string to use, may be null.
| Align::setFontFeatureSettings | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public String getFontVariationSettings() {
return mFontVariationSettings;
} |
Returns the font variation settings.
@return the paint's currently set font variation settings. Default is null.
@see #setFontVariationSettings(String)
| Align::getFontVariationSettings | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public boolean setFontVariationSettings(String fontVariationSettings) {
final String settings = TextUtils.nullIfEmpty(fontVariationSettings);
if (settings == mFontVariationSettings
|| (settings != null && settings.equals(mFontVariationSettings))) {
return true;
}
if (settings == null || settings.length() == 0) {
mFontVariationSettings = null;
setTypeface(Typeface.createFromTypefaceWithVariation(mTypeface,
Collections.emptyList()));
return true;
}
// The null typeface is valid and it is equivalent to Typeface.DEFAULT.
// To call isSupportedAxes method, use Typeface.DEFAULT instance.
Typeface targetTypeface = mTypeface == null ? Typeface.DEFAULT : mTypeface;
FontVariationAxis[] axes = FontVariationAxis.fromFontVariationSettings(settings);
final ArrayList<FontVariationAxis> filteredAxes = new ArrayList<FontVariationAxis>();
for (final FontVariationAxis axis : axes) {
if (targetTypeface.isSupportedAxes(axis.getOpenTypeTagValue())) {
filteredAxes.add(axis);
}
}
if (filteredAxes.isEmpty()) {
return false;
}
mFontVariationSettings = settings;
setTypeface(Typeface.createFromTypefaceWithVariation(targetTypeface, filteredAxes));
return true;
} |
Sets TrueType or OpenType font variation settings. The settings string is constructed from
multiple pairs of axis tag and style values. The axis tag must contain four ASCII characters
and must be wrapped with single quotes (U+0027) or double quotes (U+0022). Axis strings that
are longer or shorter than four characters, or contain characters outside of U+0020..U+007E
are invalid. If a specified axis name is not defined in the font, the settings will be
ignored.
Examples,
<ul>
<li>Set font width to 150.
<pre>
<code>
Paint paint = new Paint();
paint.setFontVariationSettings("'wdth' 150");
</code>
</pre>
</li>
<li>Set the font slant to 20 degrees and ask for italic style.
<pre>
<code>
Paint paint = new Paint();
paint.setFontVariationSettings("'slnt' 20, 'ital' 1");
</code>
</pre>
</li>
</ul>
@param fontVariationSettings font variation settings. You can pass null or empty string as
no variation settings.
@return true if the given settings is effective to at least one font file underlying this
typeface. This function also returns true for empty settings string. Otherwise
returns false
@throws IllegalArgumentException If given string is not a valid font variation settings
format
@see #getFontVariationSettings()
@see FontVariationAxis
| Align::setFontVariationSettings | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @StartHyphenEdit int getStartHyphenEdit() {
return nGetStartHyphenEdit(mNativePaint);
} |
Get the current value of start hyphen edit.
The default value is 0 which is equivalent to {@link #START_HYPHEN_EDIT_NO_EDIT}.
@return the current starting hyphen edit value
@see #setStartHyphenEdit(int)
| Align::getStartHyphenEdit | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public @EndHyphenEdit int getEndHyphenEdit() {
return nGetEndHyphenEdit(mNativePaint);
} |
Get the current value of end hyphen edit.
The default value is 0 which is equivalent to {@link #END_HYPHEN_EDIT_NO_EDIT}.
@return the current starting hyphen edit value
@see #setStartHyphenEdit(int)
| Align::getEndHyphenEdit | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setStartHyphenEdit(@StartHyphenEdit int startHyphen) {
nSetStartHyphenEdit(mNativePaint, startHyphen);
} |
Set a start hyphen edit on the paint.
By setting start hyphen edit, the measurement and drawing is performed with modifying
hyphenation at the start of line. For example, by passing
{@link #START_HYPHEN_EDIT_INSERT_HYPHEN} like as follows, HYPHEN(U+2010)
character is appended at the start of line.
<pre>
<code>
Paint paint = new Paint();
paint.setStartHyphenEdit(Paint.START_HYPHEN_EDIT_INSERT_HYPHEN);
paint.measureText("abc", 0, 3); // Returns the width of "-abc"
Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "-abc"
</code>
</pre>
The default value is 0 which is equivalent to
{@link #START_HYPHEN_EDIT_NO_EDIT}.
@param startHyphen a start hyphen edit value.
@see #getStartHyphenEdit()
| Align::setStartHyphenEdit | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public void setEndHyphenEdit(@EndHyphenEdit int endHyphen) {
nSetEndHyphenEdit(mNativePaint, endHyphen);
} |
Set a end hyphen edit on the paint.
By setting end hyphen edit, the measurement and drawing is performed with modifying
hyphenation at the end of line. For example, by passing
{@link #END_HYPHEN_EDIT_INSERT_HYPHEN} like as follows, HYPHEN(U+2010)
character is appended at the end of line.
<pre>
<code>
Paint paint = new Paint();
paint.setEndHyphenEdit(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN);
paint.measureText("abc", 0, 3); // Returns the width of "abc-"
Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "abc-"
</code>
</pre>
The default value is 0 which is equivalent to {@link #END_HYPHEN_EDIT_NO_EDIT}.
@param endHyphen a end hyphen edit value.
@see #getEndHyphenEdit()
| Align::setEndHyphenEdit | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float ascent() {
return nAscent(mNativePaint);
} |
Return the distance above (negative) the baseline (ascent) based on the
current typeface and text size.
<p>Note that this is the ascent of the main typeface, and actual text rendered may need a
larger ascent because fallback fonts may get used in rendering the text.
@return the distance above (negative) the baseline (ascent) based on the
current typeface and text size.
| Align::ascent | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float descent() {
return nDescent(mNativePaint);
} |
Return the distance below (positive) the baseline (descent) based on the
current typeface and text size.
<p>Note that this is the descent of the main typeface, and actual text rendered may need a
larger descent because fallback fonts may get used in rendering the text.
@return the distance below (positive) the baseline (descent) based on
the current typeface and text size.
| Align::descent | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getFontMetrics(FontMetrics metrics) {
return nGetFontMetrics(mNativePaint, metrics);
} |
Return the font's recommended interline spacing, given the Paint's
settings for typeface, textSize, etc. If metrics is not null, return the
fontmetric values in it.
<p>Note that these are the values for the main typeface, and actual text rendered may need a
larger set of values because fallback fonts may get used in rendering the text.
@param metrics If this object is not null, its fields are filled with
the appropriate values given the paint's text attributes.
@return the font's recommended interline spacing.
| FontMetrics::getFontMetrics | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public FontMetrics getFontMetrics() {
FontMetrics fm = new FontMetrics();
getFontMetrics(fm);
return fm;
} |
Allocates a new FontMetrics object, and then calls getFontMetrics(fm)
with it, returning the object.
| FontMetrics::getFontMetrics | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public int getFontMetricsInt(FontMetricsInt fmi) {
return nGetFontMetricsInt(mNativePaint, fmi);
} |
Return the font's interline spacing, given the Paint's settings for
typeface, textSize, etc. If metrics is not null, return the fontmetric
values in it. Note: all values have been converted to integers from
floats, in such a way has to make the answers useful for both spacing
and clipping. If you want more control over the rounding, call
getFontMetrics().
<p>Note that these are the values for the main typeface, and actual text rendered may need a
larger set of values because fallback fonts may get used in rendering the text.
@return the font's interline spacing.
| FontMetricsInt::getFontMetricsInt | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float getFontSpacing() {
return getFontMetrics(null);
} |
Return the recommend line spacing based on the current typeface and
text size.
<p>Note that this is the value for the main typeface, and actual text rendered may need a
larger value because fallback fonts may get used in rendering the text.
@return recommend line spacing based on the current typeface and
text size.
| FontMetricsInt::getFontSpacing | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float measureText(char[] text, int index, int count) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
if ((index | count) < 0 || index + count > text.length) {
throw new ArrayIndexOutOfBoundsException();
}
if (text.length == 0 || count == 0) {
return 0f;
}
if (!mHasCompatScaling) {
return (float) Math.ceil(nGetTextAdvances(mNativePaint, text,
index, count, index, count, mBidiFlags, null, 0));
}
final float oldSize = getTextSize();
setTextSize(oldSize * mCompatScaling);
final float w = nGetTextAdvances(mNativePaint, text, index, count, index, count,
mBidiFlags, null, 0);
setTextSize(oldSize);
return (float) Math.ceil(w*mInvCompatScaling);
} |
Return the width of the text.
@param text The text to measure. Cannot be null.
@param index The index of the first character to start measuring
@param count THe number of characters to measure, beginning with start
@return The width of the text
| FontMetricsInt::measureText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float measureText(String text, int start, int end) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
if ((start | end | (end - start) | (text.length() - end)) < 0) {
throw new IndexOutOfBoundsException();
}
if (text.length() == 0 || start == end) {
return 0f;
}
if (!mHasCompatScaling) {
return (float) Math.ceil(nGetTextAdvances(mNativePaint, text,
start, end, start, end, mBidiFlags, null, 0));
}
final float oldSize = getTextSize();
setTextSize(oldSize * mCompatScaling);
final float w = nGetTextAdvances(mNativePaint, text, start, end, start, end, mBidiFlags,
null, 0);
setTextSize(oldSize);
return (float) Math.ceil(w * mInvCompatScaling);
} |
Return the width of the text.
@param text The text to measure. Cannot be null.
@param start The index of the first character to start measuring
@param end 1 beyond the index of the last character to measure
@return The width of the text
| FontMetricsInt::measureText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float measureText(String text) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
return measureText(text, 0, text.length());
} |
Return the width of the text.
@param text The text to measure. Cannot be null.
@return The width of the text
| FontMetricsInt::measureText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public float measureText(CharSequence text, int start, int end) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
if ((start | end | (end - start) | (text.length() - end)) < 0) {
throw new IndexOutOfBoundsException();
}
if (text.length() == 0 || start == end) {
return 0f;
}
if (text instanceof String) {
return measureText((String)text, start, end);
}
if (text instanceof SpannedString ||
text instanceof SpannableString) {
return measureText(text.toString(), start, end);
}
if (text instanceof GraphicsOperations) {
return ((GraphicsOperations)text).measureText(start, end, this);
}
char[] buf = TemporaryBuffer.obtain(end - start);
TextUtils.getChars(text, start, end, buf, 0);
float result = measureText(buf, 0, end - start);
TemporaryBuffer.recycle(buf);
return result;
} |
Return the width of the text.
@param text The text to measure
@param start The index of the first character to start measuring
@param end 1 beyond the index of the last character to measure
@return The width of the text
| FontMetricsInt::measureText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public int breakText(char[] text, int index, int count,
float maxWidth, float[] measuredWidth) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
if (index < 0 || text.length - index < Math.abs(count)) {
throw new ArrayIndexOutOfBoundsException();
}
if (text.length == 0 || count == 0) {
return 0;
}
if (!mHasCompatScaling) {
return nBreakText(mNativePaint, text, index, count, maxWidth, mBidiFlags,
measuredWidth);
}
final float oldSize = getTextSize();
setTextSize(oldSize * mCompatScaling);
final int res = nBreakText(mNativePaint, text, index, count, maxWidth * mCompatScaling,
mBidiFlags, measuredWidth);
setTextSize(oldSize);
if (measuredWidth != null) measuredWidth[0] *= mInvCompatScaling;
return res;
} |
Measure the text, stopping early if the measured width exceeds maxWidth.
Return the number of chars that were measured, and if measuredWidth is
not null, return in it the actual width measured.
@param text The text to measure. Cannot be null.
@param index The offset into text to begin measuring at
@param count The number of maximum number of entries to measure. If count
is negative, then the characters are measured in reverse order.
@param maxWidth The maximum width to accumulate.
@param measuredWidth Optional. If not null, returns the actual width
measured.
@return The number of chars that were measured. Will always be <=
abs(count).
| FontMetricsInt::breakText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
public int breakText(CharSequence text, int start, int end,
boolean measureForwards,
float maxWidth, float[] measuredWidth) {
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
if ((start | end | (end - start) | (text.length() - end)) < 0) {
throw new IndexOutOfBoundsException();
}
if (text.length() == 0 || start == end) {
return 0;
}
if (start == 0 && text instanceof String && end == text.length()) {
return breakText((String) text, measureForwards, maxWidth,
measuredWidth);
}
char[] buf = TemporaryBuffer.obtain(end - start);
int result;
TextUtils.getChars(text, start, end, buf, 0);
if (measureForwards) {
result = breakText(buf, 0, end - start, maxWidth, measuredWidth);
} else {
result = breakText(buf, 0, -(end - start), maxWidth, measuredWidth);
}
TemporaryBuffer.recycle(buf);
return result;
} |
Measure the text, stopping early if the measured width exceeds maxWidth.
Return the number of chars that were measured, and if measuredWidth is
not null, return in it the actual width measured.
@param text The text to measure. Cannot be null.
@param start The offset into text to begin measuring at
@param end The end of the text slice to measure.
@param measureForwards If true, measure forwards, starting at start.
Otherwise, measure backwards, starting with end.
@param maxWidth The maximum width to accumulate.
@param measuredWidth Optional. If not null, returns the actual width
measured.
@return The number of chars that were measured. Will always be <=
abs(end - start).
| FontMetricsInt::breakText | java | Reginer/aosp-android-jar | android-32/src/android/graphics/Paint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/Paint.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.