Android Bitmap 常用摘要
时间:2014-07-09 19:15:58
收藏:0
阅读:231
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);
}
评论(0)