Google is committed to advancing racial equity for Black communities. See how.

RoundRect

@Immutable data class RoundRect
kotlin.Any
   ↳ androidx.compose.ui.geometry.RoundRect

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

Summary

Public constructors
<init>(left: Float, top: Float, right: Float, bottom: Float, topLeftRadius: Radius = Radius.Zero, topRightRadius: Radius = Radius.Zero, bottomRightRadius: Radius = Radius.Zero, bottomLeftRadius: Radius = Radius.Zero)

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

Public methods
Boolean
contains(point: Offset)

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

String

Extension functions
From androidx.compose.ui.geometry
Radius

The bottom-right Radius.

Radius

The bottom-right Radius.

Offset

The offset to the point halfway between the left and right and the top and bottom edges of this rectangle.

Rect

The bounding box of this rounded rectangle (the rectangle with no rounded corners).

Rect

The non-rounded rectangle that is constrained by the smaller of the two diagonals, with each diagonal traveling through the middle of the curve corners.

RoundRect

Returns a new RoundRect translated by the given offset.

Radius

The top-left Radius.

Radius

The top-right Radius.

RoundRect

Returns a new RoundRect translated by the given offset.

Properties
Float

The offset of the bottom edge of this rectangle from the y axis

Radius

The bottom-left radius

Radius

The bottom-right radius

Float

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

Float

The offset of the left edge of this rectangle from the x axis

Float

The offset of the right edge of this rectangle from the x axis

Float

The offset of the top edge of this rectangle from the y axis

Radius

The top-left radius

Radius

The top-right radius

Float

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

Companion properties
RoundRect

A rounded rectangle with all the values set to zero.

Extension properties
From androidx.compose.ui.geometry
Rect

The bounding box of this rounded rectangle (the rectangle with no rounded corners).

Offset

The offset to the point halfway between the left and right and the top and bottom edges of this rectangle.

Boolean

Whether this rounded rectangle would draw as a circle.

Boolean

Whether this rounded rectangle has no side with a straight section.

Boolean

Whether this rounded rectangle encloses a non-zero area.

Boolean

Whether all coordinates of this rounded rectangle are finite.

Boolean

Whether this rounded rectangle is a simple rectangle with zero corner radii.

Boolean

Returns true if the rounded rectangle have the same radii in both the horizontal and vertical direction for all corners.

Float

The greater of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle.

Float

Float

The lesser of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle.

Rect

The non-rounded rectangle that is constrained by the smaller of the two diagonals, with each diagonal traveling through the middle of the curve corners.

Float

The lesser of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle.

Public constructors

<init>

RoundRect(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float,
    topLeftRadius: Radius = Radius.Zero,
    topRightRadius: Radius = Radius.Zero,
    bottomRightRadius: Radius = Radius.Zero,
    bottomLeftRadius: Radius = Radius.Zero)

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

Public methods

contains

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.

toString

fun toString(): String

Properties

bottom

val bottom: Float

The offset of the bottom edge of this rectangle from the y axis

bottomLeftRadius

val bottomLeftRadius: Radius

The bottom-left radius

bottomRightRadius

val bottomRightRadius: Radius

The bottom-right radius

height

val height: Float

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

left

val left: Float

The offset of the left edge of this rectangle from the x axis

val right: Float

The offset of the right edge of this rectangle from the x axis

top

val top: Float

The offset of the top edge of this rectangle from the y axis

topLeftRadius

val topLeftRadius: Radius

The top-left radius

topRightRadius

val topRightRadius: Radius

The top-right radius

width

val width: Float

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

Companion properties

Zero

@JvmStatic val Zero: RoundRect

A rounded rectangle with all the values set to zero.