PaintCompat

Added in 1.1.0

class PaintCompat


Helper for accessing features in Paint.

Summary

Public functions

java-static Boolean
hasGlyph(paint: Paint, string: String)

Determine whether the typeface set on the paint has a glyph supporting the string in a backwards compatible way.

java-static Boolean
setBlendMode(paint: Paint, blendMode: BlendModeCompat?)

Configure the corresponding BlendMode on the given paint.

Public functions

hasGlyph

Added in 1.1.0
java-static fun hasGlyph(paint: Paint, string: String): Boolean

Determine whether the typeface set on the paint has a glyph supporting the string in a backwards compatible way.

Parameters
paint: Paint

the paint instance to check

string: String

the string to test whether there is glyph support

Returns
Boolean

true if the typeface set on the given paint has a glyph for the string

setBlendMode

Added in 1.2.0
java-static fun setBlendMode(paint: Paint, blendMode: BlendModeCompat?): Boolean

Configure the corresponding BlendMode on the given paint. If the Android platform supports the blend mode natively, it will fall back on the framework implementation of either BlendMode or PorterDuff mode. If it is not supported then this method is a no-op

Parameters
paint: Paint

target Paint to which the BlendMode will be applied

blendMode: BlendModeCompat?

BlendMode to configure on the paint if it is supported by the platform version. A value of null removes the BlendMode from the Paint and restores it to the default

Returns
Boolean

true if the specified BlendMode as applied successfully, false if the platform version does not support this BlendMode. If the BlendMode is not supported, this falls back to the default BlendMode