stroke

inline fun stroke(shape: Shape, shading: Shading, blendingMode: BlendingMode = DEFAULT_BLENDING_MODE, shadow: Shadow? = null, lineWidth: Float = CanvasStroke.DEFAULT_LINE_WIDTH, lineCap: LineCap = DEFAULT_LINE_CAP, lineJoin: LineJoin = DEFAULT_LINE_JOIN, miterLimit: Float = CanvasStroke.DEFAULT_MITER_LIMIT, dashLengths: FloatArray? = null, dashPhase: Float = 0.0f)

Strokes the given Shape.

Note: Strokes are rendered in such a way where half of the stroke width is drawn inside of the shape and half is drawn outside of the shape. Keep this in mind when drawing stroked shapes close to the clip or screen bounds and make sure that the whole stroke width is rendered properly along the entire shape.

Parameters

shape

The shape that will be drawn with stroke style. A shape can be either a Path or Shape. For simple shapes prefer using Shape if possible because it offers better drawing performance.

shading

The shading definition that describes how to stroke the path. For example solid color or a gradient.

blendingMode

The blend mode that will be used when stroking the shape

shadow

The shadow that will be drawn below the path

lineWidth

The width for stroking. Pass 0 to stroke in hairline mode. Hairlines always draws a single pixel.

lineCap

The line cap style

lineJoin

The line join style

miterLimit

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.

dashLengths

The array of ON and OFF distances. It must contain an even number of entries (>=2), with the even indices specifying the "on" intervals, and the odd indices specifying the "off" intervals. This array controls the length of the dashes. The lineWidth controls the thickness of the dashes.

dashPhase

The value which specifies how far into the dash pattern the line starts. For example, passing a value of 3 means the line is drawn with the dash pattern starting at three units from its beginning. Passing a value of 0 draws a line starting with the beginning of a dash pattern. Ignored if dash-lengths is null.