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

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

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

Camera.rotate介绍

暂无

代码示例

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

@Override
public void rotate(float x, float y, float z) {
  super.rotate(-x, -y, z);
}

代码示例来源: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: fengivy/Weather

private void drawHead(Canvas canvas) {
  canvas.save();
  mCamera.save();
  mCamera.rotate(bombTBRotate,0,-bombLRRotate);
  mMatrix.reset();
  mCamera.getMatrix(mMatrix);
  mCamera.restore();
  mMatrix.preTranslate(-bombCenterX,-(bombCenterY));
  mMatrix.postTranslate(bombCenterX,(bombCenterY));
  canvas.concat(mMatrix);
  mPaint.setStrokeWidth(bombLineWidth*0.8f);
  //内部
  mPaint.setColor(bombColor);
  mPaint.setStyle(Paint.Style.FILL);
  canvas.drawPath(mHeadPath,mPaint);
  //边框
  mPaint.setColor(bombLineColor);
  mPaint.setStyle(Paint.Style.STROKE);
  canvas.drawPath(mHeadPath,mPaint);
  mPaint.setStrokeWidth(bombLineWidth);
  canvas.restore();
}

代码示例来源:origin: fengivy/Weather

private void drawFace(Canvas canvas) {
  canvas.save();
  mCamera.save();
  mCamera.rotate(bombTBRotate,0,-bombLRRotate/3);
  mMatrix.reset();
  mCamera.getMatrix(mMatrix);

代码示例来源:origin: fengivy/Weather

private void drawHeadLine(Canvas canvas) {
  canvas.save();
  mCamera.save();
  mCamera.rotate(bombTBRotate,0,-bombLRRotate);
  mMatrix.reset();
  mCamera.getMatrix(mMatrix);

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

@Override
public void draw(Canvas canvas) {
 if (mDirection == DIRECTION_LEFT) {
  Camera camera = new Camera();
  camera.translate(mWidth, 0, 0);
  camera.rotate(0, 180, 0);
  camera.applyToCanvas(canvas);
 }
 doDraw(canvas);
}

相关文章