IT. Expert System.

Android Reference

Paint


android.graphics

Class Paint

  • Direct Known Subclasses:
    TextPaint


    public class Paint
    extends Object
    The Paint class holds the style and color information about how to draw geometries, text and bitmaps.
    • Nested Class Summary

      Nested Classes
      Modifier and Type Class and Description
      static class Paint.Align
      Align specifies how drawText aligns its text relative to the [x,y] coordinates.
      static class Paint.Cap
      The Cap specifies the treatment for the beginning and ending of stroked lines and paths.
      static class Paint.FontMetrics
      Class that describes the various metrics for a font at a given text size.
      static class Paint.FontMetricsInt
      Convenience method for callers that want to have FontMetrics values as integers.
      static class Paint.Join
      The Join specifies the treatment where lines and curve segments join on a stroked path.
      static class Paint.Style
      The Style specifies if the primitive being drawn is filled, stroked, or both (in the same color).
    • Field Summary

      Fields
      Modifier and Type Field and Description
      static int ANTI_ALIAS_FLAG
      bit mask for the flag enabling antialiasing
      static int BIDI_DEFAULT_LTR
      Bidi flag to detect paragraph direction via heuristics, defaulting to LTR.
      static int BIDI_DEFAULT_RTL
      Bidi flag to detect paragraph direction via heuristics, defaulting to RTL.
      static int BIDI_FORCE_LTR
      Bidi flag to override direction to all LTR (ignore bidi).
      static int BIDI_FORCE_RTL
      Bidi flag to override direction to all RTL (ignore bidi).
      static int BIDI_LTR
      Bidi flag to set LTR paragraph direction.
      static int BIDI_RTL
      Bidi flag to set RTL paragraph direction.
      static int CURSOR_AFTER
      Option for getTextRunCursor to compute the valid cursor after offset or the limit of the context, whichever is less.
      static int CURSOR_AT
      Option for getTextRunCursor to return offset if the cursor at offset is valid, or -1 if it isn't.
      static int CURSOR_AT_OR_AFTER
      Option for getTextRunCursor to compute the valid cursor at or after the offset or the limit of the context, whichever is less.
      static int CURSOR_AT_OR_BEFORE
      Option for getTextRunCursor to compute the valid cursor at or before offset or the start of the context, whichever is greater.
      static int CURSOR_BEFORE
      Option for getTextRunCursor to compute the valid cursor before offset or the start of the context, whichever is greater.
      static int DEV_KERN_TEXT_FLAG
      bit mask for the flag enabling device kerning for text
      static int DIRECTION_LTR
      Flag for getTextRunAdvances indicating left-to-right run direction.
      static int DIRECTION_RTL
      Flag for getTextRunAdvances indicating right-to-left run direction.
      static int DITHER_FLAG
      bit mask for the flag enabling dithering
      static int FAKE_BOLD_TEXT_FLAG
      bit mask for the flag enabling fake-bold text
      static int FILTER_BITMAP_FLAG
      bit mask for the flag enabling bitmap filtering
      boolean hasShadow
      static int HINTING_OFF
      Option for setHinting(int): disable hinting.
      static int HINTING_ON
      Option for setHinting(int): enable hinting.
      static int LINEAR_TEXT_FLAG
      bit mask for the flag enabling linear-text (no caching)
      int mBidiFlags
      int mNativePaint
      int shadowColor
      float shadowDx
      float shadowDy
      float shadowRadius
      static int STRIKE_THRU_TEXT_FLAG
      bit mask for the flag enabling strike-thru text
      static int SUBPIXEL_TEXT_FLAG
      bit mask for the flag enabling subpixel-text
      static int UNDERLINE_TEXT_FLAG
      bit mask for the flag enabling underline text
    • Constructor Summary

      Constructors
      Constructor and Description
      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.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      float ascent()
      Return the distance above (negative) the baseline (ascent) based on the current typeface and text size.
      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(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(String text, boolean measureForwards, float maxWidth, float[] measuredWidth)
      Measure the text, stopping early if the measured width exceeds maxWidth.
      void clearShadowLayer()
      Clear the shadow layer.
      float descent()
      Return the distance below (positive) the baseline (descent) based on the current typeface and text size.
      protected void finalize()
      Invoked when the garbage collector has detected that this instance is no longer reachable.
      int getAlpha()
      Helper to getColor() that just returns the color's alpha value.
      int getBidiFlags()
      Return the bidi flags on the paint.
      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.
      Paint.FontMetrics getFontMetrics()
      Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object.
      float getFontMetrics(Paint.FontMetrics metrics)
      Return the font's recommended interline spacing, given the Paint's settings for typeface, textSize, etc.
      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.
      int getHinting()
      Return the paint's hinting mode.
      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).
      int getTextGlyphs(String text, int start, int end, int contextStart, int contextEnd, int flags, char[] glyphs)
      Return the glyph Ids for the characters in the string.
      Locale getTextLocale()
      Get the text Locale.
      void getTextPath(char[] text, int index, int count, float x, float y, Path path)
      Return the path (outline) for the specified text.
      void getTextPath(String text, int start, int end, float x, float y, Path path)
      Return the path (outline) for the specified text.
      float getTextRunAdvances(char[] chars, int index, int count, int contextIndex, int contextCount, int flags, float[] advances, int advancesIndex)
      Convenience overload that takes a char array instead of a String.
      float getTextRunAdvances(char[] chars, int index, int count, int contextIndex, int contextCount, int flags, float[] advances, int advancesIndex, int reserved)
      Convenience overload that takes a char array instead of a String.
      float getTextRunAdvances(CharSequence text, int start, int end, int contextStart, int contextEnd, int flags, float[] advances, int advancesIndex)
      Convenience overload that takes a CharSequence instead of a String.
      float getTextRunAdvances(CharSequence text, int start, int end, int contextStart, int contextEnd, int flags, float[] advances, int advancesIndex, int reserved)
      Convenience overload that takes a CharSequence instead of a String.
      float getTextRunAdvances(String text, int start, int end, int contextStart, int contextEnd, int flags, float[] advances, int advancesIndex)
      Returns the total advance width for the characters in the run between start and end, and if advances is not null, the advance assigned to each of these characters (java chars).
      float getTextRunAdvances(String text, int start, int end, int contextStart, int contextEnd, int flags, float[] advances, int advancesIndex, int reserved)
      Returns the total advance width for the characters in the run between start and end, and if advances is not null, the advance assigned to each of these characters (java chars).
      int getTextRunCursor(char[] text, int contextStart, int contextLength, int flags, int offset, int cursorOpt)
      Returns the next cursor position in the run.
      int getTextRunCursor(CharSequence text, int contextStart, int contextEnd, int flags, int offset, int cursorOpt)
      Returns the next cursor position in the run.
      int getTextRunCursor(String text, int contextStart, int contextEnd, int flags, int offset, int cursorOpt)
      Returns the next cursor position in the run.
      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(char[] text, int index, int count, float[] widths)
      Return the advance widths for the characters in the string.
      int getTextWidths(CharSequence 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.
      int getTextWidths(String text, int start, int end, 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.
      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.
      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.
      boolean isFakeBoldText()
      Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set
      boolean isFilterBitmap()
      Whether or not the bitmap filter is activated.
      boolean isLinearText()
      Deprecated.
      boolean isStrikeThruText()
      Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set
      boolean isSubpixelText()
      Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set
      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(CharSequence text, int start, int end)
      Return the width of the text.
      float measureText(String text)
      Return the width of the text.
      float measureText(String text, int start, int end)
      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 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 setARGB(int a, int r, int g, int b)
      Helper to setColor(), that takes a,r,g,b and constructs the color int
      void setBidiFlags(int flags)
      Set the bidi flags on the paint.
      void setColor(int color)
      Set the paint's color.
      ColorFilter setColorFilter(ColorFilter filter)
      Set or clear the paint's colorfilter, returning the parameter.
      void setCompatibilityScaling(float factor)
      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 FAKE_BOLD_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 setHinting(int mode)
      Set the paint's hinting mode.
      void setLinearText(boolean linearText)
      Deprecated.
      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)
      This draws a shadow layer below the main layer, with the specified offset and color, and blur radius.
      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 setTextLocale(Locale locale)
      Set the text locale.
      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.
    • Field Detail

      • mNativePaint

        public int mNativePaint
      • hasShadow

        public boolean hasShadow
      • shadowDx

        public float shadowDx
      • shadowDy

        public float shadowDy
      • shadowRadius

        public float shadowRadius
      • shadowColor

        public int shadowColor
      • mBidiFlags

        public int mBidiFlags
      • ANTI_ALIAS_FLAG

        public static final int ANTI_ALIAS_FLAG
        bit mask for the flag enabling antialiasing
        See Also:
        Constant Field Values
      • FILTER_BITMAP_FLAG

        public static final int FILTER_BITMAP_FLAG
        bit mask for the flag enabling bitmap filtering
        See Also:
        Constant Field Values
      • DITHER_FLAG

        public static final int DITHER_FLAG
        bit mask for the flag enabling dithering
        See Also:
        Constant Field Values
      • UNDERLINE_TEXT_FLAG

        public static final int UNDERLINE_TEXT_FLAG
        bit mask for the flag enabling underline text
        See Also:
        Constant Field Values
      • STRIKE_THRU_TEXT_FLAG

        public static final int STRIKE_THRU_TEXT_FLAG
        bit mask for the flag enabling strike-thru text
        See Also:
        Constant Field Values
      • FAKE_BOLD_TEXT_FLAG

        public static final int FAKE_BOLD_TEXT_FLAG
        bit mask for the flag enabling fake-bold text
        See Also:
        Constant Field Values
      • LINEAR_TEXT_FLAG

        public static final int LINEAR_TEXT_FLAG
        bit mask for the flag enabling linear-text (no caching)
        See Also:
        Constant Field Values
      • SUBPIXEL_TEXT_FLAG

        public static final int SUBPIXEL_TEXT_FLAG
        bit mask for the flag enabling subpixel-text
        See Also:
        Constant Field Values
      • DEV_KERN_TEXT_FLAG

        public static final int DEV_KERN_TEXT_FLAG
        bit mask for the flag enabling device kerning for text
        See Also:
        Constant Field Values
      • BIDI_LTR

        public static final int BIDI_LTR
        Bidi flag to set LTR paragraph direction.
        See Also:
        Constant Field Values
      • BIDI_RTL

        public static final int BIDI_RTL
        Bidi flag to set RTL paragraph direction.
        See Also:
        Constant Field Values
      • BIDI_DEFAULT_LTR

        public static final int BIDI_DEFAULT_LTR
        Bidi flag to detect paragraph direction via heuristics, defaulting to LTR.
        See Also:
        Constant Field Values
      • BIDI_DEFAULT_RTL

        public static final int BIDI_DEFAULT_RTL
        Bidi flag to detect paragraph direction via heuristics, defaulting to RTL.
        See Also:
        Constant Field Values
      • BIDI_FORCE_LTR

        public static final int BIDI_FORCE_LTR
        Bidi flag to override direction to all LTR (ignore bidi).
        See Also:
        Constant Field Values
      • BIDI_FORCE_RTL

        public static final int BIDI_FORCE_RTL
        Bidi flag to override direction to all RTL (ignore bidi).
        See Also:
        Constant Field Values
      • DIRECTION_LTR

        public static final int DIRECTION_LTR
        Flag for getTextRunAdvances indicating left-to-right run direction.
        See Also:
        Constant Field Values
      • DIRECTION_RTL

        public static final int DIRECTION_RTL
        Flag for getTextRunAdvances indicating right-to-left run direction.
        See Also:
        Constant Field Values
      • CURSOR_AFTER

        public static final int CURSOR_AFTER
        Option for getTextRunCursor to compute the valid cursor after offset or the limit of the context, whichever is less.
        See Also:
        Constant Field Values
      • CURSOR_AT_OR_AFTER

        public static final int CURSOR_AT_OR_AFTER
        Option for getTextRunCursor to compute the valid cursor at or after the offset or the limit of the context, whichever is less.
        See Also:
        Constant Field Values
      • CURSOR_BEFORE

        public static final int CURSOR_BEFORE
        Option for getTextRunCursor to compute the valid cursor before offset or the start of the context, whichever is greater.
        See Also:
        Constant Field Values
      • CURSOR_AT_OR_BEFORE

        public static final int CURSOR_AT_OR_BEFORE
        Option for getTextRunCursor to compute the valid cursor at or before offset or the start of the context, whichever is greater.
        See Also:
        Constant Field Values
      • CURSOR_AT

        public static final int CURSOR_AT
        Option for getTextRunCursor to return offset if the cursor at offset is valid, or -1 if it isn't.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Paint

        public Paint()
        Create a new paint with default settings.
      • Paint

        public Paint(int flags)
        Create a new paint with the specified flags. Use setFlags() to change these after the paint is created.
        Parameters:
        flags - initial flag bits, as if they were passed via setFlags().
      • Paint

        public Paint(Paint paint)
        Create a new paint, initialized with the attributes in the specified paint parameter.
        Parameters:
        paint - Existing paint used to initialized the attributes of the new paint.
    • Method Detail

      • reset

        public void reset()
        Restores the paint to its default settings.
      • set

        public void set(Paint src)
        Copy the fields from src into this paint. This is equivalent to calling get() on all of the src fields, and calling the corresponding set() methods on this.
      • setCompatibilityScaling

        public void setCompatibilityScaling(float factor)
      • getBidiFlags

        public int getBidiFlags()
        Return the bidi flags on the paint.
        Returns:
        the bidi flags on the paint
      • setBidiFlags

        public void setBidiFlags(int flags)
        Set the bidi flags on the paint.
      • getFlags

        public int getFlags()
        Return the paint's flags. Use the Flag enum to test flag values.
        Returns:
        the paint's flags (see enums ending in _Flag for bit masks)
      • setFlags

        public void setFlags(int flags)
        Set the paint's flags. Use the Flag enum to specific flag values.
        Parameters:
        flags - The new flag bits for the paint
      • getHinting

        public int getHinting()
        Return the paint's hinting mode. Returns either HINTING_OFF or HINTING_ON.
      • setHinting

        public void setHinting(int mode)
        Set the paint's hinting mode. May be either HINTING_OFF or HINTING_ON.
      • isAntiAlias

        public 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. See setDither() and setFilterBitmap() to affect how colors are treated.
        Returns:
        true if the antialias bit is set in the paint's flags.
      • setAntiAlias

        public 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. See setDither() and setFilterBitmap() to affect how colors are treated.
        Parameters:
        aa - true to set the antialias bit in the flags, false to clear it
      • isDither

        public 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. 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.
        Returns:
        true if the dithering bit is set in the paint's flags.
      • setDither

        public 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. 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.
        Parameters:
        dither - true to set the dithering bit in flags, false to clear it
      • isLinearText

        @Deprecated
        public final boolean isLinearText()
        Deprecated.
        Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set
        Returns:
        true if the lineartext bit is set in the paint's flags
      • setLinearText

        @Deprecated
        public void setLinearText(boolean linearText)
        Deprecated.
        Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit
        Parameters:
        linearText - true to set the linearText bit in the paint's flags, false to clear it.
      • isSubpixelText

        public final boolean isSubpixelText()
        Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set
        Returns:
        true if the subpixel bit is set in the paint's flags
      • setSubpixelText

        public void setSubpixelText(boolean subpixelText)
        Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit
        Parameters:
        subpixelText - true to set the subpixelText bit in the paint's flags, false to clear it.
      • isUnderlineText

        public final boolean isUnderlineText()
        Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set
        Returns:
        true if the underlineText bit is set in the paint's flags.
      • setUnderlineText

        public void setUnderlineText(boolean underlineText)
        Helper for setFlags(), setting or clearing the UNDERLINE_TEXT_FLAG bit
        Parameters:
        underlineText - true to set the underlineText bit in the paint's flags, false to clear it.
      • isStrikeThruText

        public final boolean isStrikeThruText()
        Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set
        Returns:
        true if the strikeThruText bit is set in the paint's flags.
      • setStrikeThruText

        public void setStrikeThruText(boolean strikeThruText)
        Helper for setFlags(), setting or clearing the STRIKE_THRU_TEXT_FLAG bit
        Parameters:
        strikeThruText - true to set the strikeThruText bit in the paint's flags, false to clear it.
      • isFakeBoldText

        public final boolean isFakeBoldText()
        Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set
        Returns:
        true if the fakeBoldText bit is set in the paint's flags.
      • setFakeBoldText

        public void setFakeBoldText(boolean fakeBoldText)
        Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit
        Parameters:
        fakeBoldText - true to set the fakeBoldText bit in the paint's flags, false to clear it.
      • isFilterBitmap

        public final boolean isFilterBitmap()
        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 Also:
        setFilterBitmap()
      • setFilterBitmap

        public void setFilterBitmap(boolean 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.
        Parameters:
        filter - true to set the FILTER_BITMAP_FLAG bit in the paint's flags, false to clear it.
      • getStyle

        public Paint.Style getStyle()
        Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes FILL_STYLE).
        Returns:
        the paint's style setting (Fill, Stroke, StrokeAndFill)
      • setStyle

        public 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).
        Parameters:
        style - The new style to set in the paint
      • getColor

        public int getColor()
        Return the paint's color. Note that the color is a 32bit value 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.
        Returns:
        the paint's color (and alpha).
      • setColor

        public void setColor(int 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.
        Parameters:
        color - The new color (including alpha) to set in the paint.
      • getAlpha

        public int getAlpha()
        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).
        Returns:
        the alpha component of the paint's color.
      • setAlpha

        public void setAlpha(int 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]
        Parameters:
        a - set the alpha component [0..255] of the paint's color.
      • setARGB

        public void setARGB(int a,
                   int r,
                   int g,
                   int b)
        Helper to setColor(), that takes a,r,g,b and constructs the color int
        Parameters:
        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.
      • getStrokeWidth

        public float getStrokeWidth()
        Return the width for stroking.

        A value of 0 strokes in hairline mode. Hairlines always draws a single pixel independent of the canva's matrix.

        Returns:
        the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill.
      • setStrokeWidth

        public void setStrokeWidth(float width)
        Set the width for stroking. Pass 0 to stroke in hairline mode. Hairlines always draws a single pixel independent of the canva's matrix.
        Parameters:
        width - set the paint's stroke width, used whenever the paint's style is Stroke or StrokeAndFill.
      • getStrokeMiter

        public float getStrokeMiter()
        Return the paint's stroke miter value. Used to control the behavior of miter joins when the joins angle is sharp.
        Returns:
        the paint's miter limit, used whenever the paint's style is Stroke or StrokeAndFill.
      • setStrokeMiter

        public void setStrokeMiter(float 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.
        Parameters:
        miter - set the miter limit on the paint, used whenever the paint's style is Stroke or StrokeAndFill.
      • getStrokeCap

        public Paint.Cap getStrokeCap()
        Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated.
        Returns:
        the line cap style for the paint, used whenever the paint's style is Stroke or StrokeAndFill.
      • setStrokeCap

        public void setStrokeCap(Paint.Cap cap)
        Set the paint's Cap.
        Parameters:
        cap - set the paint's line cap style, used whenever the paint's style is Stroke or StrokeAndFill.
      • getStrokeJoin

        public Paint.Join getStrokeJoin()
        Return the paint's stroke join type.
        Returns:
        the paint's Join.
      • setStrokeJoin

        public void setStrokeJoin(Paint.Join join)
        Set the paint's Join.
        Parameters:
        join - set the paint's Join, used whenever the paint's style is Stroke or StrokeAndFill.
      • getFillPath

        public boolean getFillPath(Path src,
                          Path dst)
        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).
        Parameters:
        src - input path
        dst - output path (may be the same as src)
        Returns:
        true if the path should be filled, or false if it should be drawn with a hairline (width == 0)
      • getShader

        public Shader getShader()
        Get the paint's shader object.
        Returns:
        the paint's shader (or null)
      • setShader

        public Shader setShader(Shader shader)
        Set or clear the shader object.

        Pass null to clear any previous shader. As a convenience, the parameter passed is also returned.

        Parameters:
        shader - May be null. the new shader to be installed in the paint
        Returns:
        shader
      • getColorFilter

        public ColorFilter getColorFilter()
        Get the paint's colorfilter (maybe be null).
        Returns:
        the paint's colorfilter (maybe be null)
      • setColorFilter

        public ColorFilter setColorFilter(ColorFilter filter)
        Set or clear the paint's colorfilter, returning the parameter.
        Parameters:
        filter - May be null. The new filter to be installed in the paint
        Returns:
        filter
      • getXfermode

        public Xfermode getXfermode()
        Get the paint's xfermode object.
        Returns:
        the paint's xfermode (or null)
      • setXfermode

        public Xfermode setXfermode(Xfermode xfermode)
        Set or clear the xfermode object.

        Pass null to clear any previous xfermode. As a convenience, the parameter passed is also returned.

        Parameters:
        xfermode - May be null. The xfermode to be installed in the paint
        Returns:
        xfermode
      • getPathEffect

        public PathEffect getPathEffect()
        Get the paint's patheffect object.
        Returns:
        the paint's patheffect (or null)
      • setPathEffect

        public PathEffect setPathEffect(PathEffect effect)
        Set or clear the patheffect object.

        Pass null to clear any previous patheffect. As a convenience, the parameter passed is also returned.

        Parameters:
        effect - May be null. The patheffect to be installed in the paint
        Returns:
        effect
      • getMaskFilter

        public MaskFilter getMaskFilter()
        Get the paint's maskfilter object.
        Returns:
        the paint's maskfilter (or null)
      • setMaskFilter

        public MaskFilter setMaskFilter(MaskFilter maskfilter)
        Set or clear the maskfilter object.

        Pass null to clear any previous maskfilter. As a convenience, the parameter passed is also returned.

        Parameters:
        maskfilter - May be null. The maskfilter to be installed in the paint
        Returns:
        maskfilter
      • getTypeface

        public Typeface getTypeface()
        Get the paint's typeface object.

        The typeface object identifies which font to use when drawing or measuring text.

        Returns:
        the paint's typeface (or null)
      • setTypeface

        public Typeface setTypeface(Typeface typeface)
        Set or clear the typeface object.

        Pass null to clear any previous typeface. As a convenience, the parameter passed is also returned.

        Parameters:
        typeface - May be null. The typeface to be installed in the paint
        Returns:
        typeface
      • getRasterizer

        public Rasterizer getRasterizer()
        Get the paint's rasterizer (or null).

        The raster controls/modifies how paths/text are turned into alpha masks.

        Returns:
        the paint's rasterizer (or null)
      • setRasterizer

        public Rasterizer setRasterizer(Rasterizer rasterizer)
        Set or clear the rasterizer object.

        Pass null to clear any previous rasterizer. As a convenience, the parameter passed is also returned.

        Parameters:
        rasterizer - May be null. The new rasterizer to be installed in the paint.
        Returns:
        rasterizer
      • setShadowLayer

        public void setShadowLayer(float radius,
                          float dx,
                          float dy,
                          int color)
        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.
      • clearShadowLayer

        public void clearShadowLayer()
        Clear the shadow layer.
      • getTextAlign

        public Paint.Align getTextAlign()
        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.
        Returns:
        the paint's Align value for drawing text.
      • setTextAlign

        public void setTextAlign(Paint.Align align)
        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.
        Parameters:
        align - set the paint's Align value for drawing text.
      • getTextLocale

        public Locale getTextLocale()
        Get the text Locale.
        Returns:
        the paint's Locale used for drawing text, never null.
      • setTextLocale

        public void setTextLocale(Locale locale)
        Set the text locale. The text locale affects how the text is drawn for some languages. For example, if the locale is Locale.CHINESE or Locale.CHINA, then the text renderer will prefer to draw text using a Chinese font. Likewise, if the locale is Locale.JAPANESE or Locale.JAPAN, then the text renderer will prefer to draw text using a Japanese 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 is initialized to the system locale (as returned by Locale.getDefault()). This assumes that the text to be rendered will most likely be in the user's preferred language. If the actual language of the text is known, then it 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 locale just helps it do a better job in certain ambiguous cases
        Parameters:
        locale - the paint's locale value for drawing text, must not be null.
      • getTextSize

        public float getTextSize()
        Return the paint's text size.
        Returns:
        the paint's text size.
      • setTextSize

        public void setTextSize(float textSize)
        Set the paint's text size. This value must be > 0
        Parameters:
        textSize - set the paint's text size.
      • getTextScaleX

        public float getTextScaleX()
        Return the paint's horizontal scale factor for text. The default value is 1.0.
        Returns:
        the paint's scale factor in X for drawing/measuring text
      • setTextScaleX

        public void setTextScaleX(float 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.
        Parameters:
        scaleX - set the paint's scale in X for drawing/measuring text.
      • getTextSkewX

        public float getTextSkewX()
        Return the paint's horizontal skew factor for text. The default value is 0.
        Returns:
        the paint's skew factor in X for drawing text.
      • setTextSkewX

        public void setTextSkewX(float skewX)
        Set the paint's horizontal skew factor for text. The default value is 0. For approximating oblique text, use values around -0.25.
        Parameters:
        skewX - set the paint's skew factor in X for drawing text.
      • ascent

        public float ascent()
        Return the distance above (negative) the baseline (ascent) based on the current typeface and text size.
        Returns:
        the distance above (negative) the baseline (ascent) based on the current typeface and text size.
      • descent

        public float descent()
        Return the distance below (positive) the baseline (descent) based on the current typeface and text size.
        Returns:
        the distance below (positive) the baseline (descent) based on the current typeface and text size.
      • getFontMetrics

        public float getFontMetrics(Paint.FontMetrics 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.
        Parameters:
        metrics - If this object is not null, its fields are filled with the appropriate values given the paint's text attributes.
        Returns:
        the font's recommended interline spacing.
      • getFontMetrics

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

        public int getFontMetricsInt(Paint.FontMetricsInt 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().
        Returns:
        the font's interline spacing.
      • getFontSpacing

        public float getFontSpacing()
        Return the recommend line spacing based on the current typeface and text size.
        Returns:
        recommend line spacing based on the current typeface and text size.
      • measureText

        public float measureText(char[] text,
                        int index,
                        int count)
        Return the width of the text.
        Parameters:
        text - The text to measure. Cannot be null.
        index - The index of the first character to start measuring
        count - THe number of characters to measure, beginning with start
        Returns:
        The width of the text
      • measureText

        public float measureText(String text,
                        int start,
                        int end)
        Return the width of the text.
        Parameters:
        text - The text to measure. Cannot be null.
        start - The index of the first character to start measuring
        end - 1 beyond the index of the last character to measure
        Returns:
        The width of the text
      • measureText

        public float measureText(String text)
        Return the width of the text.
        Parameters:
        text - The text to measure. Cannot be null.
        Returns:
        The width of the text
      • measureText

        public float measureText(CharSequence text,
                        int start,
                        int end)
        Return the width of the text.
        Parameters:
        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
        Returns:
        The width of the text
      • breakText

        public int breakText(char[] text,
                    int index,
                    int count,
                    float maxWidth,
                    float[] measuredWidth)
        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.
        Parameters:
        text - The text to measure. Cannot be null.
        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 are measured in reverse order.
        maxWidth - The maximum width to accumulate.
        measuredWidth - Optional. If not null, returns the actual width measured.
        Returns:
        The number of chars that were measured. Will always be <= abs(count).
      • breakText

        public 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. Return the number of chars that were measured, and if measuredWidth is not null, return in it the actual width measured.
        Parameters:
        text - The text to measure. Cannot be null.
        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.
        Returns:
        The number of chars that were measured. Will always be <= abs(end - start).
      • breakText

        public int breakText(String text,
                    boolean measureForwards,
                    float maxWidth,
                    float[] measuredWidth)
        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.
        Parameters:
        text - The text to measure. Cannot be null.
        measureForwards - If true, measure forwards, starting with the first character in the string. 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.
        Returns:
        The number of chars that were measured. Will always be <= abs(count).
      • getTextWidths

        public int getTextWidths(char[] text,
                        int index,
                        int count,
                        float[] widths)
        Return the advance widths for the characters in the string.
        Parameters:
        text - The text to measure. Cannot be null.
        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.
        Returns:
        the actual number of widths returned.
      • getTextWidths

        public int getTextWidths(CharSequence text,
                        int start,
                        int end,
                        float[] widths)
        Return the advance widths for the characters in the string.
        Parameters:
        text - The text to measure. Cannot be null.
        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).
        Returns:
        the actual number of widths returned.
      • getTextWidths

        public int getTextWidths(String text,
                        int start,
                        int end,
                        float[] widths)
        Return the advance widths for the characters in the string.
        Parameters:
        text - The text to measure. Cannot be null.
        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.
        Returns:
        the number of unichars in the specified text.
      • getTextWidths

        public int getTextWidths(String text,
                        float[] widths)
        Return the advance widths for the characters in the string.
        Parameters:
        text - The text to measure
        widths - array to receive the advance widths of the characters. Must be at least a large as the text.
        Returns:
        the number of unichars in the specified text.
      • getTextGlyphs

        public int getTextGlyphs(String text,
                        int start,
                        int end,
                        int contextStart,
                        int contextEnd,
                        int flags,
                        char[] glyphs)
        Return the glyph Ids for the characters in the string.
        Parameters:
        text - The text to measure
        start - The index of the first char to to measure
        end - The end of the text slice to measure
        contextStart - the index of the first character to use for shaping context, must be <= start
        contextEnd - the index past the last character to use for shaping context, must be >= end
        flags - the flags to control the advances, either DIRECTION_LTR or DIRECTION_RTL
        glyphs - array to receive the glyph Ids of the characters. Must be at least a large as the text.
        Returns:
        the number of glyphs in the returned array
      • getTextRunAdvances

        public float getTextRunAdvances(String text,
                               int start,
                               int end,
                               int contextStart,
                               int contextEnd,
                               int flags,
                               float[] advances,
                               int advancesIndex)
        Returns the total advance width for the characters in the run between start and end, and if advances is not null, the advance assigned to each of these characters (java chars).

        The trailing surrogate in a valid surrogate pair is assigned an advance of 0. Thus the number of returned advances is always equal to count, not to the number of unicode codepoints represented by the run.

        In the case of conjuncts or combining marks, the total advance is assigned to the first logical character, and the following characters are assigned an advance of 0.

        This generates the sum of the advances of glyphs for characters in a reordered cluster as the width of the first logical character in the cluster, and 0 for the widths of all other characters in the cluster. In effect, such clusters are treated like conjuncts.

        The shaping bounds limit the amount of context available outside start and end that can be used for shaping analysis. These bounds typically reflect changes in bidi level or font metrics across which shaping does not occur.

        Parameters:
        text - the text to measure. Cannot be null.
        start - the index of the first character to measure
        end - the index past the last character to measure
        contextStart - the index of the first character to use for shaping context, must be <= start
        contextEnd - the index past the last character to use for shaping context, must be >= end
        flags - the flags to control the advances, either DIRECTION_LTR or DIRECTION_RTL
        advances - array to receive the advances, must have room for all advances, can be null if only total advance is needed
        advancesIndex - the position in advances at which to put the advance corresponding to the character at start
        Returns:
        the total advance
      • getTextRunAdvances

        public float getTextRunAdvances(String text,
                               int start,
                               int end,
                               int contextStart,
                               int contextEnd,
                               int flags,
                               float[] advances,
                               int advancesIndex,
                               int reserved)
        Returns the total advance width for the characters in the run between start and end, and if advances is not null, the advance assigned to each of these characters (java chars).

        The trailing surrogate in a valid surrogate pair is assigned an advance of 0. Thus the number of returned advances is always equal to count, not to the number of unicode codepoints represented by the run.

        In the case of conjuncts or combining marks, the total advance is assigned to the first logical character, and the following characters are assigned an advance of 0.

        This generates the sum of the advances of glyphs for characters in a reordered cluster as the width of the first logical character in the cluster, and 0 for the widths of all other characters in the cluster. In effect, such clusters are treated like conjuncts.

        The shaping bounds limit the amount of context available outside start and end that can be used for shaping analysis. These bounds typically reflect changes in bidi level or font metrics across which shaping does not occur.

        Parameters:
        text - the text to measure. Cannot be null.
        start - the index of the first character to measure
        end - the index past the last character to measure
        contextStart - the index of the first character to use for shaping context, must be <= start
        contextEnd - the index past the last character to use for shaping context, must be >= end
        flags - the flags to control the advances, either DIRECTION_LTR or DIRECTION_RTL
        advances - array to receive the advances, must have room for all advances, can be null if only total advance is needed
        advancesIndex - the position in advances at which to put the advance corresponding to the character at start
        reserved - int reserved value
        Returns:
        the total advance
      • getTextRunCursor

        public int getTextRunCursor(char[] text,
                           int contextStart,
                           int contextLength,
                           int flags,
                           int offset,
                           int cursorOpt)
        Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster.

        ContextStart and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement.

        If cursorOpt is CURSOR_AT and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextStart + contextLength.

        Parameters:
        text - the text
        contextStart - the start of the context
        contextLength - the length of the context
        flags - either DIRECTION_RTL or DIRECTION_LTR
        offset - the cursor position to move from
        cursorOpt - how to move the cursor, one of CURSOR_AFTER, CURSOR_AT_OR_AFTER, CURSOR_BEFORE, CURSOR_AT_OR_BEFORE, or CURSOR_AT
        Returns:
        the offset of the next position, or -1
      • getTextRunCursor

        public int getTextRunCursor(CharSequence text,
                           int contextStart,
                           int contextEnd,
                           int flags,
                           int offset,
                           int cursorOpt)
        Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster.

        ContextStart, contextEnd, and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement.

        If cursorOpt is CURSOR_AT and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextEnd.

        Parameters:
        text - the text
        contextStart - the start of the context
        contextEnd - the end of the context
        flags - either DIRECTION_RTL or DIRECTION_LTR
        offset - the cursor position to move from
        cursorOpt - how to move the cursor, one of CURSOR_AFTER, CURSOR_AT_OR_AFTER, CURSOR_BEFORE, CURSOR_AT_OR_BEFORE, or CURSOR_AT
        Returns:
        the offset of the next position, or -1
      • getTextRunCursor

        public int getTextRunCursor(String text,
                           int contextStart,
                           int contextEnd,
                           int flags,
                           int offset,
                           int cursorOpt)
        Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster.

        ContextStart, contextEnd, and offset are relative to the start of text. The context is the shaping context for cursor movement, generally the bounds of the metric span enclosing the cursor in the direction of movement.

        If cursorOpt is CURSOR_AT and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextEnd.

        Parameters:
        text - the text
        contextStart - the start of the context
        contextEnd - the end of the context
        flags - either DIRECTION_RTL or DIRECTION_LTR
        offset - the cursor position to move from
        cursorOpt - how to move the cursor, one of CURSOR_AFTER, CURSOR_AT_OR_AFTER, CURSOR_BEFORE, CURSOR_AT_OR_BEFORE, or CURSOR_AT
        Returns:
        the offset of the next position, or -1
      • getTextPath

        public void getTextPath(char[] text,
                       int index,
                       int count,
                       float x,
                       float y,
                       Path path)
        Return the path (outline) for the specified text. Note: just like Canvas.drawText, this will respect the Align setting in the paint.
        Parameters:
        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.
      • getTextPath

        public void getTextPath(String text,
                       int start,
                       int end,
                       float x,
                       float y,
                       Path path)
        Return the path (outline) for the specified text. Note: just like Canvas.drawText, this will respect the Align setting in the paint.
        Parameters:
        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.
      • getTextBounds

        public 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).
        Parameters:
        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.
      • getTextBounds

        public 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).
        Parameters:
        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.
      • finalize

        protected void finalize()
                         throws Throwable
        Description copied from class: Object
        Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.

        Note that objects that override finalize are significantly more expensive than objects that don't. Finalizers may be run a long time after the object is no longer reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup. Note also that finalizers are run on a single VM-wide finalizer thread, so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary for a class that has a native peer and needs to call a native method to destroy that peer. Even then, it's better to provide an explicit close method (and implement Closeable), and insist that callers manually dispose of instances. This works well for something like files, but less well for something like a BigInteger where typical calling code would have to deal with lots of temporaries. Unfortunately, code that creates lots of temporaries is the worst kind of code from the point of view of the single finalizer thread.

        If you must use finalizers, consider at least providing your own ReferenceQueue and having your own thread process that queue.

        Unlike constructors, finalizers are not automatically chained. You are responsible for calling super.finalize() yourself.

        Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.

        Overrides:
        finalize in class Object
        Throws:
        Throwable


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3594 / . Delta: 0.08808 с