API 26 adds new option Bitmap.Config.HARDWARE:
Special configuration, when bitmap is stored only in graphic memory. Bitmaps in this configuration are always immutable. It is optimal for cases, when the only operation with the bitmap is to draw it on a screen.
Questions that aren't explained in docs:
- Should we ALWAYS prefer now
Bitmap.Config.HARDWAREoverBitmap.Config.RGB_565when speed is of top priority and quality and mutability are not (e.g. for thumbnails, etc)? - Does pixel data after decoding using this option actually NOT
consume ANY heap memory and resides in GPU memory only? If so, this seems
to finally be a relief for
OutOfMemoryExceptionconcern when working with images. - What quality compared to RGB_565, RGBA_F16 or ARGB_8888 should we expect from this option?
- Is speed of decoding itself the same/better/worth compared to decoding with RGB_565?
- (Thanks @CommonsWare for pointing to it in comments) What would
happen if we exceed GPU memory when decoding an image using this
option? Would some exception be thrown (maybe the same
OutOfMemoryException:)?