views:

717

answers:

3

How can I make certain pixels of an DrawableBitmap transparent?

+1  A: 

Android supports transparency on PNG files. So convert your bitmap to a PNG using an editor like GIMP and the work's done for you.

Ally
I have to do this programmatically. I do not know the images to advance.
Arutha
A: 

You can try to change the underlying Bitmap (if it is mutable) pixel with the setPixel method.

david
it may be a very long and expensive. There is not a filtering system that makes it ?
Arutha
Depends on how pixels in the image you want to change at every frame.What is the underlying bitmap size? How much of it do you want to change? 1% 10% 50%?There are many filtering classes in android.graphics but they do not operate on pixel basis.
david
A: 

Maybe this helps:

Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
buffer.eraseColor(Color.TRANSPARENT);
Tughi
It will change all pixel's color. I need to make transparent only few pixels.
Arutha