android.graphics.Camera.rotateZ()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中android.graphics.Camera.rotateZ()方法的一些代码示例,展示了Camera.rotateZ()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Camera.rotateZ()方法的具体详情如下:
包路径:android.graphics.Camera
类名称:Camera
方法名:rotateZ

Camera.rotateZ介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

private void transformMatrix(Matrix m, View view) {
  final float w = view.getWidth();
  final float h = view.getHeight();
  final boolean hasPivot = mHasPivot;
  final float pX = hasPivot ? mPivotX : w / 2f;
  final float pY = hasPivot ? mPivotY : h / 2f;
  final float rX = mRotationX;
  final float rY = mRotationY;
  final float rZ = mRotationZ;
  if ((rX != 0) || (rY != 0) || (rZ != 0)) {
    final Camera camera = mCamera;
    camera.save();
    camera.rotateX(rX);
    camera.rotateY(rY);
    camera.rotateZ(-rZ);
    camera.getMatrix(m);
    camera.restore();
    m.preTranslate(-pX, -pY);
    m.postTranslate(pX, pY);
  }
  final float sX = mScaleX;
  final float sY = mScaleY;
  if ((sX != 1.0f) || (sY != 1.0f)) {
    m.postScale(sX, sY);
    final float sPX = -(pX / w) * ((sX * w) - w);
    final float sPY = -(pY / h) * ((sY * h) - h);
    m.postTranslate(sPX, sPY);
  }
  m.postTranslate(mTranslationX, mTranslationY);
}

代码示例来源:origin: Bilibili/DanmakuFlameMaster

private int saveCanvas(BaseDanmaku danmaku, Canvas canvas, float left, float top) {
  camera.save();
  if (locationZ !=0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
    camera.setLocation(0, 0, locationZ);
  }
  camera.rotateY(-danmaku.rotationY);
  camera.rotateZ(-danmaku.rotationZ);
  camera.getMatrix(matrix);
  matrix.preTranslate(-left, -top);
  matrix.postTranslate(left , top);
  camera.restore();
  int count = canvas.save();
  canvas.concat(matrix);
  return count;
}

代码示例来源:origin: com.nineoldandroids/library

private void transformMatrix(Matrix m, View view) {
  final float w = view.getWidth();
  final float h = view.getHeight();
  final boolean hasPivot = mHasPivot;
  final float pX = hasPivot ? mPivotX : w / 2f;
  final float pY = hasPivot ? mPivotY : h / 2f;
  final float rX = mRotationX;
  final float rY = mRotationY;
  final float rZ = mRotationZ;
  if ((rX != 0) || (rY != 0) || (rZ != 0)) {
    final Camera camera = mCamera;
    camera.save();
    camera.rotateX(rX);
    camera.rotateY(rY);
    camera.rotateZ(-rZ);
    camera.getMatrix(m);
    camera.restore();
    m.preTranslate(-pX, -pY);
    m.postTranslate(pX, pY);
  }
  final float sX = mScaleX;
  final float sY = mScaleY;
  if ((sX != 1.0f) || (sY != 1.0f)) {
    m.postScale(sX, sY);
    final float sPX = -(pX / w) * ((sX * w) - w);
    final float sPY = -(pY / h) * ((sY * h) - h);
    m.postTranslate(sPX, sPY);
  }
  m.postTranslate(mTranslationX, mTranslationY);
}

代码示例来源:origin: kakajika/FragmentAnimations

camera.rotateZ(-rZ);
camera.getMatrix(m);
camera.restore();

代码示例来源:origin: luhaoaimama1/zone-sdk

public CameraInvert rotateZ_3D(float degrees) {
  mode = RELATIVE_TO_SELF;
  mCamera.rotateZ(-degrees);
  return this;
}

代码示例来源:origin: luhaoaimama1/zone-sdk

public CameraInvert rotateZ_3D(float degrees, float pz) {
  savePxy_Z(pz);
  mCamera.rotateZ(-degrees);
  return this;
}

代码示例来源:origin: xenione/tab-digit

public static void rotateZ(Matrix matrix, int alpha) {
  synchronized (camera) {
    camera.save();
    camera.rotateZ(alpha);
    camera.getMatrix(matrix);
    camera.restore();
  }
}

代码示例来源:origin: Android500/AwesomeDrawer

private void transformMatrix(Matrix m, View view) {
  final float w = view.getWidth();
  final float h = view.getHeight();
  final boolean hasPivot = mHasPivot;
  final float pX = hasPivot ? mPivotX : w / 2f;
  final float pY = hasPivot ? mPivotY : h / 2f;
  final float rX = mRotationX;
  final float rY = mRotationY;
  final float rZ = mRotationZ;
  if ((rX != 0) || (rY != 0) || (rZ != 0)) {
    final Camera camera = mCamera;
    camera.save();
    camera.rotateX(rX);
    camera.rotateY(rY);
    camera.rotateZ(-rZ);
    camera.getMatrix(m);
    camera.restore();
    m.preTranslate(-pX, -pY);
    m.postTranslate(pX, pY);
  }
  final float sX = mScaleX;
  final float sY = mScaleY;
  if ((sX != 1.0f) || (sY != 1.0f)) {
    m.postScale(sX, sY);
    final float sPX = -(pX / w) * ((sX * w) - w);
    final float sPY = -(pY / h) * ((sY * h) - h);
    m.postTranslate(sPX, sPY);
  }
  m.postTranslate(mTranslationX, mTranslationY);
}

