我的drawVertices(...)涂有如下涂料
val paint = Paint().apply {
style = Paint.Style.STROKE
strokeCap = Paint.Cap.ROUND
strokeJoin = Paint.Join.ROUND
isAntiAlias = true
textAlign = Paint.Align.CENTER
textSize = resources.dpToPx(30)
color = Color.RED
strokeWidth = resources.dpToPx(8)
}
val verts = floatArrayOf(0f, 0f, width.toFloat(), 0f, width/2f, height/2f,
width/2f, height/2f, 0f, height.toFloat(), width.toFloat(), height.toFloat())
canvas.drawVertices(
Canvas.VertexMode.TRIANGLES,
verts.size, verts, 0,
null, 0,
null, 0,
indices, 0, indices.size,
paint
)
但是绘制的顶点仍然是彩色的,并且看似带有线条的1px。因此,无论我将paint
更改为什么(例如Color.RED
)
paint
中没有真正使用drawVertices
吗? (我尝试放入null
,它无法编译)