-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
In WorkerUtils.kt fun blurBitmap
Change code
rsContext = RenderScript.create(applicationContext, RenderScript.ContextType.DEBUG)
val inAlloc = Allocation.createFromBitmap(rsContext, bitmap)
val outAlloc = Allocation.createTyped(rsContext, inAlloc.type)
val theIntrinsic = ScriptIntrinsicBlur.create(rsContext, Element.U8_4(rsContext))
theIntrinsic.apply {
setRadius(10f)
theIntrinsic.setInput(inAlloc)
theIntrinsic.forEach(outAlloc)
}
outAlloc.copyTo(output)
to
var blurredBitmap: Bitmap? = Toolkit.blur(bitmap,25)
return blurredBitmap!!
Instruction to migrate
https://developer.android.com/guide/topics/renderscript/migrate
You just need to download the project, get the renderscript-toolkit module and add it to this Codelab project.
https://github.com/android/renderscript-intrinsics-replacement-toolkit
Metadata
Metadata
Assignees
Labels
No labels