Brush.Companion
public static class Brush.Companion
Summary
Public methods |
|
|---|---|
static final @NonNull Brush.Builder |
builder()Returns a new |
static final @NonNull Brush |
createWithColorIntArgb(Returns a new |
static final @NonNull Brush |
createWithColorLong(Returns a new |
Extension functions |
|
|---|---|
static final @NonNull Brush |
@RequiresApi(value = 26)Returns a new |
Public methods
builder
public static final @NonNull Brush.Builder builder()
Returns a new Brush.Builder.
createWithColorIntArgb
public static final @NonNull Brush createWithColorIntArgb(
@NonNull BrushFamily family,
@ColorInt int colorIntArgb,
float size,
float epsilon
)
Returns a new Brush with the color specified by a ColorInt, which is in the sRGB color space by definition. Note that the ColorInt channel order puts alpha first (in the most significant byte).
Kotlin interprets integer literals greater than 0x7fffffff as Longs, so callers that want to specify a literal ColorInt with alpha >= 0x80 must call Long.toInt on the literal.
createWithColorLong
public static final @NonNull Brush createWithColorLong(
@NonNull BrushFamily family,
@ColorLong long colorLong,
float size,
float epsilon
)
Returns a new Brush with the color specified by a ColorLong, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.
Some libraries (notably Jetpack UI Graphics) use ULong for ColorLongs, so the caller must call ULong.toLong on such a value before passing it to this method.
Extension functions
BrushUtil.createWithAndroidColor
@RequiresApi(value = 26)
public static final @NonNull Brush BrushUtil.createWithAndroidColor(
@NonNull Brush.Companion receiver,
@NonNull BrushFamily family,
@NonNull Color color,
float size,
float epsilon
)
Returns a new Brush with the color specified by an android.graphics.Color instance, which can encode several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.
Java callers should prefer BrushUtil.createWithAndroidColor (createBrushWithAndroidColor).