RoundRect

Class

Common
data class RoundRect(
    /** The offset of the left edge of this rectangle from the x axis */
    val left: Float,
    /** The offset of the top edge of this rectangle from the y axis */
    val top: Float,
    /** The offset of the right edge of this rectangle from the x axis */
    val right: Float,
    /** The offset of the bottom edge of this rectangle from the y axis */
    val bottom: Float,
    /** The top-left radius */
    val topLeftCornerRadius: CornerRadius = CornerRadius.Zero,

    /** The top-right radius */
    val topRightCornerRadius: CornerRadius = CornerRadius.Zero,

    /** The bottom-right radius */
    val bottomRightCornerRadius: CornerRadius = CornerRadius.Zero,

    /** The bottom-left radius */
    val bottomLeftCornerRadius: CornerRadius = CornerRadius.Zero,
)

An immutable rounded rectangle with custom radii for all four corners.

Properties

Common
val width: Float

The distance between the left and right edges of this rectangle.

Common
val height: Float

The distance between the top and bottom edges of this rectangle.

Functions

operator fun contains(point: Offset): Boolean

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies inside the rounded rectangle.

This method may allocate (and cache) a copy of the object with normalized radii the first time it is called on a particular RoundRect instance. When using this method, prefer to reuse existing RoundRects rather than recreating the object each time.

Companion Object

Properties

Common
@kotlin.jvm.JvmStatic val Zero = RoundRect(0.0f, 0.0f, 0.0f, 0.0f, CornerRadius.Zero)

A rounded rectangle with all the values set to zero.