Region | API reference | Android Developers (original) (raw)
open class Region : Parcelable
Summary
Nested classes |
---|
Op |
Inherited constants |
---|
From class Parcelable Int CONTENTS_FILE_DESCRIPTOR Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor. Int PARCELABLE_WRITE_RETURN_VALUE Flag for use with writeToParcel: 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)". Some implementations may want to release resources at this point. |
Public constructors |
---|
Region() Create an empty region |
Region(r: Rect) Return a region set to the specified rectangle |
Region(region: Region) Return a copy of the specified region |
Region(left: Int, top: Int, right: Int, bottom: Int) Return a region set to the specified rectangle |
Public methods | |
---|---|
open Boolean | contains(x: Int, y: Int) Return true if the region contains the specified point |
open Int | describeContents() |
open Boolean | equals(other: Any?) |
open Path | getBoundaryPath() Return the boundary of the region as a new Path. |
open Boolean | getBoundaryPath(path: Path) Set the path to the boundary of the region. |
open Rect | getBounds() Return a new Rect set to the bounds of the region. |
open Boolean | getBounds(r: Rect) Set the Rect to the bounds of the region. |
open Boolean | isComplex() Return true if the region contains more than one rectangle |
open Boolean | isEmpty() Return true if this region is empty |
open Boolean | isRect() Return true if the region contains a single rectangle |
open Boolean | op(rect: Rect, region: Region, op: Region.Op) Set this region to the result of performing the Op on the specified rect and region. |
open Boolean | op(r: Rect, op: Region.Op) Perform the specified Op on this region and the specified rect. |
open Boolean | op(region1: Region, region2: Region, op: Region.Op) Set this region to the result of performing the Op on the specified regions. |
open Boolean | op(region: Region, op: Region.Op) Perform the specified Op on this region and the specified region. |
open Boolean | op(left: Int, top: Int, right: Int, bottom: Int, op: Region.Op) Perform the specified Op on this region and the specified rect. |
open Boolean | quickContains(r: Rect) Return true if the region is a single rectangle (not complex) and it contains the specified rectangle. |
open Boolean | quickContains(left: Int, top: Int, right: Int, bottom: Int) Return true if the region is a single rectangle (not complex) and it contains the specified rectangle. |
open Boolean | quickReject(r: Rect) Return true if the region is empty, or if the specified rectangle does not intersect the region. |
open Boolean | quickReject(rgn: Region!) Return true if the region is empty, or if the specified region does not intersect the region. |
open Boolean | quickReject(left: Int, top: Int, right: Int, bottom: Int) Return true if the region is empty, or if the specified rectangle does not intersect the region. |
open Boolean | set(r: Rect) Set the region to the specified rectangle |
open Boolean | set(region: Region) Set the region to the specified region. |
open Boolean | set(left: Int, top: Int, right: Int, bottom: Int) Set the region to the specified rectangle |
open Unit | setEmpty() Set the region to the empty region |
open Boolean | setPath(path: Path, clip: Region) Set the region to the area described by the path and clip. |
open String | toString() |
open Unit | translate(dx: Int, dy: Int) Translate the region by [dx, dy]. |
open Unit | translate(dx: Int, dy: Int, dst: Region!) Set the dst region to the result of translating this region by [dx, dy]. |
Boolean | union(r: Rect) |
open Unit | writeToParcel(p: Parcel, flags: Int) Write the region and its pixels to the parcel. |
Protected methods | |
---|---|
open Unit | finalize() |
Properties | |
---|---|
static Parcelable.Creator<Region!> | CREATOR |
Public constructors
Region
Region()
Create an empty region
Region
Region(r: Rect)
Return a region set to the specified rectangle
Parameters | |
---|---|
r | Rect: This value cannot be null. |
Region
Region(region: Region)
Return a copy of the specified region
Parameters | |
---|---|
region | Region: This value cannot be null. |
Region
Region(
left: Int,
top: Int,
right: Int,
bottom: Int)
Return a region set to the specified rectangle
Public methods
contains
open fun contains(
x: Int,
y: Int
): Boolean
Return true if the region contains the specified point
equals
open fun equals(other: Any?): Boolean
Parameters | |
---|---|
obj | the reference object with which to compare. |
Return | |
---|---|
Boolean | true if this object is the same as the obj argument; false otherwise. |
getBoundaryPath
open fun getBoundaryPath(): Path
Return the boundary of the region as a new Path. If the region is empty, the path will also be empty.
Return | |
---|---|
Path | This value cannot be null. |
getBoundaryPath
open fun getBoundaryPath(path: Path): Boolean
Set the path to the boundary of the region. If the region is empty, the path will also be empty.
Parameters | |
---|---|
path | Path: This value cannot be null. |
getBounds
open fun getBounds(): Rect
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]
Return | |
---|---|
Rect | This value cannot be null. |
getBounds
open fun getBounds(r: Rect): Boolean
Set the Rect to the bounds of the region. If the region is empty, the Rect will be set to [0, 0, 0, 0]
Parameters | |
---|---|
r | Rect: This value cannot be null. |
isComplex
open fun isComplex(): Boolean
Return true if the region contains more than one rectangle
isEmpty
open fun isEmpty(): Boolean
Return true if this region is empty
isRect
open fun isRect(): Boolean
Return true if the region contains a single rectangle
op
open fun op(
rect: Rect,
region: Region,
op: Region.Op
): Boolean
Set this region to the result of performing the Op on the specified rect and region. Return true if the result is not empty.
Parameters | |
---|---|
rect | Rect: This value cannot be null. |
region | Region: This value cannot be null. |
op | Region.Op: This value cannot be null. |
op
open fun op(
r: Rect,
op: Region.Op
): Boolean
Perform the specified Op on this region and the specified rect. Return true if the result of the op is not empty.
Parameters | |
---|---|
r | Rect: This value cannot be null. |
op | Region.Op: This value cannot be null. |
op
open fun op(
region1: Region,
region2: Region,
op: Region.Op
): Boolean
Set this region to the result of performing the Op on the specified regions. Return true if the result is not empty.
Parameters | |
---|---|
region1 | Region: This value cannot be null. |
region2 | Region: This value cannot be null. |
op | Region.Op: This value cannot be null. |
op
open fun op(
region: Region,
op: Region.Op
): Boolean
Perform the specified Op on this region and the specified region. Return true if the result of the op is not empty.
Parameters | |
---|---|
region | Region: This value cannot be null. |
op | Region.Op: This value cannot be null. |
op
open fun op(
left: Int,
top: Int,
right: Int,
bottom: Int,
op: Region.Op
): Boolean
Perform the specified Op on this region and the specified rect. Return true if the result of the op is not empty.
Parameters | |
---|---|
op | Region.Op: This value cannot be null. |
quickContains
open fun quickContains(r: Rect): Boolean
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.
Parameters | |
---|---|
r | Rect: This value cannot be null. |
quickContains
open fun quickContains(
left: Int,
top: Int,
right: Int,
bottom: Int
): Boolean
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.
quickReject
open fun quickReject(r: Rect): Boolean
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.
Parameters | |
---|---|
r | Rect: This value cannot be null. |
quickReject
open fun quickReject(rgn: Region!): Boolean
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.
quickReject
open fun quickReject(
left: Int,
top: Int,
right: Int,
bottom: Int
): Boolean
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.
set
open fun set(r: Rect): Boolean
Set the region to the specified rectangle
Parameters | |
---|---|
r | Rect: This value cannot be null. |
set
open fun set(region: Region): Boolean
Set the region to the specified region.
Parameters | |
---|---|
region | Region: This value cannot be null. |
set
open fun set(
left: Int,
top: Int,
right: Int,
bottom: Int
): Boolean
Set the region to the specified rectangle
setEmpty
open fun setEmpty(): Unit
Set the region to the empty region
setPath
open fun setPath(
path: Path,
clip: Region
): Boolean
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).
Parameters | |
---|---|
path | Path: This value cannot be null. |
clip | Region: This value cannot be null. |
toString
open fun toString(): String
Return | |
---|---|
String | a string representation of the object. |
translate
open fun translate(
dx: Int,
dy: Int
): Unit
Translate the region by [dx, dy]. If the region is empty, do nothing.
translate
open fun translate(
dx: Int,
dy: Int,
dst: Region!
): Unit
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.
union
Parameters | |
---|---|
r | Rect: This value cannot be null. |
writeToParcel
open fun writeToParcel(
p: Parcel,
flags: Int
): Unit
Write the region and its pixels to the parcel. The region can be rebuilt from the parcel by calling CREATOR.createFromParcel().
Parameters | |
---|---|
dest | The Parcel in which the object should be written. This value cannot be null. |
flags | Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
p | Parcel: Parcel object to write the region data into |
Protected methods
finalize
protected open fun finalize(): Unit
Exceptions | |
---|---|
java.lang.Throwable | the Exception raised by this method |