decodeByteArray and copyPixelsToBuffer not working. SkImageDecoder::Factory returned null

前端 未结 2 985
误落风尘
误落风尘 2020-12-30 11:42

I have a class TouchPoint which implements Serializable and because it contains Bitmap I wrote writeObject and readObject for that class:

private void writeO         


        
2条回答
  •  抹茶落季
    2020-12-30 11:48

    Bitmap to byte[]:

    Bitmap bmp; // your bitmap
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
    byte[] byteArray = stream.toByteArray();
    

    Use Bufferedstreams for better performance.

提交回复
热议问题