Making Overlaid image transparent on touch in Android?

后端 未结 3 2047
孤城傲影
孤城傲影 2020-12-03 00:00

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

3条回答
  •  一个人的身影
    2020-12-03 01:04

    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#

提交回复
热议问题