---
title: "toComposeRect"
description: "Creates a new instance of [androidx.compose.ui.geometry.Rect] with the same bounds specified in
the given [android.graphics.Rect]"
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
fun android.graphics.Rect.toComposeRect(): androidx.compose.ui.geometry.Rect
```


Creates a new instance of `androidx.compose.ui.geometry.Rect` with the same bounds specified in
the given `android.graphics.Rect`



<div class='sourceset sourceset-android'>Android</div>


```kotlin
fun android.graphics.RectF.toComposeRect(): Rect
```


Creates a new instance of `androidx.compose.ui.geometry.Rect` with the same bounds specified in
the given `android.graphics.RectF`.



