I am trying to merge 3 imageViews into one bitmap i am using canvas and here is the function
private Bitmap createSingleImageFromMultipleImages() {
Bitmap formBitmap = getBitmapFromImageView(formView);
Bitmap idFrontBitmap = getBitmapFromImageView(idFrontView);
Bitmap idBackBitmap = getBitmapFromImageView(idBackView);
Bitmap allBitmaps = null;
int width, height = 0;
width = formBitmap.getWidth() + idFrontBitmap.getWidth() + idBackBitmap.getWidth();
if (formBitmap.getHeight() > idFrontBitmap.getHeight()) {
height = formBitmap.getHeight();
} else {
height = idFrontBitmap.getHeight();
}
allBitmaps = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(allBitmaps);
comboImage.drawBitmap(formBitmap, formBitmap.getWidth(), 0f, null); //this is not drawn
comboImage.drawBitmap(idFrontBitmap, formBitmap.getWidth(), 0f, null); //this is not drawn
comboImage.drawBitmap(idBackBitmap, idFrontBitmap.getWidth(), 0f, null); //this is drawn
return allBitmaps;
}
//this converts ImageView to bitmap
public Bitmap getBitmapFromImageView(ImageView imageView) {
imageView.setDrawingCacheEnabled(true);
Bitmap scaledBitmap = imageView.getDrawingCache();
return scaledBitmap;
}
currently only one image is drawn the other parts are empty i have confirmed that the ImageView are not null
Screenshot of the result.