首页 > 其他 > 详细

//--合并两张图片 BITMAP

时间:2017-05-31 16:18:38      阅读:236      评论:0      收藏:0      [点我收藏+]
private Bitmap toConformBitmap(Bitmap background, Bitmap foreground) {
//--合并两张图片
if( background == null ) {
return null;
}
int bgWidth = background.getWidth();
int bgHeight = background.getHeight();
//int fgWidth = foreground.getWidth();
//int fgHeight = foreground.getHeight();
//create the new blank bitmap 创建一个新的和SRC长度宽度一样的位图
Bitmap newbmp = Bitmap.createBitmap(bgWidth, bgHeight, Bitmap.Config.ARGB_8888);
Canvas cv = new Canvas(newbmp);
//draw bg into
cv.drawBitmap(background, 0, 0, null);//在 0,0坐标开始画入bg
//draw fg into
cv.drawBitmap(foreground, 0, 0, null);//在 0,0坐标开始画入fg ,可以从任意位置画入
//save all clip
cv.save(Canvas.ALL_SAVE_FLAG);//保存
//store
cv.restore();//存储
return newbmp;
}

//--合并两张图片 BITMAP

原文:http://www.cnblogs.com/hui413027075/p/6924504.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!