Last active
January 28, 2020 21:05
-
-
Save Semper-Viventem/abd0377b2bb1e52ad34029f411ceae65 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
private fun drawRightCorner(c: Canvas, path: Path, rect: RectF, radius: Float) { | |
path.reset() | |
path.moveTo(rect.left, rect.top + radius) | |
path.lineTo(rect.left, rect.top - radius) | |
path.lineTo(rect.left + radius, rect.top) | |
path.lineTo(rect.left, rect.top + radius) | |
c.drawPath(path, paint) | |
} | |
private fun drawTopCorner(c: Canvas, path: Path, rect: RectF, radius: Float) { | |
path.reset() | |
path.moveTo(prevRight + radius, rect.top) | |
path.lineTo(prevRight - radius, rect.top) | |
path.lineTo(prevRight, rect.top - radius) | |
path.cubicTo( | |
prevRight, rect.top - radius, | |
prevRight, rect.top, | |
prevRight + radius, rect.top | |
) | |
c.drawPath(path, paint) | |
} | |
private fun drawBottomCorner(c: Canvas, path: Path, rect: RectF, radius: Float) { | |
path.reset() | |
path.moveTo(rect.right + radius, rect.top) | |
path.lineTo(rect.right - radius, rect.top) | |
path.lineTo(rect.right, rect.top + radius) | |
path.cubicTo( | |
rect.right, rect.top + radius, | |
rect.right, rect.top, | |
rect.right + radius, rect.top | |
) | |
c.drawPath(path, paint) | |
} | |
private fun drawLeftCorner(c: Canvas, path: Path, rect: RectF, radius: Float) { | |
path.reset() | |
path.moveTo(rect.right, rect.top - radius) | |
path.lineTo(rect.right, rect.top + radius) | |
path.lineTo(rect.right - radius, rect.top) | |
path.lineTo(rect.right, rect.top - radius) | |
c.drawPath(path, paint) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment