我有一个方法,每次都必须传入一个固定的对象paint,因为这个函数会被频繁调用,所以我不能在内联函数中创建对象。inlinefunCanvas.drawPoint(point:PointF,paint:Paint){drawPoint(point.x,point.y,paint)}但是我很多地方都会调用这个方法。//(Canvas.apply(..,..))drawPoint(pointA,pointPaint)drawPoint(pointB,pointPaint)drawPoint(pointC,pointPaint)drawPoint(pointD,pointPaint)可以看到每次都会传入一个pointPaint对象。所以我在想有没有类似这样一个功能//(Canvas.apply(..,..))bind(pointPaint)drawPoint(pointA)drawPoint(pointB)drawPoint(pointC)drawPoint(pointD)
四季花海
MYYA
相关分类