Created
July 12, 2013 10:03
-
-
Save sunwicked/5983305 to your computer and use it in GitHub Desktop.
A small snippet for overlapping images and merging them into one. Adjust size and position of bitmap as you want
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Bitmap overlay(Bitmap baseBitmap, Bitmap bmp2) { | |
Rect dst = new Rect(); | |
final Bitmap bitmapMan = Bitmap.createBitmap(baseBitmap.getWidth(), | |
baseBitmap.getHeight(), baseBitmap.getConfig()); | |
final Canvas canvas = new Canvas(bitmapMan); | |
canvas.drawBitmap(baseBitmap, new Matrix(), null); | |
dst.set(bitmapMan.getWidth() / 4, bitmapMan.getHeight() / 4, | |
bitmapMan.getWidth() * 3 / 4, bitmapMan.getHeight() * 3 / 4); | |
canvas.drawBitmap(bmp2, null, dst, null); | |
return bitmapMan; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment