java - Bitmap/Canvas use and the NDK -
i've found out there no hard limit amount of memory ndk code can allocate in contrast heavily limited amount of memory (~25mb on devices) can allocate on java side.
i want write image processing app (something photoshop) needs keep several large bitmaps in memory @ once bitmap data take ~20mb of memory. doing in java makes app prone out of memory exceptions on many devices i've tried.
all current code makes use of bitmap , canvas class doing image manipulations. can suggest way allows me allocate of memory on c side , still make use of bitmap+canvas performing drawing operations (using android 2.1 , above)?
as example, if image composed of 6 bitmap layers , user painting on 3rd layer, need draw paint blob bitmap 3rd layer , update screen show result of flattening layers on top of each other in real time. i've considered along lines of allocating 6 bitmaps in c int arrays , performing painting operation on java side canvas using copy of layer being edited stored in bitmap object. i'm not sure how flattening stage going work though.
check out "bitmap-plasma" sample in ndk. creates bitmap in java , manipulates bits in native code. 1 possible technique can allocate large blocks of memory , hold images in native code , render "view" java-created bitmap. method render view , "flattening" of image layers should done in native code. along lines of:
...user changed layer...
my_native_render_code(mydisplaybitmap);
invalidate();
Comments
Post a Comment