Transformation getMatrix - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Transformation getMatrix method.

This code example shows how to use the following methods:getAlpha, getMatrix
        private void loadCurrentTransformation(View view) {
            Animation animation = view.getAnimation();
            if (animation == null)
                return; 
 
            Transformation transformation = new Transformation();
            float[] matrix = new float[9];
 
            animation.getTransformation(AnimationUtils.currentAnimationTimeMillis(), transformation);
            transformation.getMatrix().getValues(matrix);
 
            mAlpha = transformation.getAlpha();
            mTranslationX = matrix[Matrix.MTRANS_X];
            mTranslationY = matrix[Matrix.MTRANS_Y];
        } 
 
        private void prepareForUpdate() { 
            View view = mViewRef.get();
            if (view != null)
                computeRect(mBefore, view);
8
CodeRank
This code example shows how to use the following methods:getMatrix, setAlpha
 
    @Override 
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        View view = mView.get();
        if (view != null) {
            t.setAlpha(mAlpha);
            transformMatrix(t.getMatrix(), view);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getMatrix
This code example shows how to use the following methods:clear, getMatrix, setTransformationType
 
	protected boolean getChildStaticTransformation(View child, Transformation t) {
		final int childCenter = getCenterOfView(child);
		final int childWidth = child.getWidth();
		int rotationAngle = 0;
		t.clear();
		t.setTransformationType(Transformation.TYPE_MATRIX);
		if (childCenter == mCoveflowCenter) {
			transformImageBitmap((RelativeLayout) child, t, 0);
		} else { 
			rotationAngle = (int) (((float) (mCoveflowCenter - childCenter) / childWidth) * mMaxRotationAngle);
			System.out.println("rotationAngle:" + rotationAngle);
			if (Math.abs(rotationAngle) > mMaxRotationAngle) {
				rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
			} 
			transformImageBitmap((RelativeLayout) child, t, rotationAngle);
		} 
		return true; 
	} 
 

7
CodeRank
This code example shows how to use the following methods:getMatrix
This code example shows how to use the following methods:clear, getMatrix, setTransformationType
 
	protected boolean getChildStaticTransformation(View child, Transformation t) {
		final int childCenter = getCenterOfView(child);
		final int childWidth = child.getWidth();
		int rotationAngle = 0;
		t.clear();
		t.setTransformationType(Transformation.TYPE_MATRIX);
		if (childCenter == mCoveflowCenter) {
			transformImageBitmap((RelativeLayout) child, t, 0);
		} else { 
			rotationAngle = (int) (((float) (mCoveflowCenter - childCenter) / childWidth) * mMaxRotationAngle);
			System.out.println("rotationAngle:" + rotationAngle);
			if (Math.abs(rotationAngle) > mMaxRotationAngle) {
				rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
			} 
			transformImageBitmap((RelativeLayout) child, t, rotationAngle);
		} 
		return true; 
	} 
 

7
CodeRank
This code example shows how to use the following methods:getMatrix, setAlpha
 
    @Override 
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        View view = mView.get();
        if (view != null) {
            t.setAlpha(mAlpha);
            transformMatrix(t.getMatrix(), view);
        } 
    } 
 
    @Override 
    public void reset() { 
        /* Do nothing. */ 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:clear, getAlpha, getMatrix
        assertEquals(glRootView.pushTransform(), glRootView.getTransformation());
        glRootView.popTransform();
        Transformation t1= glRootView.getTransformation();
        Transformation t2 = glRootView.obtainTransformation();
        Matrix f1 = t1.getMatrix();
        Matrix f2 = t2.getMatrix();
        float a1 = t1.getAlpha();
        float a2 = t2.getAlpha();
        assertEquals(f1, f2);
        assertEquals(a1, a2);
        assertNotEqual(t1, t2);
    } 
 
    public void testDpToPixel() { 
        GLRootView glRootView = new GLRootView(mActivity);
         DisplayMetrics metrics = new DisplayMetrics();
            mActivity.getWindowManager()
            .getDefaultDisplay().getMetrics(metrics);
        float f = metrics.density;
 

7
CodeRank
This code example shows how to use the following methods:getMatrix
This code example shows how to use the following methods:clear, getMatrix, setTransformationType
    protected boolean getChildStaticTransformation(View child, Transformation t) {
        final int center = getCenterOfView(child);
        final int width = child.getWidth();
        int angle = 0;
 
        t.clear();
        t.setTransformationType(Transformation.TYPE_MATRIX);
 
        if (center == mCoveflowCenter) {
            this.transformImageBitmap((ImageView) child, t, 0);
 
        } else { 
            angle = (int) (((float) (this.mCoveflowCenter - center) / width) * this.mMaxRotationAngle);
            if (Math.abs(angle) > this.mMaxRotationAngle) {
                angle = (angle < 0) ? -this.mMaxRotationAngle : this.mMaxRotationAngle;
            } 
//Log.d("CoverFlowGallery", "angle: " + angle + ", mCoveflowCenter: " + mCoveflowCenter + ", center: " + center + ", width: " + width + ", mMaxRotationAngle: " + mMaxRotationAngle); 
 
            this.transformImageBitmap((ImageView) child, t, angle);
        } 

7
CodeRank

Related Transformation getMatrix Questions & Answers:

getMatrix Method Overview
See Code Examples for other Android Transformation Methods: