1. 程式人生 > >Android bitmap旋轉、平移簡單幾何變換很方便

Android bitmap旋轉、平移簡單幾何變換很方便

1.順時針旋轉90度

byte[] tmp = os.toByteArray();
Bitmap bmpt = BitmapFactory.decodeByteArray(tmp, 0,tmp.length);
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap bmp = Bitmap.createBitmap(bmpt, 0,0,bmpt.getWidth(),  bmpt.getHeight(), matrix, false);