0

I want to make an image transparent in android, so I did some research but came to the conclusion that I did'nt really get it. So I am drawing A couple of bitmaps on my canvas, and in 1 kind of bitmap I want to make the red transparent. i found A piece of code but I doesn't really do anything. this is my code:

if(PictureArray[a]==0){
                Paint Remove = new Paint();
                Remove.setARGB(255, 255, 0, 0);
                int removeColor=Remove.getColor();
                Remove.setAlpha(0);
                Remove.setXfermode(new AvoidXfermode(removeColor,0,AvoidXfermode.Mode.TARGET));
                c.drawBitmap(Stone, x, c.getHeight()/2, null);
            }
stevedc
  • 483
  • 3
  • 8
  • 26
  • Are you talking about creating one dynamically? Or just in general? In general, just save as PNG which supports transparency. If you're using a JPG, you'll never get transparency. – Kevin Coppock Apr 15 '12 at 15:40
  • it is saved as A png. And it's dynamically because the screen changes when you user does something – stevedc Apr 15 '12 at 15:47

1 Answers1

1

Use a transparent PNG. No need to overengineer it ;)

Kenton Price
  • 5,229
  • 4
  • 23
  • 21
  • I wanted to say "you're not serious??!?!", but I fear you are ;) Making a transparent PNG is kinda fundamental to graphic design. Go read the help of your graphic editor of choice, not Android people. – Kenton Price Apr 16 '12 at 17:05
  • Ooh okay, I figured It out on my own way by making the background where my png comes the same color als the one surroundig my picture, so it is not transparent, but the user doesn't see it – stevedc Apr 16 '12 at 19:11