FileDocCategorySizeDatePackage
Transformation.javaAPI DocAndroid 5.1 API6218Thu Mar 12 22:22:10 GMT 2015android.view.animation

Transformation

public class Transformation extends Object
Defines the transformation to be applied at one point in time of an Animation.

Fields Summary
public static final int
TYPE_IDENTITY
Indicates a transformation that has no effect (alpha = 1 and identity matrix.)
public static final int
TYPE_ALPHA
Indicates a transformation that applies an alpha only (uses an identity matrix.)
public static final int
TYPE_MATRIX
Indicates a transformation that applies a matrix only (alpha = 1.)
public static final int
TYPE_BOTH
Indicates a transformation that applies an alpha and a matrix.
protected android.graphics.Matrix
mMatrix
protected float
mAlpha
protected int
mTransformationType
private boolean
mHasClipRect
private android.graphics.Rect
mClipRect
Constructors Summary
public Transformation()
Creates a new transformation with alpha = 1 and the identity matrix.


                     
      
        clear();
    
Methods Summary
public voidclear()
Reset the transformation to a state that leaves the object being animated in an unmodified state. The transformation type is {@link #TYPE_BOTH} by default.

        if (mMatrix == null) {
            mMatrix = new Matrix();
        } else {
            mMatrix.reset();
        }
        mClipRect.setEmpty();
        mHasClipRect = false;
        mAlpha = 1.0f;
        mTransformationType = TYPE_BOTH;
    
public voidcompose(android.view.animation.Transformation t)
Apply this Transformation to an existing Transformation, e.g. apply a scale effect to something that has already been rotated.

param
t

        mAlpha *= t.getAlpha();
        mMatrix.preConcat(t.getMatrix());
        if (t.mHasClipRect) {
            setClipRect(t.getClipRect());
        }
    
public floatgetAlpha()

return
The degree of transparency

        return mAlpha;
    
public android.graphics.RectgetClipRect()
Returns the current Transform's clip rect

hide

        return mClipRect;
    
public android.graphics.MatrixgetMatrix()

return
The 3x3 Matrix representing the trnasformation to apply to the coordinates of the object being animated

        return mMatrix;
    
public intgetTransformationType()
Indicates the nature of this transformation.

return
{@link #TYPE_ALPHA}, {@link #TYPE_MATRIX}, {@link #TYPE_BOTH} or {@link #TYPE_IDENTITY}.

        return mTransformationType;
    
public booleanhasClipRect()
Returns whether the current Transform's clip rect is set

hide

        return mHasClipRect;
    
public voidpostCompose(android.view.animation.Transformation t)
Like {@link #compose(Transformation)} but does this.postConcat(t) of the transformation matrix.

hide

        mAlpha *= t.getAlpha();
        mMatrix.postConcat(t.getMatrix());
        if (t.mHasClipRect) {
            setClipRect(t.getClipRect());
        }
    
public voidprintShortString(java.io.PrintWriter pw)
Print short string, to optimize dumping.

hide

        pw.print("{alpha="); pw.print(mAlpha);
        pw.print(" matrix=");
        mMatrix.printShortString(pw);
        pw.print('}");
    
public voidset(android.view.animation.Transformation t)
Clones the specified transformation.

param
t The transformation to clone.

        mAlpha = t.getAlpha();
        mMatrix.set(t.getMatrix());
        if (t.mHasClipRect) {
            setClipRect(t.getClipRect());
        } else {
            mHasClipRect = false;
            mClipRect.setEmpty();
        }
        mTransformationType = t.getTransformationType();
    
public voidsetAlpha(float alpha)
Sets the degree of transparency

param
alpha 1.0 means fully opaqe and 0.0 means fully transparent

        mAlpha = alpha;
    
public voidsetClipRect(android.graphics.Rect r)
Sets the current Transform's clip rect

hide

        setClipRect(r.left, r.top, r.right, r.bottom);
    
public voidsetClipRect(int l, int t, int r, int b)
Sets the current Transform's clip rect

hide

        mClipRect.set(l, t, r, b);
        mHasClipRect = true;
    
public voidsetTransformationType(int transformationType)
Sets the transformation type.

param
transformationType One of {@link #TYPE_ALPHA}, {@link #TYPE_MATRIX}, {@link #TYPE_BOTH} or {@link #TYPE_IDENTITY}.

        mTransformationType = transformationType;
    
public java.lang.StringtoShortString()
Return a string representation of the transformation in a compact form.

        StringBuilder sb = new StringBuilder(64);
        toShortString(sb);
        return sb.toString();
    
public voidtoShortString(java.lang.StringBuilder sb)

hide

        sb.append("{alpha="); sb.append(mAlpha);
        sb.append(" matrix="); mMatrix.toShortString(sb);
        sb.append('}");
    
public java.lang.StringtoString()

        StringBuilder sb = new StringBuilder(64);
        sb.append("Transformation");
        toShortString(sb);
        return sb.toString();