代码示例来源:origin: leeowenowen/beauty-of-math

private void transformMatrix(Matrix m, View view) {
  final float w = view.getWidth();
  final float h = view.getHeight();
  final boolean hasPivot = mHasPivot;
  final float pX = hasPivot ? mPivotX : w / 2f;
  final float pY = hasPivot ? mPivotY : h / 2f;
  final float rX = mRotationX;
  final float rY = mRotationY;
  final float rZ = mRotationZ;
  if ((rX != 0) || (rY != 0) || (rZ != 0)) {
    final Camera camera = mCamera;
    camera.save();
    camera.rotateX(rX);
    camera.rotateY(rY);
    camera.rotateZ(-rZ);
    camera.getMatrix(m);
    camera.restore();
    m.preTranslate(-pX, -pY);
    m.postTranslate(pX, pY);
  }
  final float sX = mScaleX;
  final float sY = mScaleY;
  if ((sX != 1.0f) || (sY != 1.0f)) {
    m.postScale(sX, sY);
    final float sPX = -(pX / w) * ((sX * w) - w);
    final float sPY = -(pY / h) * ((sY * h) - h);
    m.postTranslate(sPX, sPY);
  }
  m.postTranslate(mTranslationX, mTranslationY);
}

代码示例来源:origin: qq8585083/DragIcon

private void transformMatrix(Matrix m, View view) {
  final float w = view.getWidth();
  final float h = view.getHeight();
  final boolean hasPivot = mHasPivot;
  final float pX = hasPivot ? mPivotX : w / 2f;
  final float pY = hasPivot ? mPivotY : h / 2f;
  final float rX = mRotationX;
  final float rY = mRotationY;
  final float rZ = mRotationZ;
  if ((rX != 0) || (rY != 0) || (rZ != 0)) {
    final Camera camera = mCamera;
    camera.save();
    camera.rotateX(rX);
    camera.rotateY(rY);
    camera.rotateZ(-rZ);
    camera.getMatrix(m);
    camera.restore();
    m.preTranslate(-pX, -pY);
    m.postTranslate(pX, pY);
  }
  final float sX = mScaleX;
  final float sY = mScaleY;
  if ((sX != 1.0f) || (sY != 1.0f)) {
    m.postScale(sX, sY);
    final float sPX = -(pX / w) * ((sX * w) - w);
    final float sPY = -(pY / h) * ((sY * h) - h);
    m.postTranslate(sPX, sPY);
  }
  m.postTranslate(mTranslationX, mTranslationY);
}

代码示例来源:origin: sharish/CreditCardView

camera.rotateZ(degrees);

代码示例来源:origin: jinguangyue/Android-CustomCamera

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  float deg = 0.0F + 360.0F * interpolatedTime;
  Matrix matrix = t.getMatrix();
  mCamera.save();
  if (mMode == Mode.X)
    mCamera.rotateX(deg);
  if (mMode == Mode.Y)
    mCamera.rotateY(deg);
  if (mMode == Mode.Z)
    mCamera.rotateZ(deg);
  mCamera.getMatrix(matrix);
  mCamera.restore();
  matrix.preTranslate(-mCenterX, -mCenterY);
  matrix.postTranslate(mCenterX, mCenterY);
}

代码示例来源:origin: skydoves/Medal

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  float xDegrees = degreeX * interpolatedTime;
  float yDegrees = degreeY * interpolatedTime;
  float zDegrees = degreeZ * interpolatedTime;
  final Matrix matrix = t.getMatrix();
  camera.save();
  camera.rotateX(xDegrees);
  camera.rotateY(yDegrees);
  camera.rotateZ(zDegrees);
  camera.getMatrix(matrix);
  camera.restore();
  matrix.preTranslate(-this.width, -this.height);
  matrix.postTranslate(this.width, this.height);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  @Override
  protected void applyTransformation(
      float interpolatedTime,
      Transformation t) {
    final Matrix matrix = t.getMatrix();
    mCamera.save();

    mCamera.translate(mX * interpolatedTime, mY * interpolatedTime, mZ * interpolatedTime);

    mCamera.rotateX(mRotateX * interpolatedTime);
    mCamera.rotate(0, mRotateY * interpolatedTime, 0);
    mCamera.rotateZ(mRotateZ * interpolatedTime);

    // 将旋转变换作用到matrix上
    mCamera.getMatrix(matrix);
    mCamera.restore();
    System.out.println("mRotateX:___" + mRotateX + "\t mRotateY:" + mRotateY + "\t mRotateZ:" + mRotateZ);
    System.out.println("camera x:" + mCamera.getLocationX() + "\t y:" + mCamera.getLocationY() + "\t z:" + mCamera.getLocationZ());
    System.out.println("Matrix:___" + matrix.toString());

    // 通过pre方法设置矩阵作用前的偏移量来改变旋转中心
//        matrix.preTranslate(mCenterWidth, mCenterHeight);
//        matrix.postTranslate(-mCenterWidth, -mCenterHeight);
  }
}

代码示例来源:origin: PopFisher/AndroidRotateAnim

camera.rotateY(degrees);
} else {
  camera.rotateZ(degrees);

代码示例来源:origin: GcsSloop/ViewSupport

break;
case 3:
  mCamera.rotateZ(degrees);
  break;

代码示例来源:origin: stackoverflow.com

camera.rotateX(rX);
camera.rotateY(rY);
camera.rotateZ(-rZ);
camera.getMatrix(m);
camera.restore();

相关文章