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, topLeftRadiusX: Float, topLeftRadiusY: Float, topRightRadiusX: Float, topRightRadiusY: Float, bottomRightRadiusX: Float, bottomRightRadiusY: Float, bottomLeftRadiusX: Float, bottomLeftRadiusY: Float)

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-left 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.

RoundRect

Returns a new RoundRect with edges and radii moved outwards by the given delta.

Rect

The rectangle that would be formed using the axis-aligned intersection of the sides of the rectangle, i.

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.

RoundRect

Returns a new RoundRect with edges and radii moved inwards by the given delta.

Rect

The biggest rectangle that is entirely inside the rounded rectangle and has the full height of the rounded rectangle.

Radius

The top-left Radius.

Radius

The top-right Radius.

Rect

The biggest rectangle that is entirely inside the rounded rectangle and has the full width of the rounded rectangle.

RoundRect

Properties
Float

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

Float

The bottom-left horizontal radius

Float

The bottom-left vertical radius

Float

The bottom-right horizontal radius

Float

The bottom-right vertical 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

Float

The top-left horizontal radius

Float

The top-left vertical radius

Float

The top-right horizontal radius

Float

The top-right vertical 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
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.

Boolean

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

Float

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

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,
    topLeftRadiusX: Float,
    topLeftRadiusY: Float,
    topRightRadiusX: Float,
    topRightRadiusY: Float,
    bottomRightRadiusX: Float,
    bottomRightRadiusY: Float,
    bottomLeftRadiusX: Float,
    bottomLeftRadiusY: Float)

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

bottomLeftRadiusX

val bottomLeftRadiusX: Float

The bottom-left horizontal radius

bottomLeftRadiusY

val bottomLeftRadiusY: Float

The bottom-left vertical radius

bottomRightRadiusX

val bottomRightRadiusX: Float

The bottom-right horizontal radius

bottomRightRadiusY

val bottomRightRadiusY: Float

The bottom-right vertical 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

topLeftRadiusX

val topLeftRadiusX: Float

The top-left horizontal radius

topLeftRadiusY

val topLeftRadiusY: Float

The top-left vertical radius

topRightRadiusX

val topRightRadiusX: Float

The top-right horizontal radius

topRightRadiusY

val topRightRadiusY: Float

The top-right vertical 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.