Add a new layer (above any previous layers) to the rasterizer. The layer will extract those fields that affect the mask from the specified paint, but will not retain a reference to the paint object itself, so it may be reused without danger of side-effects. Use SetLayerRasterizer after all layers are set.
Add a new layer (above any previous layers) to the rasterizer. The layer will extract those fields that affect the mask from the specified paint, but will not retain a reference to the paint object itself, so it may be reused without danger of side-effects. Use SetLayerRasterizer after all layers are set.
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).
Cap_BUTTAsInt
Cap_ROUNDAsInt
Cap_SQUAREAsInt
ClearLayerRasterizer
Clear the Rasterizer
clearShadowLayer
Clear the shadow layer.
DoPathEffectCompose
First use SetCornerPathEffect, SetDashPathEffect, SetDiscretePathEffect, SetPathDashPathEffect to fill Affect1 and Affect2
DoPathEffectSingle (EffectNum1Or2AsInt)
First use SetCornerPathEffect, SetDashPathEffect, SetDiscretePathEffect, SetPathDashPathEffect to fill Affect1 or Affect2
DoPathEffectSum
First use SetCornerPathEffect, SetDashPathEffect, SetDiscretePathEffect, SetPathDashPathEffect to fill Affect1 and Affect2
First use setBitmapShader, setLinearGradient, setRadialGradient, setSweepGradient to fill ShaderA and ShaderB
DoShaderComposeXfermodePixelXor (opColorAsInt)
First use setBitmapShader, setLinearGradient, setRadialGradient, setSweepGradient to fill ShaderA and ShaderB
DoShaderComposeXfermodePorterduffMode (modeAsInt)
First use setBitmapShader, setLinearGradient, setRadialGradient, setSweepGradient to fill ShaderA and ShaderB
DoShaderSingle (Shader1Or2AsInt)
First use setBitmapShader, setLinearGradient, setRadialGradient, setSweepGradient to fill ShaderA or ShaderB
flag_ANTI_ALIAS_FLAGAsInt
flag_DEV_KERN_TEXT_FLAGAsInt
flag_DITHER_FLAGAsInt
flag_FAKE_BOLD_TEXT_FLAGAsInt
flag_FILTER_BITMAP_FLAGAsInt
flag_HINTING_OFFAsInt
flag_HINTING_ONAsInt
flag_LINEAR_TEXT_FLAGAsInt
flag_STRIKE_THRU_TEXT_FLAGAsInt
flag_SUBPIXEL_TEXT_FLAGAsInt
flag_UNDERLINE_TEXT_FLAGAsInt
FontMetricsAscentAsFloat
The recommended distance above the baseline for singled spaced text.
FontMetricsBottomAsFloat
The maximum distance below the baseline for the lowest glyph in the font at a given text size.
FontMetricsDescentAsFloat
The recommended distance below the baseline for singled spaced text.
FontMetricsLeadingAsFloat
The recommended additional space to add between lines of text.
FontMetricsTopAsFloat
The maximum distance above the baseline for the tallest glyph in the font at a given text size.
GetAlphaAsInt
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).
GetAscentAsFloat
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.
GetColorAsInt
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).
GetDescentAsFloat
Return the distance below (positive) the baseline (descent) based on the current typeface and text size.
GetFillPath (srcAsABPath, dstAsABPath) AsBoolean
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).
GetFlagsAsInt
Return the paint's flags. Use the Flag enum to test flag values.
GetFontSpacingAsFloat
Return the recommend line spacing based on the current typeface and text size.
GetHintingAsInt
Return the paint's hinting mode. Returns either HINTING_OFF or HINTING_ON.
GetStrokeCapAsInt
Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated.
GetStrokeJoinAsInt
Return the paint's stroke join type.
GetStrokeMiterAsFloat
Return the paint's stroke miter value. Used to control the behavior of miter joins when the joins angle is sharp.
GetStrokeWidthAsFloat
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.
GetStyleAsInt
Return the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes FILL_STYLE).
GetTextAlignAsInt
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 advance widths for the characters in the string.
GetTypefaceAsandroid.graphics.Typeface
Get the paint's typeface object. The typeface object identifies which font to use when drawing or measuring text.
Initialize
Create a new paint with default settings.
Initialize2 (flagsAsInt)
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().
Initialize3 (paintAsABPaint)
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.
isAntiAliasAsBoolean
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.
isDitherAsBoolean
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.
isFakeBoldTextAsBoolean
Helper for getFlags(), returning true if FAKE_BOLD_TEXT_FLAG bit is set
isFilterBitmapAsBoolean
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.
isLinearTextAsBoolean
Helper for getFlags(), returning true if LINEAR_TEXT_FLAG bit is set
isStrikeThruTextAsBoolean
Helper for getFlags(), returning true if STRIKE_THRU_TEXT_FLAG bit is set
isSubpixelTextAsBoolean
Helper for getFlags(), returning true if SUBPIXEL_TEXT_FLAG bit is set
isUnderlineTextAsBoolean
Helper for getFlags(), returning true if UNDERLINE_TEXT_FLAG bit is set
Join_BEVELAsInt
Join_MITERAsInt
Join_ROUNDAsInt
measureText (textAsString) AsFloat
Return the width of the text.
PathDashPathEffectStyle_MORPHAsInt
PathDashPathEffectStyle_ROTATEAsInt
PathDashPathEffectStyle_TRANSLATEAsInt
PorterDuffMode_ADDAsInt
PorterDuffMode_CLEARAsInt
PorterDuffMode_DARKENAsInt
PorterDuffMode_DSTAsInt
PorterDuffMode_DST_ATOPAsInt
PorterDuffMode_DST_INAsInt
PorterDuffMode_DST_OUTAsInt
PorterDuffMode_DST_OVERAsInt
PorterDuffMode_LIGHTENAsInt
PorterDuffMode_MULTIPLYAsInt
PorterDuffMode_OVERLAYAsInt
PorterDuffMode_SCREENAsInt
PorterDuffMode_SRCAsInt
PorterDuffMode_SRC_ATOPAsInt
PorterDuffMode_SRC_INAsInt
PorterDuffMode_SRC_OUTAsInt
PorterDuffMode_SRC_OVERAsInt
PorterDuffMode_XORAsInt
reset
Restores the paint to its default settings.
Set (srcAsABPaint)
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.
SetAlpha (aAsInt)
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]
SetAntiAlias (aaAsBoolean)
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.
SetARGB (aAsInt, rAsInt, gAsInt, bAsInt)
Helper to setColor(), that takes a,r,g,b and constructs the color int
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
SetBlurMaskFilter (radiusAsFloat, styleAsInt)
Sets a MaskFilter
SetColor (colorAsInt)
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.
SetColorMatrixColorFilter (array() AsFloat)
Set or clear the paint's MatrixColorfilter, returning the parameter.
SetColorMatrixColorFilter2 (matAsABColorMatrix)
Set or clear the paint's MatrixColorfilter, returning the parameter.
After setting this effect you can use DoPathEffectSingle if one effect is set or DoPathEffectSum, DoPathEffectCompose if both effects are set
SetDither (ditherAsBoolean)
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.
Helper for setFlags(), setting or clearing the FAKE_BOLD_TEXT_FLAG bit
SetFilterBitmap (filterAsBoolean)
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.
SetFlags (flagsAsInt)
Set the paint's flags. Use the Flag enum to specific flag values.
SetHinting (modeAsInt)
Set the paint's hinting mode. May be either HINTING_OFF or HINTING_ON.
SetLayerRasterizer
Set or clear the rasterizer object. *
SetLightingColorFilter (mulAsInt, addAsInt)
Set or clear the paint's LightingColorfilter, returning the parameter.
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
SetLinearText (linearTextAsBoolean)
Helper for setFlags(), setting or clearing the LINEAR_TEXT_FLAG bit
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
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.
SetStrikeThruText (strikeThruTextAsBoolean)
Helper for setFlags(), setting or clearing the STRIKE_THRU_TEXT_FLAG bit
SetStrokeCap (capAsInt)
Set the paint's Cap.
SetStrokeJoin (joinAsInt)
Set the paint's Join.
SetStrokeMiter (miterAsFloat)
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.
SetStrokeWidth (widthAsFloat)
Set the width for stroking. Pass 0 to stroke in hairline mode. Hairlines always draws a single pixel independent of the canva's matrix.
SetStyle (styleAsInt)
Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill).
SetSubpixelText (subpixelTextAsBoolean)
Helper for setFlags(), setting or clearing the SUBPIXEL_TEXT_FLAG bit
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
After setting this shader you can use DoShaderSingle if one shader is set or DoShaderComposeXfermodeAvoid, DoShaderComposeXfermodePixelXor, DoShaderComposeXfermodePorterduffMode if both shaders are set
SetTextAlign (alignAsInt)
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.
SetTextScaleX (scaleXAsFloat)
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.
SetTextSize (textSizeAsFloat)
Set the paint's text size. This value must be > 0
SetTextSkewX (skewXAsFloat)
Set the paint's horizontal skew factor for text. The default value is 0. For approximating oblique text, use values around -0.25.
Compare two RgbVals in absolute value. Return type: @return:sum of absolute differences between pixel values
getB (ARGBAsInt) AsByte
Extracts blue byte from input ARGB word. The bit fields in ARGB word are unsigned, ranging from 0x00 to 0xff. To convert these to the returned signed byte value we must add Byte.MIN_VALUE. ARGB: the input color ARGB word. Return type: @return:the blue byte value, converted to a signed byte
getG (ARGBAsInt) AsByte
Extracts green byte from input ARGB word. The bit fields in ARGB word are unsigned, ranging from 0x00 to 0xff. To convert these to the returned signed byte value we must add Byte.MIN_VALUE. ARGB: the input color ARGB word. Return type: @return:the green byte value, converted to a signed byte
getMaxDiff (ARGB1AsInt, ARGB2AsInt) AsInt
Computes maximum difference (largest difference in color, R, G, or B) of two color values. ARGB1: first color ARGB2: second color Return type: @return:largest difference. Will always be >= 0, <= 256.
Extracts red byte from input ARGB word. The bit fields in ARGB word are unsigned, ranging from 0x00 to 0xff. To convert these to the returned signed byte value we must add Byte.MIN_VALUE. ARGB: the input color ARGB word. Return type: @return:the red byte value, converted to a signed byte
getSqrDiff (rgb1AsInt, rgb2AsInt) AsInt
Compare two RgbVals in sum of squares difference. Return type: @return:sum of squares differences between pixel values
Return "vector" difference of Rgb values. Treating each Rgb value as a 3-element vector form the value (ARGB-ARGBTarg) . ARGBVec where . is dot product. Useful for determining whether an Rgb value is near another weighted the different channels differently. ARGB: tested Rgb value ARGBTarg: target Rgb value ARGBVec: weighting Return type: @return:(ARGB-ARGBTarg) . ARGBVec where . is dot product and the Rgb values are treated as 3-vectors.
toRgb (RAsByte, GAsByte, BAsByte) AsInt
Converts byte R, G, and B values to an ARGB word. byte is a signed data type but the ARGB word has unsigned bit fields. In other words the minimum byte value is Byte.MIN_VALUE but the color black in the ARGB word is represented as 0x00. So we must subtract Byte.MIN_VALUE to get an unsigned byte value before shifting and combining the bit fields. R: input signed red byte G: input signed green byte B: input signed blue byte Return type: @return:the color ARGB word.
toSignedByte (bAsByte) AsByte
Converts from an unsigned bit field (as stored in an ARGB word to a signed byte value (that we can do computation on). b: the unsigned byte value. Return type: @return:the signed byte value
toString (ARGBAsInt) AsString
Provide a way to turn color values into strings ARGB: the input color value Return type: @return:a string describing the color
toUnsignedInt (bAsByte) AsInt
Converts from a signed byte value (which we do computation on) to an unsigned bit field (as stored in an ARGB word). The result is returned as an int because the unsigned 8 bit value cannot be represented as a byte. b: the signed byte value. Return type: @return:the unsigned bit field
Top