Skip to content

Instantly share code, notes, and snippets.

@oas004
Created December 7, 2022 22:24
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 oas004/49abb551d07fcaa9c67bc036c3231c97 to your computer and use it in GitHub Desktop.
Save oas004/49abb551d07fcaa9c67bc036c3231c97 to your computer and use it in GitHub Desktop.
private val topRight: SegmentDrawable = { range ->
lineRange(
drawRange = range,
segmentRange = topRightRange,
x1 = width / 2,
y1 = 0f,
x2 = width - cornerRadius,
y2 = 0f
)
}
private val rightTopCorner: SegmentDrawable = { range ->
arcRange(
drawRange = range,
segmentRange = rightTopCornerRange,
center = Offset(width - cornerRadius, cornerRadius),
startDegrees = 270f
)
}
private val right: SegmentDrawable = { range ->
lineRange(
drawRange = range,
segmentRange = rightRange,
x1 = width,
y1 = cornerRadius,
x2 = width,
y2 = height - cornerRadius
)
}
private val rightBottomCorner: SegmentDrawable = { range ->
arcRange(
drawRange = range,
segmentRange = rightBottomCornerRange,
center = Offset(width - cornerRadius, height - cornerRadius),
startDegrees = 0f
)
}
val bottom: SegmentDrawable = { range ->
lineRange(
drawRange = range,
segmentRange = bottomRange,
x1 = width - cornerRadius,
y1 = height,
x2 = cornerRadius,
y2 = height
)
}
private val leftBottomCorner: SegmentDrawable = { range ->
arcRange(
drawRange = range,
segmentRange = leftBottomCornerRange,
center = Offset(cornerRadius, height - cornerRadius),
startDegrees = 90f
)
}
private val left: SegmentDrawable = { range ->
lineRange(
drawRange = range,
segmentRange = leftRange,
x1 = 0f,
y1 = height - cornerRadius,
x2 = 0f,
y2 = cornerRadius
)
}
private val leftTopCorner: SegmentDrawable = { range ->
arcRange(
drawRange = range,
segmentRange = leftTopCornerRange,
center = Offset(cornerRadius, cornerRadius),
startDegrees = 180f
)
}
private val topLeft: SegmentDrawable = { range ->
lineRange(
drawRange = range,
segmentRange = topLeftRange,
x1 = cornerRadius,
y1 = 0f,
x2 = width / 2,
y2 = 0f
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment