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 <arjenvanha...@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to