Android使用矩阵围绕备用轴旋转

时间:2012-11-07 03:35:06

标签: android matrix bitmap rotation

我正在使用matrix.rotate(deg, fx,fy)方法旋转图片。

图片有一个alpha频道,右侧角落只有一些视觉效果。我想旋转画布,使用matrix创建新图像,并使可视部分成为旋转的唯一部分。

图像旋转但不围绕所需的axis旋转。它总是围绕对象的原始宽度旋转。

以下是我使用的代码:

Matrix matrix = new Matrix();

matrix.setRotate(rotation, xPivot, yPivot);
Bitmap pic1a = Bitmap.createBitmap(pic1, 0, 0, pic1.getWidth(), pic1.getHeight(), matrix, true);

这会正确旋转图像,但似乎只在原始画布的相同位置旋转。 我想要的是图像旋转(xPivot,yPivot)成为显示器上的中心位置。

0 个答案:

没有答案
相关问题