假设我有两个位图,我想在Canvas
的{{1}}上绘制。扭曲是我想要绘制第一个位图绕一个轴点顺时针旋转30度,我想将另一个位图逆时针旋转45度绕另一个轴点。
我记得以下存根:
View
编辑:
确认它不起作用。它只会导致旋转相同的画布。
我是否必须创建2 canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.rotate(30, pivotX, pivotY);
canvas.drawBitmap(bitmapOne, x1, y1, antiAliasPaint);
canvas.rotate(-75, otherPivotX, otherPivotY);
canvas.drawBitmap(bitmapTwo, x2, y2, antiAliasPaint);
canvas.restore();
s,在一个新的Bitmap
对象中旋转bitmapOne,在另一个对象中旋转bitmapTwo,并在目标画布中正常绘制它们?
答案 0 :(得分:0)
这样做:
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.rotate(30, pivotX, pivotY);
canvas.drawBitmap(bitmapOne, x1, y1, antiAliasPaint);
canvas.restore();
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.rotate(-75, otherPivotX, otherPivotY);
canvas.drawBitmap(bitmapTwo, x2, y2, antiAliasPaint);
canvas.restore();