Skip to content

Instantly share code, notes, and snippets.

@naqi
Created November 8, 2016 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naqi/4f3dda132915c82972b4174d09f136ce to your computer and use it in GitHub Desktop.
Save naqi/4f3dda132915c82972b4174d09f136ce to your computer and use it in GitHub Desktop.
render script blur
//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