how to compose(combine) two photo image in android?

后端 未结 1 997
醉梦人生
醉梦人生 2021-01-06 10:02

Hello I need to make DRM Image file using two image file. originally I was use bufferedImage class, but android is not support bufferedImage.

so please help me. how

1条回答
  •  有刺的猬
    2021-01-06 10:44

    You can do that if you overlay two images. Suppose that bmp1 is bigger one (to be protected), and bmp2 is marker:

    private Bitmap overlayMark(Bitmap bmp1, Bitmap bmp2) 
    { 
        Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig()); 
        Canvas canvas = new Canvas(bmOverlay); 
        canvas.drawBitmap(bmp1, 0, 0, null);
        canvas.drawBitmap(bmp2, distanceLeft, distanceTop, null);
        return bmOverlay; 
    } 
    

    distanceLeft and distanceTop define position of the marker.

    0 讨论(0)
提交回复
热议问题