-
-
Save NikolaDespotoski/700f705639072d213114c19460859ad9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Modifier.curve( | |
curveColors: CurveColors, | |
stroke: Stroke, | |
enabled: Boolean, | |
points: SnapshotStateList<Point>, | |
thumbSize: Dp | |
): Modifier = this then composed { | |
val fillColor = curveColors.fillColor(enabled = enabled) | |
val lineColor = curveColors.lineColor(enabled = enabled) | |
val backgroundColor = Theme.colorScheme.background | |
val path = remember { Path() } | |
drawBehind { | |
if (!path.isEmpty) { | |
path.reset() | |
} | |
path.drawSomething( | |
stroke = stroke, size = size, points = points.toList() | |
) | |
drawPath(path = path, color = lineColor.value, style = stroke) | |
drawPath(path = path, color = fillColor.value, alpha = 0.4f) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment