Android Rect旋转

时间:2015-10-09 07:24:01

标签: android matrix rotation rect

public static void rotateRect(final int degrees, final int px, final int py, final Rect rect) {
    final RectF rectF = new RectF(rect);
    final Matrix matrix = new Matrix();
    matrix.setRotate(degrees, px, py);
    matrix.mapRect(rectF);
    rect.set((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
}

我使用此功能旋转矩形。但结果是一个更大的矩形!

这是最初的矩形: enter image description here

我打电话

rotateRect(55, stickRect.centerX(), stickRect.centerY(), stickRect);

这就是我得到的:

enter image description here

0 个答案:

没有答案