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

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

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

Camera.applyToCanvas介绍

暂无

代码示例

代码示例来源:origin: hencoder/PlusDemo

@Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvas.save();
    canvas.translate( (OFFSET + IMAGE_SIZE / 2),  (OFFSET + IMAGE_SIZE / 2));
    camera.applyToCanvas(canvas);
    canvas.translate(- (OFFSET + IMAGE_SIZE / 2), - (OFFSET + IMAGE_SIZE / 2));
    canvas.drawBitmap(bitmap, OFFSET, OFFSET, paint);
    canvas.restore();
  }
}

代码示例来源:origin: hencoder/PracticeDraw4

@Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvas.save();
    camera.save();
    camera.rotateX(30);
    camera.applyToCanvas(canvas);
    camera.restore();
    canvas.drawBitmap(bitmap, point1.x, point1.y, paint);
    canvas.restore();

    canvas.save();
    camera.save();
    camera.rotateY(30);
    camera.applyToCanvas(canvas);
    camera.restore();
    canvas.drawBitmap(bitmap, point2.x, point2.y, paint);
    canvas.restore();
  }
}

代码示例来源:origin: hencoder/PlusDemo

canvas.translate(offset, offset);
canvas.rotate(-flipRotation);
camera.applyToCanvas(canvas);
canvas.clipRect(0, -IMAGE_SIZE, -IMAGE_SIZE, IMAGE_SIZE);
canvas.rotate(flipRotation);
canvas.translate(offset, offset);
canvas.rotate(-flipRotation);
camera.applyToCanvas(canvas);
canvas.clipRect(0, -IMAGE_SIZE, IMAGE_SIZE, IMAGE_SIZE);
canvas.rotate(flipRotation);

代码示例来源:origin: hencoder/PracticeDraw4

@Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    int bitmapWidth = bitmap.getWidth();
    int bitmapHeight = bitmap.getHeight();
    int centerX = getWidth() / 2;
    int centerY = getHeight() / 2;
    int x = centerX - bitmapWidth / 2;
    int y = centerY - bitmapHeight / 2;

    canvas.save();

    camera.save();
    camera.rotateX(degree);
    canvas.translate(centerX, centerY);
    camera.applyToCanvas(canvas);
    canvas.translate(-centerX, -centerY);
    camera.restore();

    canvas.drawBitmap(bitmap, x, y, paint);
    canvas.restore();
  }
}

代码示例来源:origin: sunnyxibei/HenCoderPractice

canvas.rotate(-degreeZ);
camera.rotateY(degreeY);
camera.applyToCanvas(canvas);
camera.applyToCanvas(canvas);
canvas.rotate(degreeZ);
canvas.translate(-centerX, -centerY);

代码示例来源:origin: CoderLengary/WanAndroid

canvas.rotate(-canvasDegree);
camera.rotateY(rightCameraDegree);
camera.applyToCanvas(canvas);
canvas.clipRect(0, -height, width, height);
canvas.rotate(canvasDegree);
canvas.rotate(-canvasDegree);
camera.rotateY(leftCameraDegree);
camera.applyToCanvas(canvas);
canvas.clipRect(-width, -height, 0, height);
canvas.rotate(canvasDegree);

代码示例来源:origin: hencoder/PracticeDraw4

camera.rotateX(degree);
canvas.translate(centerX, centerY);
camera.applyToCanvas(canvas);
canvas.translate(-centerX, -centerY);
camera.restore();

代码示例来源: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);
}

相关文章