欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

Android缩放图片 Matrix,,int bmpWidth

来源: javaer 分享于  点击 22575 次 点评:150

Android缩放图片 Matrix,,int bmpWidth


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);
相关栏目:

用户点评