These code examples were ranked by Codota’s semantic indexing as the best open source examples for Transformation getMatrix method.
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);
final float centerX = mCenterX; final float centerY = mCenterY; final Camera camera = mCamera; final Matrix matrix = t.getMatrix(); camera.save(); if (mReverse) { camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime); } else { camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime)); } camera.rotateY(degrees); camera.getMatrix(matrix); camera.restore(); matrix.preTranslate(-centerX, -centerY); matrix.postTranslate(centerX, centerY);
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; }
final float centerX = mCenterX; final float centerY = mCenterY; final Camera camera = mCamera; final Matrix matrix = t.getMatrix(); camera.save(); if (mReverse) { camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime); } else { camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime)); } camera.rotateY(degrees); camera.getMatrix(matrix); camera.restore(); matrix.preTranslate(-centerX, -centerY); matrix.postTranslate(centerX, centerY); }
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; }
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;
@Override protected void applyTransformation(float interpolatedTime, Transformation t) { if (!mCancelled) { mDegree = mFromDegrees + ((mToDegrees - mFromDegrees) * interpolatedTime); } t.getMatrix().setRotate(mDegree, mPivotX, mPivotY); } }
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); }