A very interesting idea :) although I have my doubts that drawing with AvoidXfermode is not slower then drawing with alpha. Especially when drawing the complete background in this mode. If I have the time I certainly would like to try it. I now have the alpha issue working using the solution above.
Cheers On Mar 23, 3:35 am, 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? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

