# MutableRect

Artifact: [androidx.compose.ui:ui-geometry](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/geometry/MutableRect.kt+class:androidx.compose.ui.geometry.MutableRect) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/All
- Cmn

  ```
  class MutableRect
  ```

*** ** * ** ***

An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#MutableRect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)(left: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, right: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` | Cmn |

| ### Public functions |
|---|---|---|
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#contains(androidx.compose.ui.geometry.Offset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#deflate(kotlin.Float)(delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Moves edges inwards by the given delta. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#inflate(kotlin.Float)(delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Moves edges outwards by the given delta. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)(left: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, right: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Modifies `this` to be the intersection of this and the rect formed by `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#overlaps(androidx.compose.ui.geometry.MutableRect)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect)` Whether `other` has a nonzero area of overlap with this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#overlaps(androidx.compose.ui.geometry.Rect)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect)` Whether `other` has a nonzero area of overlap with this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)(left: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, right: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets new bounds to (`https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`) | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#toString()()` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#translate(androidx.compose.ui.geometry.Offset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Translates the rect by the provided `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#translate(kotlin.Float,kotlin.Float)(translateX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, translateY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Updates this rectangle with translateX added to the x components and translateY added to the y components. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#bottom()` The offset of the bottom edge of this rectangle from the y axis. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#bottomCenter()` The offset to the center of the bottom edge of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#bottomLeft()` The offset to the intersection of the bottom and left edges of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#bottomRight()` The offset to the intersection of the bottom and right edges of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#center()` The offset to the point halfway between the left and right and the top and bottom edges of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#centerLeft()` The offset to the center of the left edge of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#centerRight()` The offset to the center of the right edge of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#height()` The distance between the top and bottom edges of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#isEmpty()` Whether this rectangle encloses a non-zero area. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#isFinite()` Whether all coordinates of this rectangle are finite. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#isInfinite()` Whether any of the coordinates of this rectangle are equal to positive infinity. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#left()` The offset of the left edge of this rectangle from the x axis. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#maxDimension()` The greater of the magnitudes of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#width()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#height()` of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#minDimension()` The lesser of the magnitudes of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#width()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#height()` of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#right()` The offset of the right edge of this rectangle from the x axis. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#size()` The distance between the upper-left corner and the lower-right corner of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#top()` The offset of the top edge of this rectangle from the y axis. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#topCenter()` The offset to the center of the top edge of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#topLeft()` The offset to the intersection of the top and left edges of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#topRight()` The offset to the intersection of the top and right edges of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#width()` The distance between the left and right edges of this rectangle. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect.https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#(androidx.compose.ui.geometry.MutableRect).toRect()()` | Cmn |

## Public constructors

### MutableRect

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
MutableRect(left: Float, top: Float, right: Float, bottom: Float)
```

| Parameters |
|---|---|
| `left: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The offset of the left edge of this rectangle from the x axis. |
| `top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The offset of the top edge of this rectangle from the y axis. |
| `right: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The offset of the right edge of this rectangle from the x axis. |
| `bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The offset of the bottom edge of this rectangle from the y axis. |

## Public functions

### contains

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
operator fun contains(offset: Offset): Boolean
```

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle.

Rectangles include their top and left edges but exclude their bottom and right edges.

### deflate

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun deflate(delta: Float): Unit
```

Moves edges inwards by the given delta.

### inflate

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun inflate(delta: Float): Unit
```

Moves edges outwards by the given delta.

### intersect

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun intersect(left: Float, top: Float, right: Float, bottom: Float): Unit
```

Modifies `this` to be the intersection of this and the rect formed by `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#intersect(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`.

### overlaps

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun overlaps(other: MutableRect): Boolean
```

Whether `other` has a nonzero area of overlap with this rectangle.

### overlaps

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun overlaps(other: Rect): Boolean
```

Whether `other` has a nonzero area of overlap with this rectangle.

### set

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun set(left: Float, top: Float, right: Float, bottom: Float): Unit
```

Sets new bounds to (`https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#set(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)`)

### toString

Cmn

```
open fun toString(): String
```

### translate

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun translate(offset: Offset): Unit
```

Translates the rect by the provided `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset`.

### translate

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun translate(translateX: Float, translateY: Float): Unit
```

Updates this rectangle with translateX added to the x components and translateY added to the y components.

## Public properties

### bottom

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
var bottom: Float
```

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

### bottomCenter

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val bottomCenter: Offset
```

The offset to the center of the bottom edge of this rectangle.

### bottomLeft

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val bottomLeft: Offset
```

The offset to the intersection of the bottom and left edges of this rectangle.

### bottomRight

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val bottomRight: Offset
```

The offset to the intersection of the bottom and right edges of this rectangle.

### center

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val center: Offset
```

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

See also `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/package-summary#(androidx.compose.ui.geometry.Size).center()`.

### centerLeft

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val centerLeft: Offset
```

The offset to the center of the left edge of this rectangle.

### centerRight

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val centerRight: Offset
```

The offset to the center of the right edge of this rectangle.

### height

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val height: Float
```

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

### isEmpty

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val isEmpty: Boolean
```

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

### isFinite

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val isFinite: Boolean
```

Whether all coordinates of this rectangle are finite.

### isInfinite

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val isInfinite: Boolean
```

Whether any of the coordinates of this rectangle are equal to positive infinity.

### left

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
var left: Float
```

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

### maxDimension

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val maxDimension: Float
```

The greater of the magnitudes of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#width()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#height()` of this rectangle.

### minDimension

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val minDimension: Float
```

The lesser of the magnitudes of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#width()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/MutableRect#height()` of this rectangle.

### right

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
var right: Float
```

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

### size

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val size: Size
```

The distance between the upper-left corner and the lower-right corner of this rectangle.

### top

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
var top: Float
```

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

### topCenter

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val topCenter: Offset
```

The offset to the center of the top edge of this rectangle.

### topLeft

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val topLeft: Offset
```

The offset to the intersection of the top and left edges of this rectangle.

### topRight

Cmn Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
val topRight: Offset
```

The offset to the intersection of the top and right edges of this rectangle.

### width

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val width: Float
```

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

## Extension functions

### MutableRect.toRect

Cmn Artifact: [androidx.compose.ui:ui-geometry](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/geometry/MutableRect.kt+function:toRect)

```
fun MutableRect.toRect(): Rect
```