0

I mixed two bitmap's and I try to get a bitmap result. I had the good result with the canvas, but I don't know how to get a bitmap from canvas, or more generally how to mix two bitmaps to get one bitmap?

Bitmap bottomImage;
int cnt = 1;
int imageResource = mContext.getResources().getIdentifier("white", "drawable", mContext.getPackageName());
bottomImage = BitmapFactory.decodeResource(mContext.getResources(), imageResource).copy(Bitmap.Config.ARGB_8888, true);
Bitmap topImage;
File imgFile = new  File(LoginActivity.getAppContext().getFilesDir() + "/NTA/APP/icones/" + obj.get("ICONE") + ".png");
if(imgFile.exists()) {
topImage = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
topImage = replaceColor(topImage, Color.WHITE, Color.BLACK);
topImage = replaceColor(topImage, Color.GRAY, Color.BLACK);
topImage = replaceColor(topImage, Color.DKGRAY, Color.BLACK);
topImage = replaceColor(topImage, Color.LTGRAY, Color.BLACK);
topImage = AlphaToBlack(topImage);

int height = (int) (topImage.getHeight());
int width = (int) (topImage.getWidth());

bottomImage = resizeBitmap(bottomImage, width, height);
Canvas comboImage = new Canvas(bottomImage);
comboImage.drawBitmap(topImage, 3f, 0f, null);

How to get the Bitmap from the Canvas ? Image of Canvas

Thanks in advance.

ΩlostA
  • 2,501
  • 5
  • 27
  • 63

0 Answers0