- Bitmap.createScaledBitmap() always returns a bitmap of type RGB_565, regardless of the source bitmap. See http://code.google.com/p/android/issues/detail?id=13038
- ARGB_4444 is now depreciated, so you'll always need to use ARGB_8888 if you want to store transparency information.
- When using BitmapFactory.decodeFile(), always try to pass a BitmapFactory.Options().inPreferredConfig to ensure you get a bitmap in the format you need. By default, bitmaps loaded this way are always immutable (uneditable), so you'll need to do a Bitmap.copy() if you need to make it mutable.
- Bitmap.recycle() is ALWAYS required; if you create a bitmap but don't recycle when you're finished with it, expect to run out of memory eventually. Setting bitmaps to null isn't necessary.
The trials and tribulations of an amateur game programmer. Please tell him where he is going wrong.
Thursday, January 19, 2012
Android Bitmap Idiosyncrasies
Whilst improving my Android app Chromakey Photo Edit, I've come across a few idiosyncrasies with Android Bitmaps which I thought I'd share for reference:-
Subscribe to:
Posts (Atom)