/**
* 多图纵向拼接 超过两张
* 需要自己判断图片是否超过两张
*/
public static Bitmap splitVerticalList(List<File> list) {
int height = 0;
int width = 0;
if (list != null && list.size() > 0) {
Bitmap bitmap = BitmapFactory.decodeFile(list.get(0).getAbsolutePath());
width = bitmap.getWidth();
for (int i = 0; i < list.size(); i++) {
Bitmap bitmap1 = BitmapFactory.decodeFile(list.get(i).getAbsolutePath());
height = height + bitmap1.getHeight();
if (bitmap1.getWidth() > width) {
width = bitmap1.getWidth();
}
}
Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
canvas.drawBitmap(bitmap, 0, 0, null);
int h = bitmap.getHeight();
for (int i = 0; i < list.size(); i++) {
if(i !=0){
Bitmap bitmap1 = BitmapFactory.decodeFile(list.get(i).getAbsolutePath());
canvas.drawBitmap(bitmap1, 0, h, null);
h = h + bitmap1.getHeight();
}
}
return result;
}
return null;
}
Android图片纵向拼接
原创mb65941af85b2fd ©著作权
©著作权归作者所有:来自51CTO博客作者mb65941af85b2fd的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章