# BrushTip

Artifact: [androidx.ink:ink-brush](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/BrushTip.kt+class:androidx.ink.brush.BrushTip) Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class BrushTip
  ```

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` consists of parameters that control how stroke inputs are used to model the tip shape and color, and create vertices for the stroke mesh.

The specification can be considered in two parts:

1. Parameters for the base shape of the tip as a function of `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` size.

2. An array of `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior`s that allow dynamic properties of each input to augment the tip shape and color.

The base tip shape is controlled by various parameters: `scaleX` and `scaleY` control the size and aspect ratio; `cornerRounding` controls the roundness (going from square to rounded-rect to circle); `slantDegrees` controls the slantedness (going from rectangle to parallelogram); `pinch` controls the triangularity (going from rectangle to trapezoid to triangle). By combining these parameters, the tip shape can be circular, or pill-shaped, or a rounded triangle, or a rounded convex quadrilateral.

Through `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior`s, the tip can also produce a per-vertex HCLA (hue, chroma, lightness, alpha) color shift that can be used to augment the `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` color when drawing.

The default parameters produce a static circular tip shape, with diameter equal to the `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` size and no color shift.

```kotlin
import androidx.ink.brush.BrushTip

val behavior = createPressureToSizeBehavior()
return BrushTip(
    scaleX = 1.25f,
    scaleY = 0.75f,
    cornerRounding = 0.25f,
    slantDegrees = 45.0f,
    behaviors = listOf(behavior),
)
```

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip`. |

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#builder()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder`. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#BrushTip(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Long,kotlin.collections.List)( scaleX: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, scaleY: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, cornerRounding: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, slantDegrees: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = -90.0, to = 90.0) @https://developer.android.com/reference/kotlin/androidx/ink/geometry/AngleDegreesFloat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, pinch: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, rotationDegrees: @https://developer.android.com/reference/kotlin/androidx/ink/geometry/AngleDegreesFloat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, particleGapDistanceScale: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, particleGapDurationMillis: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, behaviors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior> )` Constructs a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` with the given attributes. | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#copy(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Long,kotlin.collections.List)( scaleX: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, scaleY: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, cornerRounding: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, slantDegrees: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = -90.0, to = 90.0) @https://developer.android.com/reference/kotlin/androidx/ink/geometry/AngleDegreesFloat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, pinch: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, rotationDegrees: @https://developer.android.com/reference/kotlin/androidx/ink/geometry/AngleDegreesFloat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, particleGapDistanceScale: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, particleGapDurationMillis: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, behaviors: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior> )` Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. | Cmn |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#toBuilder()()` Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` with values set equivalent to `this`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior>` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#behaviors()` An immutable list of `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior`s that allow dynamic properties of each input to augment the tip shape and color. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#cornerRounding()` A normalized value in the range 0, 1 that is used to calculate the initial radius of curvature for the tip's corners. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#particleGapDistanceScale()` Parameter controlling emission of particles as a function of distance traveled by the stroke inputs. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#particleGapDurationMillis()` Parameter controlling emission of particles as a function of time elapsed along the stroke. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#pinch()` A unitless parameter in the range 0, 1 that controls the separation between two of the shape's corners prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()` Angle in degrees specifying the initial rotation of the tip shape after applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleX()`, `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleY()`, `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#pinch()`, and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleX()` 2D scale used to calculate the initial width and height of the tip shape relative to the brush size prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleY()` 2D scale used to calculate the initial width and height of the tip shape relative to the brush size prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()` Angle in degrees used to calculate the initial slant of the tip shape prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`. | Cmn |

## Public companion functions

### builder

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun builder(): BrushTip.Builder
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder`.

## Public constructors

### BrushTip

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
BrushTip(
    scaleX: @FloatRange(from = 0.0, toInclusive = false) Float = 1.0f,
    scaleY: @FloatRange(from = 0.0, toInclusive = false) Float = 1.0f,
    cornerRounding: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f,
    slantDegrees: @FloatRange(from = -90.0, to = 90.0) @AngleDegreesFloat Float = 0.0f,
    pinch: @FloatRange(from = 0.0, to = 1.0) Float = 0.0f,
    rotationDegrees: @AngleDegreesFloat Float = 0.0f,
    particleGapDistanceScale: @FloatRange(from = 0.0, toInclusive = false) Float = 0.0f,
    particleGapDurationMillis: @IntRange(from = 0) Long = 0,
    behaviors: List<BrushBehavior> = emptyList()
)
```

Constructs a new `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` with the given attributes.

## Public functions

### calculateMinimumRequiredVersion

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun calculateMinimumRequiredVersion(): Version
```

Returns the minimum required `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version` for this `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip`.

By default, decoding a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily` containing a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip` with a minimum required version higher than `https://developer.android.com/reference/kotlin/androidx/ink/brush/Version#MAX_SUPPORTED()` will fail.

### copy

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun copy(
    scaleX: @FloatRange(from = 0.0, toInclusive = false) Float = this.scaleX,
    scaleY: @FloatRange(from = 0.0, toInclusive = false) Float = this.scaleY,
    cornerRounding: @FloatRange(from = 0.0, to = 1.0) Float = this.cornerRounding,
    slantDegrees: @FloatRange(from = -90.0, to = 90.0) @AngleDegreesFloat Float = this.slantDegrees,
    pinch: @FloatRange(from = 0.0, to = 1.0) Float = this.pinch,
    rotationDegrees: @AngleDegreesFloat Float = this.rotationDegrees,
    particleGapDistanceScale: @FloatRange(from = 0.0, toInclusive = false) Float = this.particleGapDistanceScale,
    particleGapDurationMillis: @IntRange(from = 0) Long = this.particleGapDurationMillis,
    behaviors: List<BrushBehavior> = this.behaviors
): BrushTip
```

Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged.

Java callers should use `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` instead.

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toBuilder

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
fun toBuilder(): BrushTip.Builder
```

Returns a `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip.Builder` with values set equivalent to `this`. Java developers, use the returned builder to build a copy of a BrushTip. Kotlin developers, see `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#copy(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Long,kotlin.collections.List)` method.

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### behaviors

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val behaviors: List<BrushBehavior>
```

An immutable list of `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior`s that allow dynamic properties of each input to augment the tip shape and color.

### cornerRounding

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val cornerRounding: Float
```

A normalized value in the range 0, 1 that is used to calculate the initial radius of curvature for the tip's corners. A value of 0 results in sharp corners and a value of 1 results in the maximum radius of curvature given the current tip dimensions.

### particleGapDistanceScale

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val particleGapDistanceScale: Float
```

Parameter controlling emission of particles as a function of distance traveled by the stroke inputs.

When this and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#particleGapDurationMillis()` are both zero, the stroke will be continuous, unless gaps are introduced dynamically by `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushBehavior`s. Otherwise, the stroke will be made up of particles. A new particle will be emitted after at least `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#particleGapDistanceScale()` \* `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#size()` distance has been traveled by the stoke inputs.

### particleGapDurationMillis

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val particleGapDurationMillis: Long
```

Parameter controlling emission of particles as a function of time elapsed along the stroke.

When this and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#particleGapDistanceScale()` are both zero, the stroke will be continuous, unless gaps are introduced dynamically by `BrushBehavior`s. Otherwise, the stroke will be made up of particles. Particles will be emitted at most once every `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#particleGapDurationMillis()`.

### pinch

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val pinch: Float
```

A unitless parameter in the range 0, 1 that controls the separation between two of the shape's corners prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`.

The two corners affected lie toward the negative y-axis relative to the center of the tip shape. I.e. the "upper edge" of the shape if positive y is chosen to point "down" in stroke coordinates.

If `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleX()` is not 0, different values of `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#pinch()` produce the following shapes: A value of 0 will leave the corners unaffected as a rectangle or parallelogram. Values between 0 and 1 will bring the corners closer together to result in a (possibly slanted) trapezoidal shape. A value of 1 will make the two corners coincide and result in a triangular shape.

### rotationDegrees

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val rotationDegrees: Float
```

Angle in degrees specifying the initial rotation of the tip shape after applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleX()`, `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleY()`, `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#pinch()`, and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()`. The rotation is in the direction from the positive x-axis towards the positive y-axis.

### scaleX

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val scaleX: Float
```

2D scale used to calculate the initial width and height of the tip shape relative to the brush size prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`.

The base width and height of the tip will be equal to the brush size multiplied by `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleX()` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleY()` respectively. Valid values must be finite and non-negative, with at least one value greater than zero.

### scaleY

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val scaleY: Float
```

2D scale used to calculate the initial width and height of the tip shape relative to the brush size prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`.

The base width and height of the tip will be equal to the brush size multiplied by `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleX()` and `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#scaleY()` respectively. Valid values must be finite and non-negative, with at least one value greater than zero.

### slantDegrees

Cmn Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
val slantDegrees: Float
```

Angle in degrees used to calculate the initial slant of the tip shape prior to applying `https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushTip#rotationDegrees()`.

The value should be in the range -90, 90 degrees, and represents the angle by which "vertical" lines of the tip shape will appear rotated about their intersection with the x-axis. A positive value will rotate from the positive x-axis towards the positive y-axis.

More info: This property is similar to the single-arg CSS skew() transformation. Unlike skew, slant tries to preserve the perimeter of the tip shape as opposed to its area. This is akin to "pressing" a rectangle into a parallelogram with non-right angles while preserving the side lengths.