# IntRect

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

  ```
  data class IntRect
  ```

*** ** * ** ***

An immutable, 2D, axis-aligned, integer bounds rectangle whose coordinates are relative to a given origin.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#Zero()` A rectangle with left, top, right, and bottom edges all at zero. | Cmn |

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

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#contains(androidx.compose.ui.unit.IntOffset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset)` 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://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#deflate(kotlin.Int)(delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a new rectangle with edges moved inwards by the given delta. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#inflate(kotlin.Int)(delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a new rectangle with edges moved outwards by the given delta. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#intersect(androidx.compose.ui.unit.IntRect)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect)` Returns a new rectangle that is the intersection of the given rectangle and this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#overlaps(androidx.compose.ui.unit.IntRect)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect)` Whether `other` has a nonzero area of overlap with this rectangle. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#toString()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#translate(androidx.compose.ui.unit.IntOffset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset)` Returns a new rectangle translated by the given offset. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#translate(kotlin.Int,kotlin.Int)(translateX: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, translateY: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a new 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/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#bottom()` The offset of the bottom edge of this rectangle from the y axis. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#bottomCenter()` The offset to the center of the bottom edge of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#centerLeft()` The offset to the center of the left edge of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#centerRight()` The offset to the center of the right edge of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/unit/IntRect#isEmpty()` Whether this rectangle encloses a non-zero area. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#left()` The offset of the left edge of this rectangle from the x axis. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#maxDimension()` The greater of the magnitudes of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#width()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#height()` of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#minDimension()` The lesser of the magnitudes of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#width()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#height()` of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#right()` The offset of the right edge of this rectangle from the x axis. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#top()` The offset of the top edge of this rectangle from the y axis. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#topCenter()` The offset to the center of the top edge of this rectangle. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/unit/IntOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#topRight()` The offset to the intersection of the top and right edges of this rectangle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#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/unit/IntRect.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#(androidx.compose.ui.unit.IntRect).toRect()()` Converts an `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect` | Cmn |
| `https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#(androidx.compose.ui.unit.IntRect).toAndroidRect()()` Creates a new instance of `https://developer.android.com/reference/android/graphics/Rect.html` with the same bounds specified in the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` | android |

## Public companion properties

### Zero

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

```
val Zero: IntRect
```

A rectangle with left, top, right, and bottom edges all at zero.

## Public constructors

### IntRect

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

```
IntRect(left: Int, top: Int, right: Int, bottom: Int)
```

## Public functions

### contains

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

```
fun contains(offset: IntOffset): 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.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun deflate(delta: Int): IntRect
```

Returns a new rectangle with edges moved inwards by the given delta.

### inflate

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

```
fun inflate(delta: Int): IntRect
```

Returns a new rectangle with edges moved 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(other: IntRect): IntRect
```

Returns a new rectangle that is the intersection of the given rectangle and this rectangle. The two rectangles must overlap for this to be meaningful. If the two rectangles do not overlap, then the resulting IntRect will have a negative width or height.

### overlaps

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

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

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

### 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: IntOffset): IntRect
```

Returns a new rectangle translated by the given offset.

To translate a rectangle by separate x and y components rather than by an `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset`, consider `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect#translate(androidx.compose.ui.unit.IntOffset)`.

### translate

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

```
fun translate(translateX: Int, translateY: Int): IntRect
```

Returns a new 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)

```
val bottom: Int
```

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

### bottomCenter

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

```
val bottomCenter: IntOffset
```

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

### bottomLeft

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

```
val bottomLeft: IntOffset
```

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

### bottomRight

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

```
val bottomRight: IntOffset
```

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

### center

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

```
val center: IntOffset
```

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/unit/package-summary#(androidx.compose.ui.unit.IntSize).center()`.

### centerLeft

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

```
val centerLeft: IntOffset
```

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

### centerRight

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

```
val centerRight: IntOffset
```

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: Int
```

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.

### left

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

```
val left: Int
```

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

### maxDimension

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

```
val maxDimension: Int
```

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

### minDimension

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

```
val minDimension: Int
```

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

### right

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

```
val right: Int
```

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: IntSize
```

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)

```
val top: Int
```

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

### topCenter

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

```
val topCenter: IntOffset
```

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

### topLeft

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

```
val topLeft: IntOffset
```

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

### topRight

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

```
val topRight: IntOffset
```

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: Int
```

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

## Extension functions

### IntRect.toRect

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

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

Converts an `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect` to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Rect`

### IntRect.toAndroidRect

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

```
fun IntRect.toAndroidRect(): Rect
```

Creates a new instance of `https://developer.android.com/reference/android/graphics/Rect.html` with the same bounds specified in the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntRect`