Stroke

Class

Common
class Stroke(
    val width: Float = 0.0f,
    val miter: Float = DefaultMiter,
    val cap: StrokeCap = DefaultCap,
    val join: StrokeJoin = DefaultJoin,
    val pathEffect: PathEffect? = null,
) : DrawStyle()

DrawStyle that provides information for drawing content with a stroke

Parameters

widthConfigure the width of the stroke in pixels
miterSet the stroke miter value. This is used to control the behavior of miter joins when the joins angle is sharp. This value must be >= 0
capReturn the paint's Cap, controlling how the start and end of stroked lines and paths are treated. The default is StrokeCap.Butt
joinSet's the treatment where lines and curve segments join on a stroked path. The default is StrokeJoin.Miter
pathEffectEffect to apply to the stroke, null indicates a solid stroke line is to be drawn

Companion Object

Properties

Common
const val HairlineWidth = 0.0f

Width to indicate a hairline stroke of 1 pixel

Common
const val DefaultMiter: Float

Default miter length used in combination with joins

Common
val DefaultCap = StrokeCap.Butt

Default cap used for line endings

Common
val DefaultJoin = StrokeJoin.Miter

Default join style used for connections between line and curve segments