Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/graphics/Region#inhconstants) \| [Fields](https://developer.android.com/reference/android/graphics/Region#lfields) \| [Ctors](https://developer.android.com/reference/android/graphics/Region#pubctors) \| [Methods](https://developer.android.com/reference/android/graphics/Region#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/graphics/Region#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/Region#inhmethods)

# Region

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/graphics/Region "View this page in Kotlin") \|Java


`
public


class
Region
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.Region |

<br />

*** ** * ** ***

## Summary

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/graphics/Region>` | `https://developer.android.com/reference/android/graphics/Region#CREATOR` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/Region#Region()() ` Create an empty region |
| ` https://developer.android.com/reference/android/graphics/Region#Region(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect r) ` Return a region set to the specified rectangle |
| ` https://developer.android.com/reference/android/graphics/Region#Region(android.graphics.Region)(https://developer.android.com/reference/android/graphics/Region region) ` Return a copy of the specified region |
| ` https://developer.android.com/reference/android/graphics/Region#Region(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) ` Return a region set to the specified rectangle |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#contains(int,%20int)(int x, int y) ` Return true if the region contains the specified point |
| ` int` | ` https://developer.android.com/reference/android/graphics/Region#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#getBoundaryPath(android.graphics.Path)(https://developer.android.com/reference/android/graphics/Path path) ` Set the path to the boundary of the region. |
| ` https://developer.android.com/reference/android/graphics/Path` | ` https://developer.android.com/reference/android/graphics/Region#getBoundaryPath()() ` Return the boundary of the region as a new Path. |
| ` https://developer.android.com/reference/android/graphics/Rect` | ` https://developer.android.com/reference/android/graphics/Region#getBounds()() ` Return a new Rect set to the bounds of the region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#getBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect r) ` Set the Rect to the bounds of the region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#isComplex()() ` Return true if the region contains more than one rectangle |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#isEmpty()() ` Return true if this region is empty |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#isRect()() ` Return true if the region contains a single rectangle |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#op(android.graphics.Region,%20android.graphics.Region,%20android.graphics.Region.Op)(https://developer.android.com/reference/android/graphics/Region region1, https://developer.android.com/reference/android/graphics/Region region2, https://developer.android.com/reference/android/graphics/Region.Op op) ` Set this region to the result of performing the Op on the specified regions. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#op(android.graphics.Rect,%20android.graphics.Region.Op)(https://developer.android.com/reference/android/graphics/Rect r, https://developer.android.com/reference/android/graphics/Region.Op op) ` Perform the specified Op on this region and the specified rect. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#op(android.graphics.Rect,%20android.graphics.Region,%20android.graphics.Region.Op)(https://developer.android.com/reference/android/graphics/Rect rect, https://developer.android.com/reference/android/graphics/Region region, https://developer.android.com/reference/android/graphics/Region.Op op) ` Set this region to the result of performing the Op on the specified rect and region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#op(android.graphics.Region,%20android.graphics.Region.Op)(https://developer.android.com/reference/android/graphics/Region region, https://developer.android.com/reference/android/graphics/Region.Op op) ` Perform the specified Op on this region and the specified region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#op(int,%20int,%20int,%20int,%20android.graphics.Region.Op)(int left, int top, int right, int bottom, https://developer.android.com/reference/android/graphics/Region.Op op) ` Perform the specified Op on this region and the specified rect. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#quickContains(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect r) ` Return true if the region is a single rectangle (not complex) and it contains the specified rectangle. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#quickContains(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) ` Return true if the region is a single rectangle (not complex) and it contains the specified rectangle. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#quickReject(android.graphics.Region)(https://developer.android.com/reference/android/graphics/Region rgn) ` Return true if the region is empty, or if the specified region does not intersect the region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#quickReject(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect r) ` Return true if the region is empty, or if the specified rectangle does not intersect the region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#quickReject(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) ` Return true if the region is empty, or if the specified rectangle does not intersect the region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#set(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) ` Set the region to the specified rectangle |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#set(android.graphics.Region)(https://developer.android.com/reference/android/graphics/Region region) ` Set the region to the specified region. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#set(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect r) ` Set the region to the specified rectangle |
| ` void` | ` https://developer.android.com/reference/android/graphics/Region#setEmpty()() ` Set the region to the empty region |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Region#setPath(android.graphics.Path,%20android.graphics.Region)(https://developer.android.com/reference/android/graphics/Path path, https://developer.android.com/reference/android/graphics/Region clip) ` Set the region to the area described by the path and clip. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/graphics/Region#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Region#translate(int,%20int,%20android.graphics.Region)(int dx, int dy, https://developer.android.com/reference/android/graphics/Region dst) ` Set the dst region to the result of translating this region by \[dx, dy\]. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Region#translate(int,%20int)(int dx, int dy) ` Translate the region by \[dx, dy\]. |
| ` final boolean` | ` https://developer.android.com/reference/android/graphics/Region#union(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect r) ` |
| ` void` | ` https://developer.android.com/reference/android/graphics/Region#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel p, int flags) ` Write the region and its pixels to the parcel. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/graphics/Region#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<Region> CREATOR
```

<br />

<br />

## Public constructors

### Region

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Region ()
```

