public class Transformation extends Object
Modifier and Type | Field and Description |
---|---|
protected float |
mAlpha |
protected Matrix |
mMatrix |
protected int |
mTransformationType |
static int |
TYPE_ALPHA
Indicates a transformation that applies an alpha only (uses an identity matrix.)
|
static int |
TYPE_BOTH
Indicates a transformation that applies an alpha and a matrix.
|
static int |
TYPE_IDENTITY
Indicates a transformation that has no effect (alpha = 1 and identity matrix.)
|
static int |
TYPE_MATRIX
Indicates a transformation that applies a matrix only (alpha = 1.)
|
Constructor and Description |
---|
Transformation()
Creates a new transformation with alpha = 1 and the identity matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Reset the transformation to a state that leaves the object
being animated in an unmodified state.
|
void |
compose(Transformation t)
Apply this Transformation to an existing Transformation, e.g. apply
a scale effect to something that has already been rotated.
|
float |
getAlpha() |
Rect |
getClipRect()
Returns the current Transform's clip rect
|
Matrix |
getMatrix() |
int |
getTransformationType()
Indicates the nature of this transformation.
|
boolean |
hasClipRect()
Returns whether the current Transform's clip rect is set
|
void |
postCompose(Transformation t)
Like
compose(Transformation) but does this.postConcat(t) of
the transformation matrix. |
void |
printShortString(PrintWriter pw)
Print short string, to optimize dumping.
|
void |
set(Transformation t)
Clones the specified transformation.
|
void |
setAlpha(float alpha)
Sets the degree of transparency
|
void |
setClipRect(int l,
int t,
int r,
int b)
Sets the current Transform's clip rect
|
void |
setClipRect(Rect r)
Sets the current Transform's clip rect
|
void |
setTransformationType(int transformationType)
Sets the transformation type.
|
String |
toShortString()
Return a string representation of the transformation in a compact form.
|
void |
toShortString(StringBuilder sb) |
String |
toString()
Returns a string representation of the object.
|
public static final int TYPE_IDENTITY
public static final int TYPE_ALPHA
public static final int TYPE_MATRIX
public static final int TYPE_BOTH
protected Matrix mMatrix
protected float mAlpha
protected int mTransformationType
public Transformation()
public void clear()
TYPE_BOTH
by default.public int getTransformationType()
TYPE_ALPHA
, TYPE_MATRIX
,
TYPE_BOTH
or TYPE_IDENTITY
.public void setTransformationType(int transformationType)
transformationType
- One of TYPE_ALPHA
,
TYPE_MATRIX
, TYPE_BOTH
or
TYPE_IDENTITY
.public void set(Transformation t)
t
- The transformation to clone.public void compose(Transformation t)
t
- public void postCompose(Transformation t)
compose(Transformation)
but does this.postConcat(t) of
the transformation matrix.public Matrix getMatrix()
public void setAlpha(float alpha)
alpha
- 1.0 means fully opaqe and 0.0 means fully transparentpublic void setClipRect(Rect r)
public void setClipRect(int l, int t, int r, int b)
public Rect getClipRect()
public boolean hasClipRect()
public float getAlpha()
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public String toShortString()
public void toShortString(StringBuilder sb)
public void printShortString(PrintWriter pw)