当前位置: 首页>>代码示例>>Java>>正文


Java Camera.save方法代码示例

本文整理汇总了Java中android.graphics.Camera.save方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.save方法的具体用法?Java Camera.save怎么用?Java Camera.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Camera的用法示例。


在下文中一共展示了Camera.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    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);
}
 
开发者ID:aesean,项目名称:Rotate3d,代码行数:23,代码来源:Rotate3dAnimation.java

示例2: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    float degrees = fromDegrees + ((toDegrees - fromDegrees) * interpolatedTime);
    final Matrix matrix = t.getMatrix();

    final Camera camera = mCamera;
    camera.save();

    camera.rotateY(degrees);
    camera.getMatrix(matrix);

    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:ABTSoftware,项目名称:SciChart.Android.Examples,代码行数:17,代码来源:FlipAnimation.java

示例3: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  final float fromDegrees = mFromDegrees;
  float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

  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);
}
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:23,代码来源:Rotate3dAnimation.java

示例4: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
    Camera camera = new Camera();
    camera.save();

    // 设置camera动作为绕Y轴旋转
    // 总共旋转180度,因此计算在每个补间时间点interpolatedTime的角度即为两着相乘
//    camera.rotateX(deg * interpolatedTime);
    camera.rotateY(180 * interpolatedTime);
//    camera.rotateZ(180 * interpolatedTime);
//
    // 根据camera动作产生一个matrix,赋给Transformation的matrix,以用来设置动画效果
    Matrix matrix = t.getMatrix();
    camera.getMatrix(matrix);

    camera.restore();
    //经过以下平移,才能以view的中心点进行翻转
    matrix.preTranslate(-view.getWidth() / 2, -view.getHeight() / 2);
    matrix.postTranslate(view.getWidth() / 2, view.getHeight() / 2);
  }
 
开发者ID:JustKiddingBaby,项目名称:FragmentRigger,代码行数:21,代码来源:Rotate3d.java

示例5: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    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);
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:25,代码来源:Rotate3dAnimation.java

示例6: drawIconOne

import android.graphics.Camera; //导入方法依赖的package包/类
/**
 * 根据角度绘制图标的类
 * @param canvas 画布
 * @param fraction 完成时间百分比
 * @param icon 图标
 * @param width view宽度
 * @param height view高度
 */
private void drawIconOne(Canvas canvas, float fraction, Bitmap icon, int width, int height) {
    Camera camera = new Camera();
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    canvas.save();
    int centerX = width / 2;
    int centerY = height / 2 - 200;
    int x = centerX - icon.getWidth()/2;
    int y = centerY - icon.getHeight()/2;
    Matrix matrix = new Matrix();
    matrix.postScale(1.7f, 1.7f, centerX, centerY);
    canvas.concat(matrix);
    canvas.clipRect(x, y, x + icon.getWidth() * fraction * 0.5f, y + icon.getHeight() * fraction * 0.5f);
    canvas.translate(centerX, centerY);
    camera.save();
    camera.rotateX(180);
    camera.rotateY(-180);
    camera.applyToCanvas(canvas);
    camera.restore();
    canvas.translate(-centerX, -centerY);
    canvas.drawBitmap(icon, x, y, paint);
    canvas.restore();
}
 
开发者ID:JoshuaRogue,项目名称:FancyView,代码行数:31,代码来源:RotationDrawStrategy.java

示例7: skewImage

import android.graphics.Camera; //导入方法依赖的package包/类
/**
 * 3D效果
 * 
 * @param srcBitmap
 * @return
 */
public static Bitmap skewImage(Bitmap srcBitmap, int picWidth, int picHeight, int height) {
	srcBitmap = Bitmap.createScaledBitmap(srcBitmap, picWidth, picHeight, true);
	Bitmap bitmap = createReflectedImage(srcBitmap, height);
	Camera camera = new Camera();
	camera.save();
	Matrix matrix = new Matrix();
	camera.rotateY(15);
	camera.getMatrix(matrix);
	camera.restore();
	matrix.preTranslate(-bitmap.getWidth() >> 1, -bitmap.getHeight() >> 1);
	Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
	Bitmap canvasBitmap = Bitmap.createBitmap(newBitmap.getWidth(), newBitmap.getHeight(), Config.ARGB_8888);
	Canvas canvas = new Canvas(canvasBitmap);
	Paint paint = new Paint();
	paint.setAntiAlias(true);
	paint.setFilterBitmap(true);
	// paint.setStyle(Style.FILL);
	canvas.drawBitmap(newBitmap, 0, 0, paint);
	newBitmap.recycle();
	// bitmap.recycle();
	return canvasBitmap;
}
 
开发者ID:imknown,项目名称:IMKBaseFrameworkLibrary,代码行数:29,代码来源:Reflect3DImage.java

示例8: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
/**
 * 执行顺序 matrix.preTranslate() -->  camera.rotateY(degrees) -->   matrix.postTranslate() -->   matrix.postScale()
 * @param interpolatedTime
 * @param t
 */
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    float degrees = mReverse ? mToDegrees + (mFromDegrees - mToDegrees) * interpolatedTime : mFromDegrees + (mToDegrees - mFromDegrees) * interpolatedTime;
    final Matrix matrix = t.getMatrix();

    final Camera camera = mCamera;

    camera.save();

    camera.rotateY(degrees);

    camera.getMatrix(matrix);
    camera.restore();

          //  matrix.preTranslate(-mPivotXValue, 0);      //在进行rotateY之前需要移动物体,让物体左边与Y轴对齐
          //  matrix.postTranslate(mPivotXValue, 0);      //还原物体位置

    if (mReverse) {
        matrix.postScale(1 + (scaleTimes - 1) * (1.0f - interpolatedTime), 1 + (scaleTimes - 1) * (1.0f - interpolatedTime), mPivotX - mPivotXValue , mPivotY - mPivotYValue);
    } else {
       // matrix.postScale(1 + (scaleTimes - 1) * interpolatedTime, 1 + (scaleTimes - 1) * interpolatedTime, mPivotX, mPivotY);
        matrix.postScale(1 + (scaleTimes - 1) * interpolatedTime, 1 + (scaleTimes - 1) * interpolatedTime, mPivotX - mPivotXValue , mPivotY - mPivotYValue );
    }
}
 
