Fill in the gaps within the following code snippet to create a custom shape that draws a right triangle:
Shapes in Compose
Right Triangle
Report a typo
Fill in the gaps with the relevant elements
class RightTriangleShape : Shape {
override fun createOutline(
size: Size,
layoutDirection: LayoutDirection,
density: Density
): Outline {
val path = Path().apply {
moveTo(0f, 0f) // Start at top-left corner
lineTo(0f, size.height) // Draw line to top-right corner
lineTo(size.width, ) // Draw line to bottom-left corner
close()
}
return Outline.Generic(path)
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.