class Stroke


An immutable object comprised of a StrokeInputBatch that represents a user-drawn (or sometimes synthetic) path, a Brush that contains information on how that path should be converted into a geometric shape and rendered on screen, and a PartitionedMesh which is the geometric shape calculated from the combination of the StrokeInputBatch and the Brush.

This can be constructed directly from a StrokeInputBatch that has already been completed. To construct a stroke incrementally and render it as input events are received in real time, use InProgressStrokesView or InProgressStroke, which will ultimately return a Stroke when input is completed.

Summary

Public constructors

Stroke(brush: Brush, inputs: StrokeInputBatch)

Construct a Stroke given a Brush and a StrokeInputBatch, generating its shape.

Stroke(brush: Brush, inputs: StrokeInputBatch, shape: PartitionedMesh)

Construct a Stroke given a Brush, a StrokeInputBatch, and a PartitionedMesh.

Public functions

Stroke
copy(brush: Brush)

Returns a Stroke with the brush replaced.

open String

Protected functions

Unit

Public properties

Brush

Contains information on how the inputs should be used to calculate the shape and how that shape should be drawn on screen.

ImmutableStrokeInputBatch

The user-drawn (or perhaps synthetically generated) path that this Stroke takes.

PartitionedMesh

The geometric shape of the Stroke, which can be used to render it on screen and to perform geometric calculations.

Public constructors

Stroke

Added in 1.0.0-alpha01
Stroke(brush: Brush, inputs: StrokeInputBatch)

Construct a Stroke given a Brush and a StrokeInputBatch, generating its shape.

Stroke

Added in 1.0.0-alpha01
Stroke(brush: Brush, inputs: StrokeInputBatch, shape: PartitionedMesh)

Construct a Stroke given a Brush, a StrokeInputBatch, and a PartitionedMesh.

Note that this does not do any validation that brush and inputs together would produce shape. This constructor is primarily intended for deserialization, in cases where the PartitionedMesh is being stored in addition to the Brush and StrokeInputBatch.

Public functions

copy

Added in 1.0.0-alpha01
fun copy(brush: Brush): Stroke

Returns a Stroke with the brush replaced. This may or may not affect the shape, but will not change the inputs.

toString

open fun toString(): String

Protected functions

finalize

Added in 1.0.0-alpha01
protected fun finalize(): Unit

Public properties

brush

Added in 1.0.0-alpha01
val brushBrush

Contains information on how the inputs should be used to calculate the shape and how that shape should be drawn on screen.

inputs

Added in 1.0.0-alpha01
val inputsImmutableStrokeInputBatch

The user-drawn (or perhaps synthetically generated) path that this Stroke takes.

shape

Added in 1.0.0-alpha01
val shapePartitionedMesh

The geometric shape of the Stroke, which can be used to render it on screen and to perform geometric calculations. This PartitionedMesh will have one render group per brush coat in brush.