Created
November 8, 2016 04:37
-
-
Save naqi/4f3dda132915c82972b4174d09f136ce to your computer and use it in GitHub Desktop.
render script blur
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
//Render script blur | |
layout_content.isDrawingCacheEnabled = true | |
val bitmap = Bitmap.createBitmap(layout_content.drawingCache) | |
layout_content.isDrawingCacheEnabled = false | |
val rs = RenderScript.create(this@FGSimpleRound) | |
val input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE, | |
Allocation.USAGE_SCRIPT) | |
val output = Allocation.createTyped(rs, input.getType()) | |
val script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)) | |
script.setRadius(25f) | |
script.setInput(input) | |
script.forEach(output) | |
output.copyTo(bitmap) | |
iv_dialog_bg.setImageBitmap(bitmap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment