RenderScript was deprecate

Open
#318 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
android, kotlin

Research direction

Start in WorkerUtils.kt at fun blurBitmap and read the linked RenderScript migration instructions. Add the renderscript-toolkit module from the referenced repository to this Codelab project, then update the blur implementation as described in the issue. Done means the project builds and blurBitmap uses the replacement toolkit instead of RenderScript.

Written by the indexing model from the issue text.

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

Dominant language
Kotlin
Stars
557
Forks
242
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/codelab-android-workmanager

All issues in android/codelab-android-workmanager

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.