I need help on making the touched areas of bitmap image transparent(seems like erasing) while I am moving my finger on that image.
I am having a PNG file with Alpha channel in it. I want to turn the touched pixels to transparent so that, the user can feel that he is actually erasing it.
For this I am using frame layout to load 2 layers. Down layer is for content and upper layer is an Imageview for erasing. I need erase the upper layer when user touch and move his finger on it.
I am not getting how to make it transparent. can anyone please help me in this. If possible please direct me to any sample code, as I am very new to this image processing.
Thanks in advance.
Click Picture Tools > Recolor > Set Transparent Color.
You need to set the PorterDuff mode on a Paint object:
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC))
and draw with Color.TRANSPARENT
Also see this thread in the Android developer group: http://groups.google.com/group/android-developers/browse_thread/thread/5b0a498664b17aa0/de4aab6fb7e97e38?lnk=gst&q=erase+transparent#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With