how to merge to two bitmap one over another

后端 未结 2 1947
我在风中等你
我在风中等你 2020-12-02 23:27

I have two images and i want to save one bitmap image over another exactly at the same point where it is present i also move image using gesture .

public Bi         


        
2条回答
  •  时光取名叫无心
    2020-12-03 00:05

    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;
    }
    

提交回复
热议问题