drawLine

fun DrawScope.drawLine(paint: Paint, x1: Float, y1: Float, x2: Float, y2: Float, strokeWidth: Float, @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1.0f)

Draws a straight line between (x1, y1) and (x2, y2) using a line of width strokeWidth.

Parameters

paint

the paint or color used to render the line.

x1

horizontal start coordinate.

y1

vertical start coordinate.

x2

horizontal end coordinate.

y2

vertical end coordinate.

strokeWidth

the width of the stroked line.

alpha

the opacity to render with, from 0.0f to 1.0f.


fun DrawScope.drawLine(paint: Paint, start: Point2D, end: Point2D, stroke: Stroke = DrawStyle.DefaultStroke.stroke, @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1.0f)

Draws a line between start and end.

Parameters

paint

the paint or color used to render the line.

start

start point.

end

end point.

stroke

the Stroke used to outline the line.

alpha

the opacity to render with.