Skip to content

Instantly share code, notes, and snippets.

@StephenVinouze
Created January 13, 2022 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StephenVinouze/7465b3956b6d5c2ec253f35d7ac236b4 to your computer and use it in GitHub Desktop.
Save StephenVinouze/7465b3956b6d5c2ec253f35d7ac236b4 to your computer and use it in GitHub Desktop.
private fun DrawScope.drawSegment(coordinates: SegmentCoordinates, color: SegmentColor) {
val path = Path().apply {
reset()
moveTo(coordinates.topLeftX, 0f)
lineTo(coordinates.topRightX, 0f)
lineTo(coordinates.bottomRightX, size.height)
lineTo(coordinates.bottomLeftX, size.height)
close()
}
drawPath(
path = path,
color = color.color,
alpha = color.alpha,
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment