2010-11-10 128 views

回答

7

您可以使用矩陣進行旋轉。首先你設置位置(我正在使用位圖中心的座標)。然後應用旋轉。然後使用你的矩陣繪製。

Matrix transform = new Matrix(); 
    transform.setTranslate(xOfCentre, yOfCentre); 
    transform.preRotate(turnDegrees, width/2, height/2); 
    canvas.drawBitmap(bitmap, transform, null); 

如果您希望將車削變成動畫,請參見my answer to "animating and rotating an image..."

+0

在這個例子中,xOfCentre和yOfCentre會是什麼? – 2012-02-17 14:42:22

+0

我相信他們是旋轉點(樞軸)的座標。 – idbrii 2012-02-24 21:59:25