Skip to content

Crash when using HARDWARE bitmap #20

@diegor2

Description

@diegor2
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        GlobalScope.launch(Dispatchers.IO) {
            val url = "https://upload.wikimedia.org/wikipedia/commons/a/ad/Gretag-Macbeth_ColorChecker.jpg"
            val stream = URL(url).openStream()
            val bitmap = BitmapFactory.decodeStream(stream)
                .copy(Bitmap.Config.HARDWARE, false)

            Dali.create(this@MainActivity)
                .load(bitmap)
                .skipCache()
                .blurRadius(12)
                .into(image);
        }
    }
}
2020-06-12 20:31:48.532 23211-23211/com.example.myapplication E/BlurBuilder: Could not set into imageview
    at.favre.lib.dali.builder.exception.BlurWorkerException: androidx.renderscript.RSInvalidStateException: Bad bitmap type: HARDWARE
        at at.favre.lib.dali.builder.blur.BlurWorker.process(BlurWorker.java:153)
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:48)
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:27)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:798)
     Caused by: androidx.renderscript.RSInvalidStateException: Bad bitmap type: HARDWARE
        at androidx.renderscript.Allocation.elementFromBitmap(Allocation.java:2654)
        at androidx.renderscript.Allocation.typeFromBitmap(Allocation.java:2659)
        at androidx.renderscript.Allocation.createFromBitmap(Allocation.java:2696)
        at androidx.renderscript.Allocation.createFromBitmap(Allocation.java:2749)
        at at.favre.lib.dali.blur.algorithms.RenderScriptGaussianBlur.blur(RenderScriptGaussianBlur.java:24)
        at at.favre.lib.dali.builder.blur.BlurWorker.process(BlurWorker.java:129)
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:48) 
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:27) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:798) 

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions