Immutable bitmap crash error

前端 未结 5 983
故里飘歌
故里飘歌 2020-12-02 10:58
java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor
at android.graphics.Canvas.(Canvas.java:127)
at app.test.canvas.StartActiv         


        
5条回答
  •  我在风中等你
    2020-12-02 11:40

    Unless you don't want to make your IMMUTABLE bitmap to MUTABLE bitmap, you can save memory by ALWAYS REUSING THE BITMAP

    workingBitmap = workingBitmap.copy(Bitmap.Config.ARGB_8888, true);
    Canvas canvas = new Canvas(workingBitmap);
    

    However I think this may be same as making the bitmap mutable by calling

    workingBitmap.isMutable = true
    

提交回复
热议问题