ImmutableAffineTransform
public final class ImmutableAffineTransform extends AffineTransform
| java.lang.Object | ||
| ↳ | androidx.ink.geometry.AffineTransform | |
| ↳ | androidx.ink.geometry.ImmutableAffineTransform |
An immutable affine transformation in the plane. Individual operations can be constructed with factory methods like translate and rotateDegrees.
See AffineTransform for more general documentation about how these transforms are represented. See MutableAffineTransform for a mutable alternative to this class.
Summary
Nested types |
|---|
public static class ImmutableAffineTransform.Companion |
Public constructors |
|---|
ImmutableAffineTransform(@Size(min = 6) @NonNull float[] values)Like the primary constructor, but accepts a |
ImmutableAffineTransform(Constructs this transform with 6 float values, starting with the top left corner of the matrix and proceeding in row-major order. |
Public methods |
|
|---|---|
boolean |
Component-wise equality operator for |
int |
hashCode() |
static final @NonNull ImmutableAffineTransform |
rotateDegrees(@AngleDegreesFloat float degrees)Returns a transformation that rotates |
static final @NonNull ImmutableAffineTransform |
scale(float scaleFactor)Returns a transformation that scales in both the x- and y-direction by the given |
static final @NonNull ImmutableAffineTransform |
scale(float xScaleFactor, float yScaleFactor)Returns a transformation that scales in both the x- and y-direction by the given pair of factors; |
static final @NonNull ImmutableAffineTransform |
scaleX(float scaleFactor)Returns a transformation that scales in the x-direction by the given factor, centered about the origin. |
static final @NonNull ImmutableAffineTransform |
scaleY(float scaleFactor)Returns a transformation that scales in the y-direction by the given factor, centered about the origin. |
static final @NonNull ImmutableAffineTransform |
skewX(float sx)Returns a transformation that skews in the x-direction by the given factor. |
static final @NonNull ImmutableAffineTransform |
skewY(float sy)Returns a transformation that skews in the y-direction by the given factor. |
@NonNull String |
toString() |
static final @NonNull ImmutableAffineTransform |
Returns a transformation that translates by the given |
Inherited methods |
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
ImmutableAffineTransform
public ImmutableAffineTransform(@Size(min = 6) @NonNull float[] values)
Like the primary constructor, but accepts a FloatArray instead of individual Float values.
ImmutableAffineTransform
public ImmutableAffineTransform(
float m00,
float m10,
float m20,
float m01,
float m11,
float m21
)
Constructs this transform with 6 float values, starting with the top left corner of the matrix and proceeding in row-major order. Prefer to create this object with functions that apply specific transform operations, such as scale or translate, rather than directly passing in the actual numeric values of this transform. This constructor is useful for when the values are needed to be provided all at once, for example for serialization. To access these values in the same order as they are passed in here, use AffineTransform.getValues. To construct this object using an array as input, there is another public constructor for that.
Public methods
equals
public boolean equals(Object other)
Component-wise equality operator for ImmutableAffineTransform.
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.
rotateDegrees
public static final @NonNull ImmutableAffineTransform rotateDegrees(@AngleDegreesFloat float degrees)
Returns a transformation that rotates degrees in the direction from the positive x-axis towards the positive y-axis.
scale
public static final @NonNull ImmutableAffineTransform scale(float scaleFactor)
Returns a transformation that scales in both the x- and y-direction by the given scaleFactor, centered about the origin.
scale
public static final @NonNull ImmutableAffineTransform scale(float xScaleFactor, float yScaleFactor)
Returns 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.
scaleX
public static final @NonNull ImmutableAffineTransform scaleX(float scaleFactor)
Returns a transformation that scales in the x-direction by the given factor, centered about the origin.
scaleY
public static final @NonNull ImmutableAffineTransform scaleY(float scaleFactor)
Returns a transformation that scales in the y-direction by the given factor, centered about the origin.
skewX
public static final @NonNull ImmutableAffineTransform skewX(float sx)
Returns a transformation that skews in the x-direction by the given factor.
skewY
public static final @NonNull ImmutableAffineTransform skewY(float sy)
Returns a transformation that skews in the y-direction by the given factor.
translate
public static final @NonNull ImmutableAffineTransform translate(@NonNull Vec offset)
Returns a transformation that translates by the given offset vector.