in skiko/src/commonMain/kotlin/org/jetbrains/skia/Canvas.kt [679:711]
fun drawTriangles(
positions: Array<Point>,
colors: IntArray? = null,
texCoords: Array<Point>? = null,
indices: ShortArray? = null,
blendMode: BlendMode,
paint: Paint
): Canvas {
require(positions.size % 3 == 0) { "Expected positions.length % 3 == 0, got: " + positions.size }
require(colors == null || colors.size == positions.size) { "Expected colors.length == positions.length, got: " + colors!!.size + " != " + positions.size }
require(texCoords == null || texCoords.size == positions.size) { "Expected texCoords.length == positions.length, got: " + texCoords!!.size + " != " + positions.size }
Stats.onNativeCall()
try {
interopScope {
_nDrawVertices(
_ptr,
0 /* kTriangles_VertexMode */,
positions.size,
toInterop(Point.flattenArray(positions)),
toInterop(colors),
toInterop(Point.flattenArray(texCoords)),
indices?.size ?: 0,
toInterop(indices),
blendMode.ordinal,
getPtr(paint)
)
}
} finally {
reachabilityBarrier(paint)
reachabilityBarrier(this)
}
return this
}