[android-developers] Re: how to color key 2d sprite backgound?

2009-04-21 Thread Arjen van Haren
Hi Diana, At the time I started coding I was unsure if opengl would be hardware enabled on all upcoming devices. And starting plain 2d on a new device seemed more easy to start with. As for my animations, I create those with an animation package where most of the times I only need to have 1 color

[android-developers] Re: how to color key 2d sprite backgound?

2009-04-20 Thread Gazy
Perfectly what I needed, thanks a million!! On Mar 21, 6:23 am, Tazzer arjenvanha...@gmail.com wrote: For who it concerns.. As is seems it is not possible within the android api to do color keying directly,  so I created a function to set all pixels manual. It is based on the color located

[android-developers] Re: how to color key 2d sprite backgound?

2009-04-20 Thread Gazy
hey setTransparancy() didnt seem to do anything for me, first pixel is black so I expected black to go transparent but it hasnt - only testing on emulator right now - any ideas? On Apr 20, 2:27 pm, Gazy gareth.mur...@gmail.com wrote: Perfectly what I needed, thanks a million!! On Mar 21, 6:23 

[android-developers] Re: how to color key 2d sprite backgound?

2009-04-20 Thread Dianne Hackborn
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

[android-developers] Re: how to color key 2d sprite backgound?

2009-03-29 Thread Sarnoth
I tried this out and unfortunately it is not a good solution. AvoidXfermode is implemented very inefficiently such that each pixel is converted to 32 bits, run through an alpha calculation, and then converted back to 16 bits. Based on the documentation of the tolerance parameter I was hoping for

[android-developers] Re: how to color key 2d sprite backgound?

2009-03-24 Thread Tazzer
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

[android-developers] Re: how to color key 2d sprite backgound?

2009-03-22 Thread Sarnoth
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

[android-developers] Re: how to color key 2d sprite backgound?

2009-03-21 Thread Tazzer
For who it concerns.. As is seems it is not possible within the android api to do color keying directly, so I created a function to set all pixels manual. It is based on the color located on pixel 0,0. If you want to use a given color just replace it by its color value. public Bitmap