ThumbnailUtil.java 文件源码

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

项目:financisto1-holo 作者:
/**
 * Creates a centered bitmap of the desired size.
 * @param source
 * @param recycle whether we want to recycle the input
 */
public static Bitmap extractMiniThumb(
        Bitmap source, int width, int height, boolean recycle) {
    if (source == null) {
        return null;
    }

    float scale;
    if (source.getWidth() < source.getHeight()) {
        scale = width / (float) source.getWidth();
    } else {
        scale = height / (float) source.getHeight();
    }
    Matrix matrix = new Matrix();
    matrix.setScale(scale, scale);
    Bitmap miniThumbnail = transform(matrix, source, width, height, true, recycle);
    return miniThumbnail;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号