Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RenderScript was deprecate #318

Open
frolix opened this issue Apr 12, 2023 · 1 comment
Open

RenderScript was deprecate #318

frolix opened this issue Apr 12, 2023 · 1 comment

Comments

@frolix
Copy link

frolix commented Apr 12, 2023

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

@Joe-Zap
Copy link

Joe-Zap commented Sep 18, 2023

Instructions say: "Add the library to your Android Studio project by modifying the app's build.gradle file."

Modify how? Add a dependency? What should it say?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants