Game Development Reference
In-Depth Information
Figure 4-14.
Two Bobs on top of each other (at 480×800-pixel resolution)
LogCat reports that
bob565
indeed has the color format
Config.RGB_565
, and that
bob4444
was
converted to
Config.ARGB_4444
. The
BitmapFactory
did not fail us!
Here are some things you should take away from this section:
ï?®
Use the minimum color format that you can get away with, to conserve
memory. This might, however, come at the price of less visual quality and
slightly reduced rendering speed.
ï?®
Unless absolutely necessary, refrain from drawing bitmaps scaled. If you
know their scaled size, prescale them offline or during loading time.
Bitmap.recycle()
method if you no longer
need a
Bitmap
. Otherwise you'll get some memory leaks or run low on
memory.
ï?®
Always make sure you call the
Using LogCat all this time for text output is a bit tedious. Let's see how we can render text via
the
Canvas
.
Note
As with other classes, there's more to
Bitmap
than what we could describe in this brief
section. We covered the bare minimum we need to write Mr. Nom. If you want more information,
check out the documentation on the Android Developers site.