Last active
January 28, 2021 07:32
-
-
Save akexorcist/1edd91cc2fe68242bd94971a5d317070 to your computer and use it in GitHub Desktop.
Build Coupon UI - Create the coupon path (https://medium.com/@akexorcist/how-we-built-developer-friendly-coupon-ui-in-android-part-2-78933730d335)
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
val canvas: Canvas = /* ... */ | |
val paint: Paint = /* ... */ | |
val path = Path().apply { | |
reset() | |
moveTo(/* Start point */) | |
arcTo(/* Top right corner */) // 1 | |
arcTo(/* Right edge semi circle */) // 2 | |
arcTo(/* Bottom right corner */) // 3 | |
arcTo(/* Bottom edge semi circle */) // 4 | |
arcTo(/* Bottom left corner */) // 5 | |
arcTo(/* Left edge semi circle */) // 6 | |
arcTo(/* Top left corner */) // 7 | |
arcTo(/* Top edge semi circle */) // 8 | |
close() | |
} | |
canvas.drawPath(path, paint) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment