# InProgressStroke

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

*** ** * ** ***

Common/All
- Cmn

  ```
  class InProgressStroke
  ```

*** ** * ** ***

Use an `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke` to efficiently build a stroke over multiple rendering frames with incremental inputs.

To use an `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke`, you would typically:

1. Begin a stroke by calling `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` with a chosen `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush`.

2. Repeatedly update the stroke:

   1. Call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` with any new real and predicted stroke inputs as they arrive.

   2. Call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` each draw.

   3. Render the current stroke mesh or outlines, either via a provided renderer that accepts an `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke` or by using the various getters on this type with a custom renderer.

3. Call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()` once there are no more inputs for this stroke (e.g. the user lifts the stylus from the screen).

4. Continue to call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` and render after `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()` until `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#changesWithTime()` returns false (to allow any lingering brush shape animations to complete).

5. Extract the completed stroke by calling `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#toImmutable()`.

6. For best performance, reuse this object and go back to step 1 rather than allocating a new instance.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#InProgressStroke()()` | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#changesWithTime()()` Returns true if the stroke's geometry changes with the passage of time (denoted by new values being passed to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`), even if no new input points are provided via `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#clear()()` Clears the in progress stroke without starting a new one. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)( realInputs: https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch, predictedInputs: https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch )` Enqueues the incremental `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` and sets the prediction to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`, overwriting any previous prediction. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()()` Indicates that the inputs for the current stroke are finished. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getBasePaintAnimationPhase()()` Returns the \[0, 1) value that will determine the stroke's overall animation progress at some arbitrary zero clock state, so that different strokes can be animated correctly relative to each other. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getBrushCoatCount()()` Returns the number of `BrushCoats` for the current brush, or zero if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` has not been called. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getInputCount()()` Returns the number of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput`s in the stroke so far. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getOutlineCount(kotlin.Int)(coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the number of outlines for the specified brush coat. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getOutlineVertexCount(kotlin.Int,kotlin.Int)( coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outlineIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Returns the number of outline points for the specified outline and brush coat. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getPredictedInputCount()()` Returns the number of inputs in the current stroke prediction. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getRealInputCount()()` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#isInputFinished()()` Returns `true` if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()` has been called since the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`, or if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` hasn't been called yet. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#isUpdateNeeded()()` Returns `true` if calling `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` would have any effect on the stroke (and should thus be called before the next render), or `false` if no calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` are currently needed. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInput(androidx.ink.strokes.StrokeInput,kotlin.Int)(out: https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput, index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Gets the value of the i-th input and overwrites `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInput(androidx.ink.strokes.StrokeInput,kotlin.Int)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/MutableStrokeInputBatch` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInputs(androidx.ink.strokes.MutableStrokeInputBatch,kotlin.Int,kotlin.Int)( out: https://developer.android.com/reference/kotlin/androidx/ink/strokes/MutableStrokeInputBatch, from: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, to: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Replace the contents of the `https://developer.android.com/reference/kotlin/androidx/ink/strokes/MutableStrokeInputBatch` with the specified range of inputs from the this `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateMeshBounds(kotlin.Int,androidx.ink.geometry.BoxAccumulator)( coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outMeshBounds: https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator )` Writes to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateMeshBounds(kotlin.Int,androidx.ink.geometry.BoxAccumulator)` the bounding box of the vertex positions of the mesh for brush coat `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateMeshBounds(kotlin.Int,androidx.ink.geometry.BoxAccumulator)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)( coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outlineIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outlineVertexIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outPosition: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec )` Fills `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` with the x and y coordinates of the specified outline vertex. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateUpdatedRegion(androidx.ink.geometry.BoxAccumulator)(outUpdatedRegion: https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator)` Returns the bounding rectangle of mesh positions added, modified, or removed by calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` since the most recent call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` or `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#resetUpdatedRegion()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#resetUpdatedRegion()()` Call after making use of a value from `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateUpdatedRegion(androidx.ink.geometry.BoxAccumulator)` to reset the accumulation. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)(brush: https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush, noiseSeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Clears and starts a new stroke with the given `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`, using the given per-stroke seed value to help seed the brush's noise behaviors, if any. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int,kotlin.Float)( brush: https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush, noiseSeed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, basePaintAnimationPhase: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0, toInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Clears and starts a new stroke with the given `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int,kotlin.Float)`, using the given per-stroke seed value to help seed the brush's noise behaviors, if any, and using the given base paint animation phase (in `[0, 1)`, wrapped modulo 1 if outside that range) for any animated brush paints. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#toImmutable()()` Copies the current input, brush, and geometry as of the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` or `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` to a new `https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)(currentElapsedTimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Updates the stroke geometry up to the given duration since the start of the stroke. | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush?` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#brush()` The `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` currently being used to generate the stroke content. | Cmn |

## Public constructors

### InProgressStroke

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

```
InProgressStroke()
```

## Public functions

### changesWithTime

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

```
fun changesWithTime(): Boolean
```

Returns true if the stroke's geometry changes with the passage of time (denoted by new values being passed to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`), even if no new input points are provided via `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`. This is the case if the brush has one or more timed animation behavior that are still active (which can be true even after inputs are finished).

This is similar to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#isUpdateNeeded()`, except that it ignores whether inputs are finished or pending.

### clear

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

```
fun clear(): Unit
```

Clears the in progress stroke without starting a new one.

This includes clearing or resetting any existing inputs, mesh data, and updated region.

### enqueueInputs

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

```
fun enqueueInputs(
    realInputs: StrokeInputBatch,
    predictedInputs: StrokeInputBatch
): Unit
```

Enqueues the incremental `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` and sets the prediction to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`, overwriting any previous prediction. Queued inputs will be processed on the next call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`.

This method requires that:

- `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` has been previously called to set the current `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush`.

- `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()` has not been called since the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`.

- `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` and `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` must form a valid stroke input sequence together with previously added real input. In particular, this means that the first input in `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` must be valid following the last input in previously added real inputs, and the first input in `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` must be valid following the last input in `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`: They must have the same `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput#toolType()`, their `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput#elapsedTimeMillis()` values must be monotonically non-decreasing, and they can not duplicate the previous input.

Either one or both of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` and `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` may be empty.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` has not been called since construction or the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If the input is not valid. Note that this can be a common occurrence with real user input on certain devices, in particular due to duplicate or out-of-order inputs. Therefore, users should either catch and handle this exception or sanitize the input to avoid ensure validity before passing it to this function. |

### finishInput

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

```
fun finishInput(): Unit
```

Indicates that the inputs for the current stroke are finished. After calling this, it is an error to call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` until `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` is called again to start a new stroke. This method is idempotent; it has no effect if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` was never called, or if this method has already been called since the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`. This method is synchronous, but the stroke may not be fully finished changing shape due to brush shape animations until `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#changesWithTime()` returns false. Until that condition is met, keep calling `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` periodically and rendering the result.

### getBasePaintAnimationPhase

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

```
fun getBasePaintAnimationPhase(): @FloatRange(from = 0.0, to = 1.0, toInclusive = false) Float
```

Returns the \[0, 1) value that will determine the stroke's overall animation progress at some arbitrary zero clock state, so that different strokes can be animated correctly relative to each other.

### getBrushCoatCount

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

```
fun getBrushCoatCount(): @IntRange(from = 0) Int
```

Returns the number of `BrushCoats` for the current brush, or zero if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` has not been called.

### getInputCount

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

```
fun getInputCount(): @IntRange(from = 0) Int
```

Returns the number of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput`s in the stroke so far. This counts all of the real inputs and the most-recently-processed sequence of predicted inputs.

### getOutlineCount

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

```
fun getOutlineCount(coatIndex: @IntRange(from = 0) Int): @IntRange(from = 0) Int
```

Returns the number of outlines for the specified brush coat.

Calls to functions that accept an outlineIndex must treat the result of this function as an upper bound. Coats with discontinuous geometry will always have multiple outlines, but even continuous geometry may be drawn with multiple overlapping outlines when this improves rendering quality or performance.

| Parameters |
|---|---|
| `coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Must be between 0 (inclusive) and the result of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getBrushCoatCount()` (exclusive). |

### getOutlineVertexCount

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

```
fun getOutlineVertexCount(
    coatIndex: @IntRange(from = 0) Int,
    outlineIndex: @IntRange(from = 0) Int
): @IntRange(from = 0) Int
```

Returns the number of outline points for the specified outline and brush coat. `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must treat the result of this as the upper bound of its outlineVertexIndex parameter.

| Parameters |
|---|---|
| `coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Must be between 0 (inclusive) and the result of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getBrushCoatCount()` (exclusive). |
| `outlineIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Must be between 0 (inclusive) and the result of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getOutlineCount(kotlin.Int)` for the same `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getOutlineVertexCount(kotlin.Int,kotlin.Int)` (exclusive). |

### getPredictedInputCount

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

```
fun getPredictedInputCount(): @IntRange(from = 0) Int
```

Returns the number of inputs in the current stroke prediction.

### getRealInputCount

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

```
fun getRealInputCount(): @IntRange(from = 0) Int
```

### isInputFinished

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

```
fun isInputFinished(): Boolean
```

Returns `true` if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#finishInput()` has been called since the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`, or if `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` hasn't been called yet. If this returns `true`, it is an error to call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`.

### isUpdateNeeded

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

```
fun isUpdateNeeded(): Boolean
```

Returns `true` if calling `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` would have any effect on the stroke (and should thus be called before the next render), or `false` if no calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` are currently needed. Specifically:

- If the brush has one or more timed shape animation behavior that are still active (which can be true even after inputs are finished), returns `true` (that is, when `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#changesWithTime()` returns `true`).

- If there are no active shape animation behaviors, but there are pending inputs from an `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` call that have not yet been consumed by a call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`, returns `true`.

- Otherwise, returns `false`.

`https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` efficiently does nothing if no update is needed, so there is no need to check this before calling update. Only check this if you need to condition some other piece of work on whether the stroke will change on update.

Once `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#isInputFinished()` returns `true` and this method returns `false`, the stroke is considered "dry", and will not change any further until the next call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`.

### populateInput

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

```
fun populateInput(out: StrokeInput, index: @IntRange(from = 0) Int): StrokeInput
```

Gets the value of the i-th input and overwrites `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInput(androidx.ink.strokes.StrokeInput,kotlin.Int)`. Requires that `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInput(androidx.ink.strokes.StrokeInput,kotlin.Int)` is non-negative and less than `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getInputCount()`.

Returns the passed-in `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput` to make it easier to chain calls.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInput(androidx.ink.strokes.StrokeInput,kotlin.Int)` |

### populateInputs

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

```
fun populateInputs(
    out: MutableStrokeInputBatch,
    from: @IntRange(from = 0) Int = 0,
    to: @IntRange(from = 0) Int = getInputCount()
): MutableStrokeInputBatch
```

Replace the contents of the `https://developer.android.com/reference/kotlin/androidx/ink/strokes/MutableStrokeInputBatch` with the specified range of inputs from the this `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke`. By default, all inputs are copied.

Returns the passed-in `https://developer.android.com/reference/kotlin/androidx/ink/strokes/MutableStrokeInputBatch` to make it easier to chain calls.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/MutableStrokeInputBatch` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateInputs(androidx.ink.strokes.MutableStrokeInputBatch,kotlin.Int,kotlin.Int)` |

### populateMeshBounds

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

```
fun populateMeshBounds(
    coatIndex: @IntRange(from = 0) Int,
    outMeshBounds: BoxAccumulator
): BoxAccumulator
```

Writes to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateMeshBounds(kotlin.Int,androidx.ink.geometry.BoxAccumulator)` the bounding box of the vertex positions of the mesh for brush coat `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateMeshBounds(kotlin.Int,androidx.ink.geometry.BoxAccumulator)`.

Returns the passed in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` to make it easier to chain calls.

| Parameters |
|---|---|
| `coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the coat to obtain the bounding box from. |
| `outMeshBounds: https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` | The pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` to be filled with the result. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateMeshBounds(kotlin.Int,androidx.ink.geometry.BoxAccumulator)` |

### populateOutlinePosition

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

```
fun populateOutlinePosition(
    coatIndex: @IntRange(from = 0) Int,
    outlineIndex: @IntRange(from = 0) Int,
    outlineVertexIndex: @IntRange(from = 0) Int,
    outPosition: MutableVec
): MutableVec
```

Fills `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` with the x and y coordinates of the specified outline vertex.

Returns the passed-in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` to make it easier to chain calls.

| Parameters |
|---|---|
| `coatIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Must be between 0 (inclusive) and the result of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getBrushCoatCount()` (exclusive). |
| `outlineIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Must be between 0 (inclusive) and the result of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getOutlineCount(kotlin.Int)` (exclusive) for the same `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`. |
| `outlineVertexIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Must be between 0 (inclusive) and the result of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#getOutlineVertexCount(kotlin.Int,kotlin.Int)` (exclusive) for the same `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` and `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`. |
| `outPosition: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | the pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` to be filled with the result. |

### populateUpdatedRegion

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

```
fun populateUpdatedRegion(outUpdatedRegion: BoxAccumulator): BoxAccumulator
```

Returns the bounding rectangle of mesh positions added, modified, or removed by calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` since the most recent call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` or `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#resetUpdatedRegion()`.

Expected to be called on each stroke before each draw. Does nothing quickly if no update is needed.

Returns the passed in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` to make it easier to chain calls.

| Parameters |
|---|---|
| `outUpdatedRegion: https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` | The pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` to be filled with the result. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/BoxAccumulator` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateUpdatedRegion(androidx.ink.geometry.BoxAccumulator)` |

### resetUpdatedRegion

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

```
fun resetUpdatedRegion(): Unit
```

Call after making use of a value from `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#populateUpdatedRegion(androidx.ink.geometry.BoxAccumulator)` to reset the accumulation.

### start

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

```
fun start(brush: Brush, noiseSeed: Int = 0): Unit
```

Clears and starts a new stroke with the given `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`, using the given per-stroke seed value to help seed the brush's noise behaviors, if any.

This includes clearing or resetting any existing inputs, mesh data, and updated region. This method must be called at least once after construction before making any calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` or `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`.

### start

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

```
fun start(
    brush: Brush,
    noiseSeed: Int,
    basePaintAnimationPhase: @FloatRange(from = 0.0, to = 1.0, toInclusive = false) Float
): Unit
```

Clears and starts a new stroke with the given `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int,kotlin.Float)`, using the given per-stroke seed value to help seed the brush's noise behaviors, if any, and using the given base paint animation phase (in `[0, 1)`, wrapped modulo 1 if outside that range) for any animated brush paints.

This includes clearing or resetting any existing inputs, mesh data, and updated region. This method must be called at least once after construction before making any calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)` or `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`.

### toImmutable

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

```
fun toImmutable(): Stroke
```

Copies the current input, brush, and geometry as of the last call to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` or `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` to a new `https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke`.

The resulting `https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke` will not be modified if further inputs are added to this `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke`, and a `https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke` created by another call to this method will not modify or be connected in any way to the prior `https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke`.

### updateShape

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

```
fun updateShape(currentElapsedTimeMillis: Long = Long.MAX_VALUE): Unit
```

Updates the stroke geometry up to the given duration since the start of the stroke. This will consume any inputs queued up by calls to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`, and cause brush shape animations (if any) to progress up to the specified time. Any stroke geometry resulting from previously-predicted input from before the previous call to this method will be cleared.

This method requires that:

- `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` has been previously called to set the current `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#brush()`.

- If passed, the value of `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` passed into this method over the course of a single stroke must be non-decreasing and non-negative. To have shape animations progress at their intended rate, pass in values for this field that are in the same time base as the `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInput#elapsedTimeMillis()` values being passed to `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#enqueueInputs(androidx.ink.strokes.StrokeInputBatch,androidx.ink.strokes.StrokeInputBatch)`, repeatedly until `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#isInputFinished()` returns `true`.

Clients that do not use brushes with shape animation behaviors can omit `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)`. Doing so when using brushes with shape animation beaviors will cause the animation to be completed immediately.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)` has not been called. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#updateShape(kotlin.Long)` is negative or decreased from a previous call to this method for the same in-progress stroke. |

## Public properties

### brush

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

```
val brush: Brush?
```

The `https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush` currently being used to generate the stroke content. To set this, call `https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke#start(androidx.ink.brush.Brush,kotlin.Int)`.