Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Function of view class
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
/* curve from P1 to P2 */
leftArc.set(
0f,
0f,
xAxisOffset,
yAxisOffset
)
path.addArc(leftArc, 180f, 90f)
/* line from P2 to P3 */
path.lineTo(w.toFloat() - (xAxisOffset * 0.5f), 0f)
/* curve from P3 to P4 */
rightArc.set(
w.toFloat() - (xAxisOffset),
0f,
w.toFloat(),
yAxisOffset
)
path.addArc(rightArc, 270f, 90f)
/* line from P4 to P5 */
path.lineTo(w.toFloat(), h.toFloat())
/* line from P5 to P6 */
path.lineTo(0f, h.toFloat())
/* line from P6 to P1 */
path.lineTo(0f, yAxisOffset - (yAxisOffset / 2))
path.close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment