# 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)

*** ** * ** ***


```
public final class BrushTip
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/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/androidx/ink/brush/Brush` size.

2. An array of `https://developer.android.com/reference/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/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/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/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 |
|---|
| `public final class https://developer.android.com/reference/androidx/ink/brush/BrushTip.Builder` Builder for `https://developer.android.com/reference/androidx/ink/brush/BrushTip`. |

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

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushTip.Builder` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#builder()()` Returns a new `https://developer.android.com/reference/androidx/ink/brush/BrushTip.Builder`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/BrushTip`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushTip` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#copy(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Long,kotlin.collections.List)( @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) float scaleX, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) float scaleY, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float cornerRounding, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = -90.0, to = 90.0) @https://developer.android.com/reference/androidx/ink/geometry/AngleDegreesFloat float slantDegrees, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float pinch, @https://developer.android.com/reference/androidx/ink/geometry/AngleDegreesFloat float rotationDegrees, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) float particleGapDistanceScale, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long particleGapDurationMillis, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushBehavior> behaviors )` Creates a copy of `this` and allows named properties to be altered while keeping the rest unchanged. |
| `boolean` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushBehavior>` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getBehaviors()()` An immutable list of `https://developer.android.com/reference/androidx/ink/brush/BrushBehavior`s that allow dynamic properties of each input to augment the tip shape and color. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getCornerRounding()()` A normalized value in the range 0, 1 that is used to calculate the initial radius of curvature for the tip's corners. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getParticleGapDistanceScale()()` Parameter controlling emission of particles as a function of distance traveled by the stroke inputs. |
| `final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getParticleGapDurationMillis()()` Parameter controlling emission of particles as a function of time elapsed along the stroke. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getPinch()()` 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/androidx/ink/brush/BrushTip#rotationDegrees()`. |
| `final @https://developer.android.com/reference/androidx/ink/geometry/AngleDegreesFloat float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getRotationDegrees()()` Angle in degrees specifying the initial rotation of the tip shape after applying `https://developer.android.com/reference/androidx/ink/brush/BrushTip#scaleX()`, `https://developer.android.com/reference/androidx/ink/brush/BrushTip#scaleY()`, `https://developer.android.com/reference/androidx/ink/brush/BrushTip#pinch()`, and `https://developer.android.com/reference/androidx/ink/brush/BrushTip#slantDegrees()`. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getScaleX()()` 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/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/androidx/ink/brush/BrushTip#rotationDegrees()`. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, toInclusive = false) float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getScaleY()()` 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/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/androidx/ink/brush/BrushTip#rotationDegrees()`. |
| `final @https://developer.android.com/reference/androidx/annotation/FloatRange(from = -90.0, to = 90.0) @https://developer.android.com/reference/androidx/ink/geometry/AngleDegreesFloat float` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#getSlantDegrees()()` Angle in degrees used to calculate the initial slant of the tip shape prior to applying `https://developer.android.com/reference/androidx/ink/brush/BrushTip#rotationDegrees()`. |
| `int` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#hashCode()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushTip.Builder` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#toBuilder()()` Returns a `https://developer.android.com/reference/androidx/ink/brush/BrushTip.Builder` with values set equivalent to `this`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/ink/brush/BrushTip#toString()()` |

## Public constructors

### BrushTip

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

```
public BrushTip(
    @FloatRange(from = 0.0, toInclusive = false) float scaleX,
    @FloatRange(from = 0.0, toInclusive = false) float scaleY,
    @FloatRange(from = 0.0, to = 1.0) float cornerRounding,
    @FloatRange(from = -90.0, to = 90.0) @AngleDegreesFloat float slantDegrees,
    @FloatRange(from = 0.0, to = 1.0) float pinch,
    @AngleDegreesFloat float rotationDegrees,
    @FloatRange(from = 0.0, toInclusive = false) float particleGapDistanceScale,
    @IntRange(from = 0) long particleGapDurationMillis,
    @NonNull List<@NonNull BrushBehavior> behaviors
)
```

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

## Public methods

### builder

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

```
public static final @NonNull BrushTip.Builder builder()
```

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

### calculateMinimumRequiredVersion

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

```
public final @NonNull Version calculateMinimumRequiredVersion()
```

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

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

### copy

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

```
public final @NonNull BrushTip copy(
    @FloatRange(from = 0.0, toInclusive = false) float scaleX,
    @FloatRange(from = 0.0, toInclusive = false) float scaleY,
    @FloatRange(from = 0.0, to = 1.0) float cornerRounding,
    @FloatRange(from = -90.0, to = 90.0) @AngleDegreesFloat float slantDegrees,
    @FloatRange(from = 0.0, to = 1.0) float pinch,
    @AngleDegreesFloat float rotationDegrees,
    @FloatRange(from = 0.0, toInclusive = false) float particleGapDistanceScale,
    @IntRange(from = 0) long particleGapDurationMillis,
    @NonNull List<@NonNull BrushBehavior> behaviors
)
```

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/androidx/ink/brush/BrushTip.Builder` instead.

### equals

```
public boolean equals(Object other)
```

### getBehaviors

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

```
public final @NonNull List<@NonNull BrushBehavior> getBehaviors()
```

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

### getCornerRounding

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

```
public final @FloatRange(from = 0.0, to = 1.0) float getCornerRounding()
```

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.

### getParticleGapDistanceScale

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

```
public final @FloatRange(from = 0.0, toInclusive = false) float getParticleGapDistanceScale()
```

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

When this and `https://developer.android.com/reference/androidx/ink/brush/BrushTip#particleGapDurationMillis()` are both zero, the stroke will be continuous, unless gaps are introduced dynamically by `https://developer.android.com/reference/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/androidx/ink/brush/BrushTip#particleGapDistanceScale()` \* `https://developer.android.com/reference/androidx/ink/brush/Brush#size()` distance has been traveled by the stoke inputs.

### getParticleGapDurationMillis

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

```
public final @IntRange(from = 0) long getParticleGapDurationMillis()
```

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

When this and `https://developer.android.com/reference/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/androidx/ink/brush/BrushTip#particleGapDurationMillis()`.

### getPinch

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

```
public final @FloatRange(from = 0.0, to = 1.0) float getPinch()
```

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/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/androidx/ink/brush/BrushTip#scaleX()` is not 0, different values of `https://developer.android.com/reference/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.

### getRotationDegrees

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

```
public final @AngleDegreesFloat float getRotationDegrees()
```

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

### getScaleX

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

```
public final @FloatRange(from = 0.0, toInclusive = false) float getScaleX()
```

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/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/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/androidx/ink/brush/BrushTip#scaleX()` and `https://developer.android.com/reference/androidx/ink/brush/BrushTip#scaleY()` respectively. Valid values must be finite and non-negative, with at least one value greater than zero.

### getScaleY

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

```
public final @FloatRange(from = 0.0, toInclusive = false) float getScaleY()
```

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/androidx/ink/brush/BrushTip#slantDegrees()` and `https://developer.android.com/reference/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/androidx/ink/brush/BrushTip#scaleX()` and `https://developer.android.com/reference/androidx/ink/brush/BrushTip#scaleY()` respectively. Valid values must be finite and non-negative, with at least one value greater than zero.

### getSlantDegrees

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

```
public final @FloatRange(from = -90.0, to = 90.0) @AngleDegreesFloat float getSlantDegrees()
```

Angle in degrees used to calculate the initial slant of the tip shape prior to applying `https://developer.android.com/reference/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.

### hashCode

```
public int hashCode()
```

### toBuilder

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

```
public final @NonNull BrushTip.Builder toBuilder()
```

Returns a `https://developer.android.com/reference/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/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

```
public @NonNull String toString()
```