2013-01-09 66 views
2

捕獲的圖像存儲在景觀位置,所以我想改變它Potrait。如何在Android中旋轉圖像而不使用位圖?

如何在不使用位圖的情況下做到這一點? 如果我使用下面的代碼圖像得到破壞。所以只有我想使用位圖。

我的代碼是:

Bitmap Out = null; 
Bitmap Output = null; 

Out = BitmapFactory.decodeByteArray(data, 0, data.length); 
int w = Out.getWidth(); 
int h = Out.getHeight(); 
Matrix mtx = new Matrix(); 
mtx.postRotate(90); 

      Output = Bitmap.createBitmap(Out, 0, 0, w, h, mtx, true); 
       image = bitmaptoByte(Output); 
+1

,如果它在一個佈局,你可以申請一個動畫,但如果你想要實際的圖像旋轉,你必須通過位圖使用。 – Budius

+0

你可以告訴相機以指定的方向保存圖像,但我沒有找到這個屬性 –

+0

@Budius如果我使用位圖圖像得到破壞。所以只有我想要沒有位圖。 – Baskar

回答

0

看那RotateAnimation 例如,我在旋轉秒針:

public RotateAnimation createAnimation(float time) { 
     RotateAnimation rotateAnimation = new RotateAnimation(time, time, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f); 
     rotateAnimation.setFillAfter(true); 
     return rotateAnimation; 

    public void runSec(float shour) { 
     csecond.startAnimation(createAnimation(shour*6)); 
    }