有什么方法可以使用PorterDuffXfermode(PorterDuff.Mode.CLEAR)更改绘制路径或绘画的不透明度吗?

时间:2020-05-27 02:36:19

标签: android kotlin canvas paint

我正在尝试实现可以​​改变绘制路径不透明度的橡皮擦。我尝试更改Alpha,但仍然无法正常工作。

这是代码:

    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

0 个答案:

没有答案