Package-level declarations

Types

Link copied to clipboard
class TriangleMesh(val maxVertices: Int = 4096, val maxIndices: Int = maxVertices * 6)

A batch of triangles with a colour at every corner, drawn in a single call.

Functions

Link copied to clipboard
actual fun DrawScope.drawMesh(mesh: TriangleMesh, blendMode: BlendMode)

Android's triangle call, with a way round the versions that cannot use it.

expect fun DrawScope.drawMesh(mesh: TriangleMesh, blendMode: BlendMode = BlendMode.SrcOver)

Draws every triangle in mesh in one call, in the order they were added.

actual fun DrawScope.drawMesh(mesh: TriangleMesh, blendMode: BlendMode)

Desktop and iOS, straight through Skia's own triangle call.

Link copied to clipboard
fun TriangleMesh.glow(x: Float, y: Float, radius: Float, argb: Int, sides: Int = 6)

Adds a soft round spot: a fan of triangles in full colour at the middle and clear at the rim.

Link copied to clipboard
fun TriangleMesh.glyph(kind: Int, x: Float, y: Float, size: Float, turn: Float, argb: Int)

One of four small marks, turned by turn: 0 a cross, 1 a diamond, 2 a chevron, 3 a dash.

Link copied to clipboard
fun headlight(radius: Float, distance: Float): Float

How much of a lamp at the camera reaches a wall radius from the axis and distance ahead: nearly all of it up close, less and less further down. Seen from inside a tube, no normals are needed.

Link copied to clipboard
fun TriangleMesh.polygon(x: Float, y: Float, radius: Float, sides: Int, turn: Float, argb: Int, rim: Int = argb)

A filled regular polygon turned by turn radians: argb in the middle, rim at the corners.

Link copied to clipboard
fun TriangleMesh.ring(x: Float, y: Float, radius: Float, thickness: Float, argb: Int, sides: Int = 24)

A ring thickness wide, in one colour, as a band of sides quads.

Link copied to clipboard
fun TriangleMesh.shard(x: Float, y: Float, length: Float, turn: Float, argb: Int)

A thin sliver like a shard of glass, length long, turned by turn.

Link copied to clipboard
fun TriangleMesh.spark(x: Float, y: Float, length: Float, width: Float, argb: Int)

A four pointed spark: two narrow diamonds crossed, bright in the middle and clear at the tips.

Link copied to clipboard
fun TriangleMesh.streak(tailX: Float, tailY: Float, headX: Float, headY: Float, width: Float, argb: Int)

A streak from a clear tail to a bright head, width wide at the head.

Link copied to clipboard
fun TriangleMesh.strip(xs: FloatArray, ys: FloatArray, count: Int, width: Float, argb: Int)

A wide line through the first count points of xs and ys.