If you are doing a high performance game, just use OpenGL. That will give you hardware accelerated blitting of your sprites.
If you don't care about performance... well what is wrong with having a bitmap with an alpha channel? All of the graphics system is optimized to draw such bitmaps, and you also get alpha blending to be able to anti-aliasing along the edges, which greatly improves the quality of the graphics. On Sun, Mar 22, 2009 at 7:35 PM, Sarnoth <[email protected]> wrote: > > I have been frustrated by the lack of support for sprites, but I came > up with an idea that is backwards (literally) but might work. I > haven't tested it to make sure it works as expected or to evaluate its > speed. If you try it yourself I would be interested in the results. > > Use the same key color for all of your sprites. To draw a frame, clear > the canvas to the key color. Then draw each sprite starting with the > front most and ending with the back most, and finally draw the > background image. When drawing use AvoidXfermode with opColor set to > your key color, tolerance set to 0, and mode set to TARGET. Drawing > bitmaps of format 565 (no alpha channel) is by far the fastest way to > draw, so hopefully drawing color keyed bitmaps of this type will > produce nice results. > > On Mar 19, 2:23 am, Tazzer <[email protected]> wrote: > > Hi, > > > > I am working on a 2d library for creating a game including sprite > > collisions, sorting and animation converting (.spr to Java classes/ > > bmp's). > > > > At first I used png's with the background color being transparant (24 > > bits png image) but I want to use 256 color bitmaps with the > > background color being transparant. > > > > Is this possible to do color keying in android? I looked at several > > other threads about this topic but the all ended without a solution. > > > > Also I am now using the canvas.drawBitmap to render my sprites, but > > will using opengl be faster? > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

