In my application,I want to combine two bitmaps for example a leaf and its shadow, in water.I am able to combine those bitmaps and make the combined bitmap freely fall from the top of the screen with some rotation in a live wallpaper.In my combined image the shadow is a little bit below the original leaf and left to it.If the combined image is rotating with some angle,the shadow also rotates with that angle.It seems to be like that the shadow is rotating like original image. But the shadow position should be always below the original image. But some times shadow is appearing on top of the original image while the combined image is falling with rotation because they are merged.I do not want this.I want the shadow always below the original image under any instance.How can i achieve this?Please help me.I am providing my code to combine the two bitmaps.
public static Bitmap overlay(Bitmap bmp1, Bitmap bmp2) {
Bitmap bmoverlay = null;
bmoverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig());
Canvas canvas = new Canvas(bmoverlay);
canvas.drawBitmap(bmp1, null, new Rect(0, 0, canvas.getWidth() , canvas.getHeight()), null);
canvas.drawBitmap(bmp2, 20, 20, null);
return bmoverlay;
}
Please suggest me how to do or any other method which does my requirement?Thanks in advance.