Created
July 27, 2014 09:06
-
-
Save jingle1267/42ba5992e0e5d4ab773b to your computer and use it in GitHub Desktop.
blog_irregular_shapes_part_1
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 combineImages(Bitmap bgd, Bitmap fg) { | |
Bitmap bmp; | |
int width = bgd.getWidth() > fg.getWidth() ? | |
bgd.getWidth() : fg.getWidth(); | |
int height = bgd.getHeight() > fg.getHeight() ? | |
bgd.getHeight() : fg.getHeight(); | |
bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); | |
Paint paint = new Paint(); | |
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP)); | |
Canvas canvas = new Canvas(bmp); | |
canvas.drawBitmap(bgd, 0, 0, null); | |
canvas.drawBitmap(fg, 0, 0, paint); | |
return bmp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment