2

I'm newbie with canvas.

I'm trying to draw child bitmap on parent bitmap using canvas.drawbitmap(childbitmap,matrix,point) method. I'm getting number of bitmaps using loop and trying to overlay image on all that bitmaps But somehow the output which I got haven't original child image. It looks like white image. so I'm able to seen child image on parent one but don't know why it looks like this?

Let me put my code over here with output image.

 Canvas mCanvas = new Canvas(bitmap);
 Paint p = new Paint();
 Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(),
                        R.drawable.ic_launcher);
 mCanvas.drawBitmap(icon,0,0,p);

This above code will run with loop and it will give multiple "bitmap" object on which I have to draw canvas. So now I'm taking launcher icon as child bitmap.while checking final output it shows like below image :

enter image description here

Check the white image instead of launcher icon.So what's wrong with my code?

Waiting for your best suggestion ASAP.

Jai
  • 1,974
  • 2
  • 22
  • 42

1 Answers1

0

You are drawing your bitmap on top with the current canvas. So you have to call mCanvas.drawBitmap a second time to draw the foreground bitmap.

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147