androidx.ink.geometry.compose

Extension functions summary

BoxAccumulator

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

BoxAccumulator

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

ImmutableAffineTransform?

Constructs an ImmutableAffineTransform with the values from matrix, if and only if matrix is a 2D affine transform; that is, that the Z row and column in matrix must both be 0, 0, 1, 0.

ImmutableVec

Constructs an ImmutableVec with the values from offset.

ImmutableBox?

If rect is not empty, returns an ImmutableBox constructed from the values of rect.

ImmutableBox?

If rect is not empty, returns an ImmutableBox constructed from the values of rect.

MutableAffineTransform

Fills this MutableAffineTransform with the values from matrix.

MutableVec

Writes the values from offset to this MutableVec.

Matrix

Writes the values from this AffineTransform to out.

MutableRect

Writes the values from this Box to out.

Matrix

Constructs a Matrix with the values from the AffineTransform.

Offset

Returns an Offset with the values from this Vec.

Rect

Constructs a Rect with the values from this Box.

Extension functions

fun BoxAccumulator.add(rect: MutableRect): BoxAccumulator

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

Returns the modified instance to allow chaining calls.

Returns
BoxAccumulator

this

fun BoxAccumulator.add(rect: Rect): BoxAccumulator

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

Returns the modified instance to allow chaining calls.

Returns
BoxAccumulator

this

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

Constructs an ImmutableAffineTransform with the values from matrix, if and only if matrix is a 2D affine transform; that is, that the Z row and column in matrix must both be 0, 0, 1, 0. Returns null if matrix is not a 2D affine transform.

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

fun ImmutableVec.Companion.from(offset: Offset): ImmutableVec

Constructs an ImmutableVec with the values from offset.

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

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

If rect is not empty, returns an ImmutableBox constructed from the values of rect. Otherwise returns null.

Performance-sensitive code should use the BoxAccumulator.add overload and obtain the bounding box from there, so that instance can be reused across multiple calls.

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

If rect is not empty, returns an ImmutableBox constructed from the values of rect. Otherwise returns null.

Performance-sensitive code should use the BoxAccumulator.add overload and obtain the bounding box from there, so that instance can be reused across multiple calls.

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 the input matrix unchanged. Returns the modified instance to allow chaining calls.

Returns
MutableAffineTransform

this

Throws
kotlin.IllegalArgumentException

if matrix is not a 2D affine transform.

fun MutableVec.populateFrom(offset: Offset): MutableVec

Writes the values from offset to this MutableVec.

Returns the modified instance to allow chaining function calls.

Returns
MutableVec

this

fun AffineTransform.populateMatrix(out: Matrix): Matrix

Writes the values from this AffineTransform to out. Note the conversion from a 3x3 AffineTransform to a 4x4 column-major android.compose.ui.graphics.Matrix.

Returns the modified Matrix instance to allow chaining calls.

Returns
Matrix

out

populateMutableRect

fun Box.populateMutableRect(out: MutableRect): MutableRect

Writes the values from this Box to out.

Returns the modified MutableRect instance to allow chaining calls.

Returns
MutableRect

out

fun AffineTransform.toMatrix(): Matrix

Constructs a Matrix with the values from the AffineTransform.

Performance-sensitive code should still use this because Matrix is an inline value class.

fun Vec.toOffset(): Offset

Returns an Offset with the values from this Vec.

fun Box.toRect(): Rect

Constructs a Rect with the values from this Box.