fun test() {
Canvas().bindPaintDrawPoints(Paint())(
arrayOf(PointF(1f, 2f),
PointF(2f, 2f),
PointF(3f, 2f),
PointF(4f, 2f))
)
}
fun Canvas.bindPaintDrawPoints(paint: Paint): (Array<PointF>) -> Unit {
return {
drawPoints(paint, it)
}
}
fun Canvas.drawPoints(paint: Paint, points: Array<PointF>) {
for (p in points) {
this.drawPoint(p.x, p.y, paint)
}
}
I want to modify Array < PointF >
in the above code to vararg PointF
something like this? But the compiler will report an error, is there any way to do that?