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

# androidx.compose.ui.geometry

## Classes

 MutableRect An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin. Offset An immutable 2D floating-point offset. Radius A radius for either circular or elliptical (oval) shapes. Rect An immutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin. RoundRect An immutable rounded rectangle with custom radii for all four corners. Size Holds a 2D floating-point size.

## Top-level functions summary

 Offset `Offset(x: Float, y: Float)` Constructs an Offset from the given relative x and y offsets Radius `Radius(x: Float, y: Float = x)` Constructs a Radius with the given x and y parameters for the size of the radius along the x and y axis respectively. Rect `Rect(offset: Offset, size: Size)` Construct a rectangle from its left and top edges as well as its width and height. Rect `Rect(topLeft: Offset, bottomRight: Offset)` Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin. Rect `Rect(center: Offset, radius: Float)` Construct a rectangle that bounds the given circle RoundRect `RoundRect(left: Float, top: Float, right: Float, bottom: Float, radiusX: Float, radiusY: Float)` Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis. RoundRect `RoundRect(left: Float, top: Float, right: Float, bottom: Float, radius: Radius)` Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner. RoundRect `RoundRect(rect: Rect, radiusX: Float, radiusY: Float)` Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis. RoundRect `RoundRect(rect: Rect, radius: Radius)` Construct a rounded rectangle from its bounding box and a radius that is the same in each corner. RoundRect `RoundRect(rect: Rect, topLeft: Radius = Radius.Zero, topRight: Radius = Radius.Zero, bottomRight: Radius = Radius.Zero, bottomLeft: Radius = Radius.Zero)` Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii. Size `Size(width: Float, height: Float)` Constructs a Size from the given width and height Offset `lerp(start: Offset, stop: Offset, fraction: Float)` Linearly interpolate between two offsets. Radius `lerp(start: Radius, stop: Radius, fraction: Float)` Linearly interpolate between two radii. Rect `lerp(start: Rect, stop: Rect, fraction: Float)` Linearly interpolate between two rectangles. RoundRect `lerp(start: RoundRect, stop: RoundRect, fraction: Float)` Linearly interpolate between two rounded rectangles. Size? `lerp(start: Size, stop: Size, fraction: Float)` Linearly interpolate between two sizes

## Extension functions summary

 For kotlin.Double operator Size `Double.times(size: Size)` Returns a Size with size's Size.width and Size.height multiplied by this
 For kotlin.Float operator Size `Float.times(size: Size)` Returns a Size with size's Size.width and Size.height multiplied by this
 For kotlin.Int operator Size `Int.times(size: Size)` Returns a Size with size's Size.width and Size.height multiplied by this
 For RoundRect Radius `RoundRect.bottomLeftRadius()` The bottom-right Radius. Radius `RoundRect.bottomRightRadius()` The bottom-right Radius. Offset `RoundRect.center()` The offset to the point halfway between the left and right and the top and bottom edges of this rectangle. Rect `RoundRect.outerRect()` The bounding box of this rounded rectangle (the rectangle with no rounded corners). Rect `RoundRect.safeInnerRect()` 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 `RoundRect.shift(offset: Offset)` Returns a new RoundRect translated by the given offset. Radius `RoundRect.topLeftRadius()` The top-left Radius. Radius `RoundRect.topRightRadius()` The top-right Radius. RoundRect `RoundRect.translate(offset: Offset)` Returns a new RoundRect translated by the given offset.
 For MutableRect Rect `MutableRect.toRect()`
 For Size Rect `Size.toRect()` Convert a Size to a Rect.

## Extension properties summary

 For RoundRect Rect `RoundRect.boundingRect()` The bounding box of this rounded rectangle (the rectangle with no rounded corners). Offset `RoundRect.center()` The offset to the point halfway between the left and right and the top and bottom edges of this rectangle. Boolean `RoundRect.isCircle()` Whether this rounded rectangle would draw as a circle. Boolean `RoundRect.isEllipse()` Whether this rounded rectangle has no side with a straight section. Boolean `RoundRect.isEmpty()` Whether this rounded rectangle encloses a non-zero area. Boolean `RoundRect.isFinite()` Whether all coordinates of this rounded rectangle are finite. Boolean `RoundRect.isRect()` Whether this rounded rectangle is a simple rectangle with zero corner radii. Boolean `RoundRect.isSimple()` Returns `true` if the rounded rectangle have the same radii in both the horizontal and vertical direction for all corners. Float `RoundRect.longestSide()` The greater of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle. Float `RoundRect.maxDimension()` Float `RoundRect.minDimension()` The lesser of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle. Rect `RoundRect.safeInnerRect()` 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 `RoundRect.shortestSide()` The lesser of the magnitudes of the RoundRect.width and the RoundRect.height of this rounded rectangle.

## Top-level functions

### Offset

`@Stable inline fun Offset(    x: Float,     y: Float): Offset`

Constructs an Offset from the given relative x and y offsets

`@Stable inline fun Radius(    x: Float,     y: Float = x): Radius`

Constructs a Radius with the given x and y parameters for the size of the radius along the x and y axis respectively. By default the radius along the Y axis matches that of the given x-axis unless otherwise specified

### Rect

`@Stable fun Rect(    offset: Offset,     size: Size): Rect`

Construct a rectangle from its left and top edges as well as its width and height.

