Android縮放圖片 Matrix

4e48 9年前發布 | 985 次閱讀 Java Android

int bmpWidth = bmp.getWidth();
int bmpHeight = bmp.getHeight();
/ 設定圖片放大的比例 /
double scale = 1.25;
/ 計算這次要放大的比例 /
scaleWidth = (float) (scaleWidth  scale);
scaleHeight = (float) (scaleHeight  scale);

/ 產生reSize后的Bitmap對象 / Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); Bitmap resizeBmp = Bitmap.createBitmap(bmp, 0, 0, bmpWidth, bmpHeight, matrix, true);</pre>

 本文由用戶 4e48 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!