androidx.ink.strokes
Classes
ImmutableStrokeInputBatch |
An immutable implementation of |
Cmn
|
InProgressStroke |
Use an |
Cmn
|
MutableStrokeInputBatch |
A mutable implementation of |
Cmn
|
Stroke |
An immutable object comprised of a |
Cmn
|
StrokeInput |
A single input specifying position, time since the start of the stream, and optionally |
Cmn
|
StrokeInputBatch |
A read-only view of an object that stores multiple |
Cmn
|
Objects
Extension functions summary
PartitionedMesh |
Creates a |
Cmn
|
Extension functions
StrokeInputBatch.createClosedShape
fun StrokeInputBatch.createClosedShape(): PartitionedMesh
Creates a PartitionedMesh of the shape enclosed by the given StrokeInputBatch input points. A typical use case is selecting a region of the scene and performing hit testing with the resulting PartitionedMesh.
For a given stroke this algorithm aims to:
-
Identify and create any connections that the user may have intended to make but did not fully connect.
-
Trim any extra end points that the user did not intend to be part of the selected area.
Example usage:
fun onStrokeFinished(stroke: Stroke) {
val selectionRegion = stroke.inputs.createClosedShape()
for (stroke in myScene.strokes) {
if (stroke.shape.intersects(selectionRegion)) {
myScene.setSelected(stroke, true)
}
}
}
| Parameters | |
|---|---|
StrokeInputBatch |
The |
| Returns | |
|---|---|
PartitionedMesh |
The |