且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何合并两个位图一个比另一个

更新时间:2022-05-29 07:09:37

您可以将两个位图这样的

you can combine two bitmaps like this

public static Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {
    Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
    Canvas canvas = new Canvas(bmOverlay);
    canvas.drawBitmap(bmp1, new Matrix(), null);
    canvas.drawBitmap(bmp2, 0, 0, null);
    return bmOverlay;
}