In BlackBerry, is it better to use the Bitmap class or EncodedImage in terms of memory usage and performance? Are there any specific tips on using these classes?
+4
A:
My observation is that better:
- use Bitmap and drawBitmap for elements that require repaint often (ex background image in games)
Maybe it's because Bitmap is a raw format so no performance hit for decoding EncodedImage before drawImage. On the other side, GIF animation works perfectly with EncodedImage.
- use EncodedImage for animation or for a large amount of resources (ex photos or decore elements)
When you load Bitmap from gif, png, jpg formats they will be opened as an EncodedImage anyway, and if you do this many times, it may beat performance (ex 50 seconds to load 14 png from resources to Bitmaps on bold, avg size 80 kb, tuned up to 2 seconds loading into EncodedImages)
UPDATE stated by Fostah EncodedImage has a getBitmap() function that you can use to convert any EncodedImage to a Bitmap. So you can load in EncodedImage and then use as Bitmap
Max Gontar
2009-09-04 14:08:40