//获取涂鸦板截屏
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的画布,然后将内容画一遍。