1

I am trying to implement eraser that can change also the opacity of the drawpath. I try to change the alpha and still not working.

This is the the code:

    var mPaint = Paint()
    mPaint!!.isAntiAlias = true
    mPaint!!.isDither = true
    mPaint!!.xfermode = PorterDuffXfermode(PorterDuff.Mode.CLEAR)
    mPaint!!.style = Paint.Style.STROKE
    mPaint!!.strokeJoin = Paint.Join.ROUND
    mPaint!!.strokeCap = Paint.Cap.ROUND
    mPaint!!.strokeWidth = mStrokeWidth
    mPaint!!.alpha = 0
newbie101
  • 65
  • 10
  • Unclear what you are asking. Please review [What does PorterDuff.Mode mean in android graphics](https://stackoverflow.com/q/8280027/295004) and realize that you are setting alpha to zero. – Morrison Chang May 27 '20 at 03:07
  • Thank you for your reply @MorrisonChang, I set alpha to 0 because I'm trying to check if the drawn path changed its opacity. But I just found a solution by changing the mode to DST_IN and adjust its alpha. – newbie101 May 28 '20 at 07:03

0 Answers0