Create an empty region

<br />

### Region

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Region (Rect r)
```

Return a region set to the specified rectangle

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |

### Region

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Region (Region region)
```

Return a copy of the specified region

<br />

| Parameters ||
|---|---|
| `region` | `Region`: This value cannot be `null`. <br /> |

### Region

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Region (int left, 
                int top, 
                int right, 
                int bottom)
```

Return a region set to the specified rectangle

<br />

| Parameters ||
|---|---|
| `left` | `int` <br /> |
| `top` | `int` <br /> |
| `right` | `int` <br /> |
| `bottom` | `int` <br /> |

## Public methods

### contains

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean contains (int x, 
                int y)
```

Return true if the region contains the specified point

<br />

| Parameters ||
|---|---|
| `x` | `int` <br /> |
| `y` | `int` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### describeContents

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object obj)
```

Indicates whether some other object is "equal to" this one.


The `equals` method implements an equivalence relation
on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.


An equivalence relation partitions the elements it operates on
into *equivalence classes*; all the members of an
equivalence class are equal to each other. Members of an
equivalence class are substitutable for each other, at least
for some purposes.

<br />

| Parameters ||
|---|---|
| `obj` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getBoundaryPath

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getBoundaryPath (Path path)
```

Set the path to the boundary of the region. If the region is empty, the
path will also be empty.

<br />

| Parameters ||
|---|---|
| `path` | `Path`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### getBoundaryPath

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Path getBoundaryPath ()
```

Return the boundary of the region as a new Path. If the region is empty,
the path will also be empty.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Path` | This value cannot be `null`. <br /> |

### getBounds

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Rect getBounds ()
```

Return a new Rect set to the bounds of the region. If the region is
empty, the Rect will be set to \[0, 0, 0, 0\]

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Rect` | This value cannot be `null`. <br /> |

### getBounds

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getBounds (Rect r)
```

Set the Rect to the bounds of the region. If the region is empty, the
Rect will be set to \[0, 0, 0, 0\]

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### isComplex

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isComplex ()
```

Return true if the region contains more than one rectangle

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isEmpty

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isEmpty ()
```

Return true if this region is empty

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isRect

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isRect ()
```

Return true if the region contains a single rectangle

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### op

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean op (Region region1, 
                Region region2, 
                Region.Op op)
```

Set this region to the result of performing the Op on the specified
regions. Return true if the result is not empty.

<br />

| Parameters ||
|---|---|
| `region1` | `Region`: This value cannot be `null`. <br /> |
| `region2` | `Region`: This value cannot be `null`. <br /> |
| `op` | `Region.Op`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### op

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean op (Rect r, 
                Region.Op op)
```

Perform the specified Op on this region and the specified rect. Return
true if the result of the op is not empty.

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |
| `op` | `Region.Op`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### op

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean op (Rect rect, 
                Region region, 
                Region.Op op)
```

Set this region to the result of performing the Op on the specified rect
and region. Return true if the result is not empty.

<br />

| Parameters ||
|---|---|
| `rect` | `Rect`: This value cannot be `null`. <br /> |
| `region` | `Region`: This value cannot be `null`. <br /> |
| `op` | `Region.Op`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### op

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean op (Region region, 
                Region.Op op)
```

Perform the specified Op on this region and the specified region. Return
true if the result of the op is not empty.

<br />

| Parameters ||
|---|---|
| `region` | `Region`: This value cannot be `null`. <br /> |
| `op` | `Region.Op`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### op

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean op (int left, 
                int top, 
                int right, 
                int bottom, 
                Region.Op op)
```

Perform the specified Op on this region and the specified rect. Return
true if the result of the op is not empty.

<br />

| Parameters ||
|---|---|
| `left` | `int` <br /> |
| `top` | `int` <br /> |
| `right` | `int` <br /> |
| `bottom` | `int` <br /> |
| `op` | `Region.Op`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### quickContains

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean quickContains (Rect r)
```

