FileUtils.java 文件源码

java
阅读 41 收藏 0 点赞 0 评论 0

项目:letv 作者:
public static Bitmap getBitmapByPath(String filename) {
    if (!checkFileIsEnabledPath(filename)) {
        return null;
    }
    Options newOpts = new Options();
    newOpts.inJustDecodeBounds = true;
    Bitmap bitmap = BitmapFactory.decodeFile(filename, newOpts);
    int w = newOpts.outWidth;
    int h = newOpts.outHeight;
    if (bitmap != null) {
        bitmap.recycle();
    }
    int be = 1;
    if (w > h && ((float) w) > 300.0f) {
        be = (int) (((float) newOpts.outWidth) / 300.0f);
    } else if (w < h && ((float) h) > 400.0f) {
        be = (int) (((float) newOpts.outHeight) / 400.0f);
    }
    if (be <= 0) {
        be = 1;
    }
    Options newOpts2 = new Options();
    newOpts2.inSampleSize = be;
    newOpts2.inJustDecodeBounds = false;
    return BitmapFactory.decodeFile(filename, newOpts2);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号