1、缩放
public Bitmap scalingBitmap(Bitmap bitmap, int newW, int newH) { int w = bitmap.getWidth(); int h = bitmap.getHeight(); float sx = (float) newW / w; float sy = (float) newH / h; Matrix matrix = new Matrix(); matrix.postScale(sx, sy); // 长和宽放大缩小的比例 return Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true); }
Android Bitmap 常用摘要
时间: 2024-10-28 10:25:25