I have a drawing-board App and there's an "export image" function. I hope the exported image size can be as large as users want. The exporting steps are:
- create a bitmap;
- applying some transformation matrices;
- create a canvas on that bitmap and draw something on it.
- compress the bitmap and save to file
When using Java Bitmap.createBitmap, if the created bitmap is so large and the required memory reaches Android VM heap size limit, an OutOfMemoryError encountered.
To avoid the OOM error I'm considering to create a bitmap with native-allocated pixel data in JNI, and used the bitmap as a reference in Java. But so far I have no idea about how to achieve this at all even after I searched a lot.
Or if I can't do this, is there another way to draw canvas to a probably very large bitmap without OOM errors?
Thanks for any help!