/**
* 计算缩放比例
* @param options
* @param reqWidth
* 目标宽
* @param reqHeight
* 目标高
* @return
*/
private int calculateInSampleSize(Options options,
int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (reqWidth == 0 || reqHeight == 0) {
return inSampleSize;
}
if (height > reqHeight || width > reqWidth) {
if (width > height) {
inSampleSize = Math.round((float) height / (float) reqHeight);
} else {
inSampleSize = Math.round((float) width / (float) reqWidth);
}
}
Log.d("", "原图尺寸:" + width + "x" + height + ",实际尺寸:" + reqWidth + "x"
+ reqHeight + ",inSampleSize = " + inSampleSize);
return inSampleSize;
}
BitmapUtil.java 文件源码
java
阅读 53
收藏 0
点赞 0
评论 0
项目:FreeStreams-TVLauncher
作者:
评论列表
文章目录