Return true if the region is a single rectangle (not complex) and it
contains the specified rectangle. Returning false is not a guarantee
that the rectangle is not contained by this region, but return true is a
guarantee that the rectangle is contained by this region.

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### quickContains

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean quickContains (int left, 
                int top, 
                int right, 
                int bottom)
```

Return true if the region is a single rectangle (not complex) and it
contains the specified rectangle. Returning false is not a guarantee
that the rectangle is not contained by this region, but return true is a
guarantee that the rectangle is contained by this region.

<br />

| Parameters ||
|---|---|
| `left` | `int` <br /> |
| `top` | `int` <br /> |
| `right` | `int` <br /> |
| `bottom` | `int` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### quickReject

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean quickReject (Region rgn)
```

Return true if the region is empty, or if the specified region does not
intersect the region. Returning false is not a guarantee that they
intersect, but returning true is a guarantee that they do not.

<br />

| Parameters ||
|---|---|
| `rgn` | `Region` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### quickReject

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean quickReject (Rect r)
```

Return true if the region is empty, or if the specified rectangle does
not intersect the region. Returning false is not a guarantee that they
intersect, but returning true is a guarantee that they do not.

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### quickReject

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean quickReject (int left, 
                int top, 
                int right, 
                int bottom)
```

Return true if the region is empty, or if the specified rectangle does
not intersect the region. Returning false is not a guarantee that they
intersect, but returning true is a guarantee that they do not.

<br />

| Parameters ||
|---|---|
| `left` | `int` <br /> |
| `top` | `int` <br /> |
| `right` | `int` <br /> |
| `bottom` | `int` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean set (int left, 
                int top, 
                int right, 
                int bottom)
```

Set the region to the specified rectangle

<br />

| Parameters ||
|---|---|
| `left` | `int` <br /> |
| `top` | `int` <br /> |
| `right` | `int` <br /> |
| `bottom` | `int` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean set (Region region)
```

Set the region to the specified region.

<br />

| Parameters ||
|---|---|
| `region` | `Region`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean set (Rect r)
```

Set the region to the specified rectangle

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### setEmpty

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setEmpty ()
```

Set the region to the empty region

<br />

### setPath

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setPath (Path path, 
                Region clip)
```

Set the region to the area described by the path and clip.
Return true if the resulting region is non-empty. This produces a region
that is identical to the pixels that would be drawn by the path
(with no antialiasing).

<br />

| Parameters ||
|---|---|
| `path` | `Path`: This value cannot be `null`. <br /> |
| `clip` | `Region`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### translate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void translate (int dx, 
                int dy, 
                Region dst)
```

Set the dst region to the result of translating this region by \[dx, dy\].
If this region is empty, then dst will be set to empty.

<br />

| Parameters ||
|---|---|
| `dx` | `int` <br /> |
| `dy` | `int` <br /> |
| `dst` | `Region` <br /> |

### translate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void translate (int dx, 
                int dy)
```

Translate the region by \[dx, dy\]. If the region is empty, do nothing.

<br />

| Parameters ||
|---|---|
| `dx` | `int` <br /> |
| `dy` | `int` <br /> |

### union

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final boolean union (Rect r)
```

<br />

<br />

| Parameters ||
|---|---|
| `r` | `Rect`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### writeToParcel

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel p, 
                int flags)
```

Write the region and its pixels to the parcel. The region can be
rebuilt from the parcel by calling CREATOR.createFromParcel().

<br />

| Parameters ||
|---|---|
| `p` | `Parcel`: Parcel object to write the region data into <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |

## Protected methods

### finalize

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected void finalize ()
```

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
A subclass overrides the `finalize` method to dispose of
system resources or to perform other cleanup.


The general contract of `finalize` is that it is invoked
if and when the Java virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The `finalize` method may take any action, including
making this object available again to other threads; the usual purpose
of `finalize`, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.


The `finalize` method of class `Object` performs no
special action; it simply returns normally. Subclasses of
`Object` may override this definition.


The Java programming language does not guarantee which thread will
invoke the `finalize` method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.


After the `finalize` method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.


The `finalize` method is never invoked more than once by a Java
virtual machine for any given object.


Any exception thrown by the `finalize` method causes
the finalization of this object to be halted, but is otherwise
ignored.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/Throwable` |   |