androidx.ink.brush
Classes
Brush |
Defines how stroke inputs are interpreted to create the visual representation of a stroke. |
android
|
Brush.Builder |
Builder for |
android
|
BrushFamily |
A |
android
|
InputToolType |
The type of input tool used in producing |
android
|
Objects
Brush.Companion |
android
|
|
StockBrushes |
Provides a fixed set of stock |
android
|
Annotations
ExperimentalInkCustomBrushApi |
Marks declarations that are are part of the experimental Ink brush customization API. |
android
|
Top-level functions summary
Brush.Builder |
@RequiresApi(value = 26) Returns a new, blank |
android
|
Brush |
@RequiresApi(value = 26) Returns a new |
android
|
Extension functions summary
Brush |
@RequiresApi(value = 26) Creates a copy of |
android
|
Color |
@RequiresApi(value = 26) The brush color as an |
android
|
Brush |
@RequiresApi(value = 26) Returns a new |
android
|
Brush.Builder |
@RequiresApi(value = 26) Set the color on a |
android
|
Brush.Builder |
@RequiresApi(value = 26) Returns a |
android
|
Top-level functions
createBrushBuilderWithAndroidColor
@RequiresApi(value = 26)
fun createBrushBuilderWithAndroidColor(color: Color): Brush.Builder
Returns a new, blank Brush.Builder
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.
In Kotlin, calling this is equivalent to calling Brush.builder
followed by Brush.Builder.setAndroidColor
. For Java callers, this function allows more fluent call chaining.
createBrushWithAndroidColor
@RequiresApi(value = 26)
fun createBrushWithAndroidColor(
family: BrushFamily,
color: Color,
size: Float,
epsilon: Float
): Brush
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.
Kotlin callers should prefer Brush.Companion.createWithAndroidColor
.
Extension functions
copyWithAndroidColor
@RequiresApi(value = 26)
fun Brush.copyWithAndroidColor(
color: Color,
family: BrushFamily = this.family,
size: Float = this.size,
epsilon: Float = this.epsilon
): Brush
Creates a copy of this
Brush
and allows named properties to be altered while keeping the rest unchanged. The color is specified as 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.
createAndroidColor
@RequiresApi(value = 26)
fun Brush.createAndroidColor(): Color
The brush color as an android.graphics.Color
instance, which can express colors in several different color spaces. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.
Unless an instance of android.graphics.Color
is actually needed, prefer to use Brush.colorLong
to get the color without causing an allocation, especially in performance-sensitive code. Brush.colorLong
is fully compatible with the Long
representation of android.graphics.Color
.
createWithAndroidColor
@RequiresApi(value = 26)
fun Brush.Companion.createWithAndroidColor(
family: BrushFamily,
color: Color,
size: Float,
epsilon: Float
): Brush
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
).
setAndroidColor
@RequiresApi(value = 26)
fun Brush.Builder.setAndroidColor(color: Color): Brush.Builder
Set the color on a Brush.Builder
as an android.graphics.Color
instance. sRGB and Display P3 are supported; a color in any other color space will be converted to Display P3.
Java callers should prefer toBuilderWithAndroidColor
or createBrushBuilderWithAndroidColor
as a more fluent API.
toBuilderWithAndroidColor
@RequiresApi(value = 26)
fun Brush.toBuilderWithAndroidColor(color: Color): Brush.Builder
Returns a Brush.Builder
with values set equivalent to the Brush
and 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 developers, use the returned builder to build a copy of a Brush. Kotlin developers, see copyWithAndroidColor
method.
In Kotlin, calling this is equivalent to calling Brush.toBuilder
followed by Brush.Builder.setAndroidColor
. For Java callers, this function allows more fluent call chaining.