Created
April 15, 2018 08:38
-
-
Save EmmanuelGuther/891ab95e9f10477494ea5fdda02aae26 to your computer and use it in GitHub Desktop.
Kotlin function to transform bitmap into roundedBitmap
This file contains hidden or 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
fun roundedBitmap(bitmap: Bitmap): RoundedBitmapDrawable { | |
val roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(Resources.getSystem(), bitmap) | |
roundedBitmapDrawable.isCircular = true | |
roundedBitmapDrawable.cornerRadius = Math.max(bitmap.width, bitmap.height) / 2.0f | |
return roundedBitmapDrawable | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment