Am I correct in assuming that if I have an irregular shaped sprite (anything other than a square / rectangle) that needs to be drawn over a background image, I can’t use RGB565 as this format doesn’t have an alpha channel for transparency?
Does this make the RGB565 format effectively useless for the vast majority of game sprites or am I getting this wrong?
Are there any other options? Which is the best format for me to use for best performance?
I ask this because I converted my original bitmaps to RGB565 using
options.inPreferredConfig = Bitmap.Config.RGB_565;
And they appear to be OK – ie still have their transparency.
But when I try to re-colour a sprite using RGB565 it appears with a black square around it so I’m a little confused!!!!h
Thanks all
The reason your loaded RGB565 bitmaps seems to work is because if your bitmaps have alpha, they will be loaded as ARGB444 or ARGB8888. The
inPreferredConfigis only a hint that you want your bitmap in that format if possible.No conversion is made.
You can see this by calling
getConfig()on the loaded bitmaps.You can always load a bitmap with RGB565 and another as A8, and use them together, but the cost of doing this is probably higher than just using one of the ARGB formats.
So, to summarize, just use ARGB8888, or if memory is an issue, ARGB4444 (although this is deprecated)