在不影响先前绘制的情况下更改颜色和大小

时间:2019-03-21 04:10:33

标签: android kotlin

如何处理这种情况?我已经创建了一个新路径,但仍更改了以前的路径颜色和大小。

private lateinit var mPaint: Paint
private lateinit var mEraserPaint: Paint
private val mEraserPath: Path = Path()
private val mArrayPaths: ArrayList<Path> = ArrayList<Path>()

override fun onDraw(canvas: Canvas) {
    Timber.d("ON DRAW")
    for (path: Path in mArrayPaths) {
         setPaintColor(getStrokeColor())
         setPaintSize(getStrokeSize())
         canvas.drawPath(path, mPaint)
    }
    canvas.drawPath(mEraserPath, mEraserPaint)
}

0 个答案:

没有答案