ImageUtils.java 文件源码

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

项目:RLibrary 作者:
/**
 * 获取bitmap
 *
 * @param data      数据
 * @param offset    偏移量
 * @param maxWidth  最大宽度
 * @param maxHeight 最大高度
 * @return bitmap
 */
public static Bitmap getBitmap(byte[] data, int offset, int maxWidth, int maxHeight) {
    if (data.length == 0) return null;
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeByteArray(data, offset, data.length, options);
    options.inSampleSize = calculateInSampleSize(options, maxWidth, maxHeight);
    options.inJustDecodeBounds = false;
    return BitmapFactory.decodeByteArray(data, offset, data.length, options);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号