Parameters
offset: Offset Offset to represent the top and left parameters of the Rect
size: Size Size to determine the width and height of this Rect.
Return
Rect with Rect.left and Rect.top configured to Offset.x and Offset.y as Rect.right and Rect.bottom to Offset.x + Size.width and Offset.y + Size.height respectively

### Rect

`@Stable fun Rect(    topLeft: Offset,     bottomRight: Offset): Rect`

Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.

Parameters
topLeft: Offset Offset representing the left and top edges of the rectangle
bottomRight: Offset Offset representing the bottom and right edges of the rectangle

### Rect

`@Stable fun Rect(    center: Offset,     radius: Float): Rect`

Construct a rectangle that bounds the given circle

Parameters
center: Offset Offset that represents the center of the circle

### RoundRect

`fun RoundRect(    left: Float,     top: Float,     right: Float,     bottom: Float,     radiusX: Float,     radiusY: Float): RoundRect`

Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii along its horizontal axis and its vertical axis.

### RoundRect

`fun RoundRect(    left: Float,     top: Float,     right: Float,     bottom: Float,     radius: Radius): RoundRect`

Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner.

### RoundRect

`fun RoundRect(    rect: Rect,     radiusX: Float,     radiusY: Float): RoundRect`

Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis.

### RoundRect

`fun RoundRect(    rect: Rect,     radius: Radius): RoundRect`

Construct a rounded rectangle from its bounding box and a radius that is the same in each corner.

### RoundRect

`fun RoundRect(    rect: Rect,     topLeft: Radius = Radius.Zero,     topRight: Radius = Radius.Zero,     bottomRight: Radius = Radius.Zero,     bottomLeft: Radius = Radius.Zero): RoundRect`

Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii.

### Size

`@Stable fun Size(    width: Float,     height: Float): Size`

Constructs a Size from the given width and height

### lerp

`@Stable fun lerp(    start: Offset,     stop: Offset,     fraction: Float): Offset`

Linearly interpolate between two offsets.

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an `AnimationController`.

### lerp

`@Stable fun lerp(    start: Radius,     stop: Radius,     fraction: Float): Radius`

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an `AnimationController`.

### lerp

`@Stable fun lerp(    start: Rect,     stop: Rect,     fraction: Float): Rect`

Linearly interpolate between two rectangles.

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an `AnimationController`.

### lerp

`fun lerp(    start: RoundRect,     stop: RoundRect,     fraction: Float): RoundRect`

Linearly interpolate between two rounded rectangles.

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an `AnimationController`.

### lerp

`@Stable fun lerp(    start: Size,     stop: Size,     fraction: Float): Size?`

Linearly interpolate between two sizes

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an `AnimationController`.

## Extension functions

`fun RoundRect.bottomLeftRadius(): Radius`

Deprecated.

`fun RoundRect.bottomRightRadius(): Radius`

Deprecated.

### center

`fun RoundRect.center(): Offset`

Deprecated.

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

### outerRect

`fun RoundRect.outerRect(): Rect`

Deprecated.

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

### safeInnerRect

`fun RoundRect.safeInnerRect(): Rect`

Deprecated.

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. The middle of a corner is the intersection of the curve with its respective quadrant bisector.

### shift

`fun RoundRect.shift(offset: Offset): RoundRect`

Deprecated.

Returns a new RoundRect translated by the given offset.

### times

`@Stable inline operator fun Double.times(size: Size): Size`

Returns a Size with size's Size.width and Size.height multiplied by this

### times

`@Stable inline operator fun Float.times(size: Size): Size`

Returns a Size with size's Size.width and Size.height multiplied by this

### times

`@Stable inline operator fun Int.times(size: Size): Size`

Returns a Size with size's Size.width and Size.height multiplied by this

### toRect

`fun MutableRect.toRect(): Rect`

### toRect

`@Stable fun Size.toRect(): Rect`

Convert a Size to a Rect.

`fun RoundRect.topLeftRadius(): Radius`

Deprecated.

`fun RoundRect.topRightRadius(): Radius`

Deprecated.

### translate

`fun RoundRect.translate(offset: Offset): RoundRect`

Returns a new RoundRect translated by the given offset.

## Extension properties

### boundingRect

`val RoundRect.boundingRect: Rect`

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

### center

`val RoundRect.center: Offset`

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

### isCircle

`val RoundRect.isCircle: Boolean`

Whether this rounded rectangle would draw as a circle.

### isEllipse

`val RoundRect.isEllipse: Boolean`

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

### isEmpty

`val RoundRect.isEmpty: Boolean`

Whether this rounded rectangle encloses a non-zero area. Negative areas are considered empty.

### isFinite

`val RoundRect.isFinite: Boolean`

Whether all coordinates of this rounded rectangle are finite.

### isRect

`val RoundRect.isRect: Boolean`

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

### isSimple

`val RoundRect.isSimple: Boolean`

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

### longestSide

`val RoundRect.longestSide: Float`

Deprecated.

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

### maxDimension

`val RoundRect.maxDimension: Float`

### minDimension

`val RoundRect.minDimension: Float`

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

### safeInnerRect

`val RoundRect.safeInnerRect: 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. The middle of a corner is the intersection of the curve with its respective quadrant bisector.

### shortestSide

`val RoundRect.shortestSide: Float`

Deprecated.

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