android 截取canvas内容生成bitmap图片

    //获取涂鸦板截屏
    public Bitmap getBitmap() {
        Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        if(currentPath != null) {
            drawHistoryActions(canvas, currentPath);
        }else{
            drawHistoryActions(canvas);
        }
        return bitmap;
    }

如上是我的涂鸦板截屏生成bitmap的方法,实现思路就是将一张只有宽高的空白bitmap,作为canvas的画布,然后将内容画一遍。

发布了73 篇原创文章 · 获赞 30 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/yonghuming_jesse/article/details/91045655
今日推荐