MutableAffineTransform
public final class MutableAffineTransform extends AffineTransform
| java.lang.Object | ||
| ↳ | androidx.ink.geometry.AffineTransform | |
| ↳ | androidx.ink.geometry.MutableAffineTransform |
A mutable affine transformation in the plane. Individual operations can be populated with methods like populateFromTranslation and populateFromRotationDegrees.
See AffineTransform for more general documentation about how these transforms are represented. See ImmutableAffineTransform for an immutable alternative to this class.
Summary
Public constructors |
|---|
|
Constructs an identity |
Public methods |
|
|---|---|
boolean |
Component-wise equality operator for |
int |
hashCode() |
final @NonNull MutableAffineTransform |
populateFrom(@NonNull AffineTransform input)Fills this |
final @NonNull MutableAffineTransform |
Fills this |
final @NonNull MutableAffineTransform |
populateFromRotationDegrees(@AngleDegreesFloat float degrees)Fills this |
final @NonNull MutableAffineTransform |
populateFromScale(float scaleFactor)Fills this |
final @NonNull MutableAffineTransform |
populateFromScale(float xScaleFactor, float yScaleFactor)Fills this |
final @NonNull MutableAffineTransform |
populateFromScaleX(float scaleFactor)Fills this |
final @NonNull MutableAffineTransform |
populateFromScaleY(float scaleFactor)Fills this |
final @NonNull MutableAffineTransform |
populateFromSkewX(float sx)Fills this |
final @NonNull MutableAffineTransform |
populateFromSkewY(float sy)Fills this |
final @NonNull MutableAffineTransform |
populateFromTranslation(@NonNull Vec offset)Fills this |
final void |
Like |
final void |
setValues(float m00, float m10, float m20, float m01, float m11, float m21)Populates this transform with the given values, starting with the top left corner of the matrix and proceeding in row-major order. |
@NonNull String |
toString() |
Extension functions |
|
|---|---|
final @NonNull MutableAffineTransform |
AndroidGraphicsConverter.populateFrom(Fills this |
Inherited methods |
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
MutableAffineTransform
public MutableAffineTransform()
Constructs an identity MutableAffineTransform:
⎡1 0 0⎤
⎢0 1 0⎥
⎣0 0 1⎦
This is useful when pre-allocating a scratch instance to be filled later.
Public methods
equals
public boolean equals(Object other)
Component-wise equality operator for MutableAffineTransform.
Due to the propagation floating point precision errors, operations that may be equivalent over the real numbers are not always equivalent for floats, and might return false for equals in some cases.
populateFrom
public final @NonNull MutableAffineTransform populateFrom(@NonNull AffineTransform input)
Fills this MutableAffineTransform with the same values contained in input.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromIdentity
public final @NonNull MutableAffineTransform populateFromIdentity()
Fills this MutableAffineTransform with an identity transformation, which maps a point to itself, i.e. it leaves it unchanged.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromRotationDegrees
public final @NonNull MutableAffineTransform populateFromRotationDegrees(@AngleDegreesFloat float degrees)
Fills this MutableAffineTransform with a transformation that rotates degrees in the direction from the positive x-axis towards the positive y-axis.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromScale
public final @NonNull MutableAffineTransform populateFromScale(float scaleFactor)
Fills this MutableAffineTransform with a transformation that scales in both the x and y direction by the given scaleFactor, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromScale
public final @NonNull MutableAffineTransform populateFromScale(float xScaleFactor, float yScaleFactor)
Fills this MutableAffineTransform with a transformation that scales in both the x- and y-direction by the given pair of factors; xScaleFactor and yScaleFactor respectively, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromScaleX
public final @NonNull MutableAffineTransform populateFromScaleX(float scaleFactor)
Fills this MutableAffineTransform with a transformation that scales in the x-direction by the given factor, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromScaleY
public final @NonNull MutableAffineTransform populateFromScaleY(float scaleFactor)
Fills this MutableAffineTransform with a transformation that scales in the y-direction by the given factor, centered about the origin.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromSkewX
public final @NonNull MutableAffineTransform populateFromSkewX(float sx)
Fills this MutableAffineTransform with a transformation that skews in the x-direction by the given factor.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromSkewY
public final @NonNull MutableAffineTransform populateFromSkewY(float sy)
Fills this MutableAffineTransform with a transformation that skews in the y-direction by the given factor.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
populateFromTranslation
public final @NonNull MutableAffineTransform populateFromTranslation(@NonNull Vec offset)
Fills this MutableAffineTransform with a transformation that translates by the given offset vector.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
setValues
public final void setValues(@Size(min = 6) @NonNull float[] values)
Like setValues, but accepts a FloatArray instead of individual float values.
setValues
public final void setValues(float m00, float m10, float m20, float m01, float m11, float m21)
Populates this transform with the given values, starting with the top left corner of the matrix and proceeding in row-major order.
Prefer to modify this object with functions that apply specific transform operations, such as populateFromScale or populateFromRotationDegrees, rather than directly setting the actual numeric values of this transform. This function is useful for when the values are needed to be provided in bulk, for example for serialization.
To access these values in the same order as they are set here, use AffineTransform.getValues.
Extension functions
AndroidGraphicsConverter.populateFrom
public final @NonNull MutableAffineTransform AndroidGraphicsConverter.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.
| Returns | |
|---|---|
@NonNull MutableAffineTransform |
|
| Throws | |
|---|---|
IllegalArgumentException |
if |