Last active
August 29, 2015 14:12
-
-
Save ollien/e2cff6d47b8c18b8ef4e to your computer and use it in GitHub Desktop.
Draw Circular Bitmap
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
Bitmap profileBitmap = BitmapFactory.decodeStream(connection.getInputStream()); | |
Bitmap finalBitmap = Bitmap.createBitmap(profileBitmap.getWidth(),profileBitmap.getHeight(),Bitmap.Config.ARGB_8888); | |
Canvas canvas = new Canvas(finalBitmap); | |
Path p = new Path(); | |
p.addCircle(profileBitmap.getHeight()/2,profileBitmap.getHeight()/2,profileBitmap.getWidth()/2,Path.Direction.CCW); | |
canvas.clipPath(p);; | |
canvas.drawBitmap(profileBitmap,new Rect(0,0,profileBitmap.getHeight(),profileBitmap.getWidth()),new Rect(0,0,profileBitmap.getHeight(),profileBitmap.getWidth()),null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment