patrickfav/Dali

Crash when using HARDWARE bitmap

Aberta

#20 aberto em 12 de jun. de 2020

 (4 comentários) (0 reação) (0 responsável)Java (94 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (1.050 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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) 

Guia do colaborador