---
# System prepended metadata

title: '<font style="text-shadow:0px 0px 15px #FF37FD;">RegionIterator</font>'
tags: [Kotlin, Android developer]

---

<font style="text-shadow:0px 0px 15px #FF37FD;">RegionIterator</font>
===
###### tags: `Android developer` `Kotlin`
 <font color="Brown">android.graphics.RegionIterator</font>
 <font color="Brown">關於如何繪製幾何圖形、文字、點陣圖、顏色訊息</font>
 
## <font color="sandybrown">Constructors</font>

### <font color="#990DFF">RegionIterator(region: Region!)</font>
:::info
為區域中的所有矩形構造迭代器。
:::

## <font color="sandybrown">方法</font>
### <font color="#990DFF">next(r: Rect!): Boolean</font>

:::info
返回該區域中的下一個矩形。如果沒有更多的矩形，則返回false，r不變。如果至少有一個，則返回true，並將r設置為該矩形。
:::

:::warning

**Ex:**
```kotlin=
val paint = Paint().apply {
            color = Color.RED
            style = Paint.Style.FILL
        }
val ovalPath = Path()
ovalPath.addOval(50f, 50f, 200f, 500f, Path.Direction.CCW)
val region = Region()
region.setPath(ovalPath, Region(50, 50, 200, 200))
val regionIterator = RegionIterator(region)
val rect = Rect()
while (regionIterator.next(rect)) {
            canvas?.drawRect(rect, paint)
        }
```
:::danger
**輸出結果區塊 :**
![](https://i.imgur.com/Bt5UIL2.png)
:::