I recently learned that there is no hard limit on the amount of memory that NDK code can allocate in contrast to the very limited amount of memory (~ 25 MB on most devices) that you can allocate on the Java side.
I want to write an image processing application (something like Photoshop), which should contain several large bitmap images in memory at once, where bitmap data will occupy ~ 20 MB of memory. Doing this in Java makes the application prone to memory exceptions on many devices that I have tried.
All of my current code uses the Bitmap and Canvas class to do my image manipulations. Can someone suggest some way that allows me to allocate most of my memory on the C side and still use Bitmap + Canvas to do my drawing operations (using Android 2.1 and above)?
As an example, if my image consists of 6 raster layers and the user draws at level 3, I need to draw a red-red raster image at level 3, and then refresh the screen to show the result of smoothing all the layers on each friend in real time. I looked at something along the line of highlighting my 6 bitmaps in C as int arrays and performing a drawing operation on the Java side using Canvas using a copy of the editable layer stored in the Bitmap object. I'm not sure how flattening will work.
java c android android-ndk
botbot
source share