开发者ID:Focfa,项目名称:Jreader,代码行数:30,代码来源:Rotate3DAnimation.java

示例9: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    final float centerX = mCenterX;
    final float centerY = mCenterY;
    final Camera camera = mCamera;
    final int derection = mTurnUp ? 1 : -1;

    final Matrix matrix = t.getMatrix();

    camera.save();
    if (mTurnIn) {
        camera.translate(0.0f, derection * mCenterY * (interpolatedTime - 1.0f), 0.0f);
    } else {
        camera.translate(0.0f, derection * mCenterY * (interpolatedTime), 0.0f);
    }
    camera.rotateX(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:MiEcosystem,项目名称:NewXmPluginSDK,代码行数:26,代码来源:AutoTextView.java

示例10: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    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.setLocation(0, 0, 60);
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:talobin,项目名称:cardentry,代码行数:25,代码来源:RotateAnimation.java

示例11: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
/**
 * 执行顺序 matrix.preTranslate() -->  camera.rotateY(degrees) -->   matrix.postTranslate() -->   matrix.postScale()
 * @param interpolatedTime
 * @param t
 */
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    float degrees = mReverse ? mToDegrees + (mFromDegrees - mToDegrees) * interpolatedTime : mFromDegrees + (mToDegrees - mFromDegrees) * interpolatedTime;
    final Matrix matrix = t.getMatrix();

    final Camera camera = mCamera;

    camera.save();

    camera.rotateY(degrees);

    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-mPivotXValue, 0);      //在进行rotateY之前需要移动物体,让物体左边与Y轴对齐
    matrix.postTranslate(mPivotXValue, 0);      //还原物体位置

    if (mReverse) {
        matrix.postScale(1 + (scaleTimes - 1) * (1.0f - interpolatedTime), 1 + (scaleTimes - 1) * (1.0f - interpolatedTime), mPivotX, mPivotY);
    } else {
        matrix.postScale(1 + (scaleTimes - 1) * interpolatedTime, 1 + (scaleTimes - 1) * interpolatedTime, mPivotX, mPivotY);
    }
}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:29,代码来源:Rotate3DAnimation.java

示例12: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = mFromDegrees;
    float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

    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.rotateX(degrees);
    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-mCenterX * mWidth, -mCenterY * mHeight);
    matrix.postTranslate(mCenterX * mWidth, mCenterY * mHeight);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:22,代码来源:Rotate3DAnimation.java

示例13: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = this.fromDegrees;
    float degrees = fromDegrees + ((toDegrees - fromDegrees) * interpolatedTime);
    final float centerX = xCenter;
    final float centerY = yCenter;
    final Camera camera = this.camera;
    final Matrix matrix = t.getMatrix(); //保存一次camera初始状态,用于restore()
    camera.save();
    if (reverse) {
        camera.translate(0.0f, 0.0f, zDepth * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, zDepth * (1.0f - interpolatedTime));
    }
    //围绕Y轴旋转degrees度
    camera.rotateY(degrees);
    //行camera中取出矩阵,赋值给matrix
    camera.getMatrix(matrix);
    //camera恢复到初始状态,继续用于下次的计算
    camera.restore();
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:2BAB,项目名称:WeatherX,代码行数:24,代码来源:RotationAnim.java

示例14: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
    final float fromDegrees = m_fromDegree;
    float degrees = fromDegrees + ((m_toDegree - fromDegrees) * interpolatedTime);
    final float centerX = m_centerX;
    final float centerY = m_centerY;
    final Camera camera = m_camera;
    final Matrix matrix = t.getMatrix();
    camera.save();
    if (m_reverse) {
        camera.translate(0.0f, 0.0f, m_depthZ * interpolatedTime);
    } else {
        camera.translate(0.0f, 0.0f, m_depthZ * (1.0f - interpolatedTime));
    }
    camera.rotateY(degrees);
    camera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
}
 
开发者ID:AppCanOpenSource,项目名称:appcan-android,代码行数:21,代码来源:EBrowserAnimation.java

示例15: applyTransformation

import android.graphics.Camera; //导入方法依赖的package包/类
protected final void applyTransformation(float paramFloat, Transformation transformation) {
    float f1 = 0.0F - 360.0F * paramFloat;
    float f2 = mWidth;
    float f3 = mHeight;
    final Camera camera = mCamera;
    Matrix matrix = transformation.getMatrix();
    camera.save();
    if ((0x1 & mRotationFlags) == 1)
        camera.rotateX(f1);
    if ((0x2 & mRotationFlags) == 2)
        camera.rotateY(f1);
    if ((0x4 & mRotationFlags) == 4)
        camera.rotateZ(f1);
    camera.getMatrix(matrix);
    camera.restore();
    matrix.preTranslate(-f2, -f3);
    matrix.postTranslate(f2, f3);
}
 
开发者ID:AppCanOpenSource,项目名称:appcan-android,代码行数:19,代码来源:YAxisAnimation.java


注:本文中的android.graphics.Camera.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。