ImageUtils.java 文件源码

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

项目:gamesboard 作者:
public static Bitmap createBitmap(InputStream in, int w, int h, boolean closeStream) {
        if (in == null) {
            return null;
        }
        com.larvalabs.svgandroid.SVG svg;
        svg = new SVGBuilder().readFromInputStream(in).build();

        Bitmap bitmap = Bitmap.createBitmap(w, h, Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        Picture pic = svg.getPicture();
//        svg.renderToCanvas(canvas/*, new RectF(0f, 0f, (float)w, (float)h)*/);
//        svg.renderToCanvas(canvas, new RectF(0f, 0f, (float)w, (float)h));
        canvas.drawPicture(pic, new Rect(0, 0, w, h));
        if (closeStream) {
            try {
                in.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return bitmap;
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号