Start native apps faster with the Composables CLI ->
Class

RoundRect

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

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

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

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

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

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

Properties

width

Source set: Common
public val width: Float

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

height

Source set: Common
public val height: Float

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

Functions

contains

Source set: Common
public 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.

Members

Companion

Source set: Common
public companion object

Properties

Zero

Source set: Common
public val Zero: RoundRect = RoundRect(0.0f, 0.0f, 0.0f, 0.0f, CornerRadius.Zero)

A rounded rectangle with all the values set to zero.