AndroidGraphicsConverter

Added in 1.0.0-alpha05

public final class AndroidGraphicsConverter


Summary

Public methods

static final @NonNull BoxAccumulator
add(@NonNull BoxAccumulator receiver, @NonNull RectF rect)

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

static final ImmutableAffineTransform

Constructs an ImmutableAffineTransform with the values from matrix.

static final ImmutableBox

Constructs an ImmutableBox with the values from rect.

static final @NonNull ImmutableVec

Constructs an ImmutableVec with the values from point.

static final ImmutableAffineTransform
from(
    @NonNull ImmutableAffineTransform.Companion receiver,
    @NonNull Matrix matrix
)

Constructs an ImmutableAffineTransform with the values from matrix.

static final ImmutableBox

Constructs an ImmutableBox with the values from rect.

static final @NonNull ImmutableVec

Constructs an ImmutableVec with the values from point.

static final @NonNull Path
outlinesToPath(
    @NonNull PartitionedMesh receiver,
    @IntRange(from = 0) int renderGroupIndex
)

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

static final @NonNull MutableAffineTransform
populateFrom(
    @NonNull MutableAffineTransform receiver,
    @NonNull Matrix matrix
)

Fills this MutableAffineTransform with the values from matrix.

static final @NonNull MutableVec

Fills this MutableVec with the values from point.

static final void

Writes the values from this AffineTransform to out.

static final @NonNull Path
populateOutlines(
    @NonNull PartitionedMesh receiver,
    @IntRange(from = 0) int renderGroupIndex,
    @NonNull Path out
)

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

static final @NonNull PointF

Writes the values from this Vec to out.

static final @NonNull RectF
populateRectF(@NonNull Box receiver, @NonNull RectF out)

Writes the values from this Box to out.

static final @NonNull Matrix

Constructs a Matrix with the values from the AffineTransform.

static final @NonNull PointF
toPointF(@NonNull Vec receiver)

Constructs a PointF with the same coordinates as the Vec

static final @NonNull RectF
toRectF(@NonNull Box receiver)

Constructs a Rect with the same coordinates as the Box

Public methods

public static final @NonNull BoxAccumulator add(@NonNull BoxAccumulator receiver, @NonNull RectF rect)

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
@NonNull BoxAccumulator

this

createAffineTransform

public static final ImmutableAffineTransform createAffineTransform(@NonNull Matrix matrix)

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

public static final ImmutableBox createBox(@NonNull RectF rect)

Constructs an ImmutableBox with the values from rect.

If rect is empty, returns null instead.

Kotlin callers should prefer ImmutableBox.Companion.from.

createVec

public static final @NonNull ImmutableVec createVec(@NonNull PointF point)

Constructs an ImmutableVec with the values from point.

Kotlin callers should prefer ImmutableVec.Companion.from.

public static final ImmutableAffineTransform from(
    @NonNull ImmutableAffineTransform.Companion receiver,
    @NonNull Matrix matrix
)

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).

public static final ImmutableBox from(@NonNull ImmutableBox.Companion receiver, @NonNull RectF rect)

Constructs an ImmutableBox with the values from rect.

If rect is empty, returns null instead.

Java callers should prefer AndroidGraphicsConverter.createBox(createBox).

public static final @NonNull ImmutableVec from(@NonNull ImmutableVec.Companion receiver, @NonNull PointF point)

Constructs an ImmutableVec with the values from point.

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

outlinesToPath

public static final @NonNull Path outlinesToPath(
    @NonNull PartitionedMesh receiver,
    @IntRange(from = 0) int renderGroupIndex
)

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

populateFrom

public static final @NonNull MutableAffineTransform populateFrom(
    @NonNull MutableAffineTransform receiver,
    @NonNull Matrix matrix
)

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.

Throws
kotlin.IllegalArgumentException

if matrix is not an affine transform.

populateFrom

public static final @NonNull MutableVec populateFrom(@NonNull MutableVec receiver, @NonNull PointF point)

Fills this MutableVec with the values from point.

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

Returns
@NonNull MutableVec

this

populateMatrix

public static final void populateMatrix(@NonNull AffineTransform receiver, @NonNull Matrix out)

Writes the values from this AffineTransform to out.

Returns the modified Matrix to allow chaining calls.

Returns
void

out

populateOutlines

public static final @NonNull Path populateOutlines(
    @NonNull PartitionedMesh receiver,
    @IntRange(from = 0) int renderGroupIndex,
    @NonNull Path out
)

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

Returns the modified Path to allow chaining calls.

Returns
@NonNull Path

out

populatePointF

public static final @NonNull PointF populatePointF(@NonNull Vec receiver, @NonNull PointF out)

Writes the values from this Vec to out.

Returns the modified PointF instance to allow chaining calls.

Returns
@NonNull PointF

out

populateRectF

public static final @NonNull RectF populateRectF(@NonNull Box receiver, @NonNull RectF out)

Writes the values from this Box to out.

Returns the modified RectF instance to allow chaining calls.

Returns
@NonNull RectF

out

public static final @NonNull Matrix toMatrix(@NonNull AffineTransform receiver)

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.

public static final @NonNull PointF toPointF(@NonNull Vec receiver)

Constructs a PointF with the same coordinates as the Vec

public static final @NonNull RectF toRectF(@NonNull Box receiver)

Constructs a Rect with the same coordinates as the Box