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);
}
我使用此功能旋转矩形。但结果是一个更大的矩形!
我打电话
rotateRect(55, stickRect.centerX(), stickRect.centerY(), stickRect);
这就是我得到的: