androidx.ink.geometry


  • Android/JVM

Classes

AffineTransform

An affine transformation in the plane.

android
Box

Represents an axis-aligned rectangle.

android
BoxAccumulator

A helper class for accumulating the minimum bounding boxes of zero or more geometry objects.

android
ImmutableAffineTransform

An affine transformation in the plane.

android
ImmutableBox

An immutable axis-aligned rectangle.

android
ImmutableParallelogram

Immutable parallelogram (i.e. a quadrilateral with parallel sides), defined by its center, width, height, rotation, and shearFactor.

android
ImmutableSegment

Represents a directed line segment between two points.

android
ImmutableTriangle

An immutable triangle, defined by its three corners p0, p1 and p2 in order.

android
ImmutableVec

An immutable two-dimensional vector, i.e. an (x, y) coordinate pair.

android
MutableAffineTransform

An affine transformation in the plane.

android
MutableBox

A mutable axis-aligned rectangle.

android
MutableParallelogram

Mutable parallelogram (i.e. a quadrilateral with parallel sides), defined by its center, width, height, rotation, and shearFactor.

android
MutableSegment

Represents a mutable directed line segment between two points.

android
MutableTriangle

Represents a mutable triangle, defined by its three corners p0, p1 and p2 in order.

android
MutableVec

A mutable two-dimensional vector, i.e. an (x, y) coordinate pair.

android
Parallelogram

This class represents a parallelogram (i.e. a quadrilateral with parallel sides), defined by its center, width, height, rotation, and shearFactor.

android
PartitionedMesh

An immutable** complex shape expressed as a set of triangles.

android
Segment

Represents a directed line segment between two points.

android
Triangle

A triangle defined by its three corners p0, p1 and p2.

android
Vec

A two-dimensional vector, i.e. an (x, y) coordinate pair.

android

Objects

Angle

A utility for working with a signed angle.

android
ImmutableAffineTransform.Companion
android
ImmutableBox.Companion
android
ImmutableVec.Companion
android
Intersection

Contains functions for intersection of ink geometry classes.

android

Annotations

AngleDegreesFloat

A signed angle in degrees.

android
AngleRadiansFloat

A signed angle in radians.

android

Top-level functions summary

ImmutableAffineTransform?

Constructs an ImmutableAffineTransform with the values from matrix.

android
ImmutableBox?

Constructs an ImmutableBox with the values from rect.

android
ImmutableVec
createVec(point: PointF)

Constructs an ImmutableVec with the values from point.

android

Extension functions summary

BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains rect.

android
ImmutableAffineTransform?

Constructs an ImmutableAffineTransform with the values from matrix.

android
ImmutableVec

Constructs an ImmutableVec with the values from point.

android
ImmutableBox?

Constructs an ImmutableBox with the values from rect.

android
Path
PartitionedMesh.outlinesToPath(renderGroupIndex: @IntRange(from = 0) Int)

Returns a Path containing the outlines in the render group at renderGroupIndex.

android
MutableAffineTransform

Fills this MutableAffineTransform with the values from matrix.

android
MutableVec

Fills this MutableVec with the values from point.

android
Unit

Writes the values from this AffineTransform to out.

android
Path
PartitionedMesh.populateOutlines(
    renderGroupIndex: @IntRange(from = 0) Int,
    out: Path
)

Replaces the contents of out with the outline of the render group at renderGroupIndex.

android
PointF

Writes the values from this Vec to out.

android
RectF

Writes the values from this Box to out.

android
Matrix

Constructs a Matrix with the values from the AffineTransform.

android
PointF

Constructs a PointF with the same coordinates as the Vec

android
RectF

Constructs a Rect with the same coordinates as the Box

android

Top-level functions

createAffineTransform

fun createAffineTransform(matrix: Matrix): ImmutableAffineTransform?

Constructs an ImmutableAffineTransform with the values from matrix.

If matrix is not an affine transform, returns null instead.

Performance-sensitive code should use the populateFrom overload that takes a pre-allocated MutableAffineTransform, so that the instance can be reused across multiple calls.

Kotlin callers should prefer ImmutableAffineTransform.Companion.from.

createBox

fun createBox(rect: RectF): ImmutableBox?

Constructs an ImmutableBox with the values from rect.

If rect is empty, returns null instead.

Kotlin callers should prefer ImmutableBox.Companion.from.

createVec

fun createVec(point: PointF): ImmutableVec

Constructs an ImmutableVec with the values from point.

Kotlin callers should prefer ImmutableVec.Companion.from.

Extension functions

add

fun BoxAccumulator.add(rect: RectF): BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains rect. If rect is null, this is a no-op.

This is functionally equivalent to, but more efficient than: add(ImmutableBox.from(rect))

Returns
BoxAccumulator

this

from

fun ImmutableAffineTransform.Companion.from(matrix: Matrix): ImmutableAffineTransform?

Constructs an ImmutableAffineTransform with the values from matrix.

If matrix is not an affine transform, returns null instead.

Performance-sensitive code should use the populateFrom overload that takes a pre-allocated MutableAffineTransform, so that the instance can be reused across multiple calls.

Java callers should prefer AndroidGraphicsConverter.createAffineTransform(Matrix) (createAffineTransform).

from

fun ImmutableVec.Companion.from(point: PointF): ImmutableVec

Constructs an ImmutableVec with the values from point.

Java callers should prefer AndroidGraphicsConverter.createVec(PointF)(createVec).

from

fun ImmutableBox.Companion.from(rect: RectF): ImmutableBox?

Constructs an ImmutableBox with the values from rect.

If rect is empty, returns null instead.

Java callers should prefer AndroidGraphicsConverter.createBox(createBox).

outlinesToPath

fun PartitionedMesh.outlinesToPath(renderGroupIndex: @IntRange(from = 0) Int): Path

Returns a Path containing the outlines in the render group at renderGroupIndex.

populateFrom

fun MutableAffineTransform.populateFrom(matrix: Matrix): MutableAffineTransform

Fills this MutableAffineTransform with the values from matrix.

If matrix is not an affine transform, throws IllegalArgumentException instead.

Leaves matrix unchanged. Returns this modified instance to allow chaining calls.

Returns
MutableAffineTransform

this

Throws
kotlin.IllegalArgumentException

if matrix is not an affine transform.

populateFrom

fun MutableVec.populateFrom(point: PointF): MutableVec

Fills this MutableVec with the values from point.

Leaves point unchanged. Returns the modified instance to allow chaining calls.

Returns
MutableVec

this

populateMatrix

fun AffineTransform.populateMatrix(out: Matrix): Unit

Writes the values from this AffineTransform to out.

Returns the modified Matrix to allow chaining calls.

Returns
Unit

out

populateOutlines

fun PartitionedMesh.populateOutlines(
    renderGroupIndex: @IntRange(from = 0) Int,
    out: Path
): Path

Replaces the contents of out with the outline of the render group at renderGroupIndex.

Returns the modified Path to allow chaining calls.

Returns
Path

out

populatePointF

fun Vec.populatePointF(out: PointF): PointF

Writes the values from this Vec to out.

Returns the modified PointF instance to allow chaining calls.

Returns
PointF

out

populateRectF

fun Box.populateRectF(out: RectF): RectF

Writes the values from this Box to out.

Returns the modified RectF instance to allow chaining calls.

Returns
RectF

out

toMatrix

fun AffineTransform.toMatrix(): Matrix

Constructs a Matrix with the values from the AffineTransform.

Performance-sensitive code should use the populateMatrix overload that takes a pre-allocated Matrix, so that the instance can be reused across multiple calls.

toPointF

fun Vec.toPointF(): PointF

Constructs a PointF with the same coordinates as the Vec

toRectF

fun Box.toRectF(): RectF

Constructs a Rect with the same coordinates as the Box