/**
* 合并Bitmap
*
* @param bgd 背景Bitmap
* @param fg 前景Bitmap
* @return 合成后的Bitmap
*/
public static Bitmap combineImages(Bitmap bgd, Bitmap fg) {
Bitmap bmp;
int width = bgd.getWidth() > fg.getWidth() ? bgd.getWidth() : fg
.getWidth();
int height = bgd.getHeight() > fg.getHeight() ? bgd.getHeight() : fg
.getHeight();
bmp = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Paint paint = new Paint();
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_ATOP));
Canvas canvas = new Canvas(bmp);
canvas.drawBitmap(bgd, 0, 0, null);
canvas.drawBitmap(fg, 0, 0, paint);
return bmp;
}
XBitmapUtils.java 文件源码
java
阅读 42
收藏 0
点赞 0
评论 0
项目:XFrame
作者:
评论列表
文章目录