Created
March 6, 2022 19:15
-
-
Save aqua30/3c70a6d7dd5e3462094139ab64be3624 to your computer and use it in GitHub Desktop.
Function of view class
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
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