Region

class Region : Managed

Describes a set of pixels as either one integer rectangle or a run-length encoded set of rectangles.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
enum Op : Enum<Region.Op>

Logical operations used to combine regions.

Properties

Link copied to clipboard

Returns the union bounds of all rectangles in this region.

Link copied to clipboard
expect open val isClosed: Boolean

Check if underlying resource is closed.

Link copied to clipboard

Returns true if this region is represented by more than one rectangle.

Link copied to clipboard

Returns true if this region is empty.

Link copied to clipboard

Returns true if this region is one non-empty rectangle.

Link copied to clipboard

Functions

Link copied to clipboard

Appends the boundary outline of this region into pathBuilder.

Link copied to clipboard
expect open fun close()

Free underlying native resource, peer is useless afterwards.

Link copied to clipboard

Returns a value that increases with the number of elements in the region. Returns 0 for empty, 1 for a single rectangle, and larger values for complex regions.

Link copied to clipboard
operator fun contains(rect: IRect): Boolean

Returns true if rect is fully inside this region.

operator fun contains(region: Region): Boolean

Returns true if region is fully inside this region.

fun contains(x: Int, y: Int): Boolean

Returns true if point (x, y) is inside this region.

fun contains(left: Int, top: Int, right: Int, bottom: Int): Boolean

Returns true if rectangle (left, top, right, bottom) is fully inside this region.

Link copied to clipboard

Returns the boundary of this region as a new immutable Path.

Link copied to clipboard

Returns true if this region intersects rect.

fun intersects(region: Region): Boolean

Returns true if this region intersects region.

fun intersects(left: Int, top: Int, right: Int, bottom: Int): Boolean

Returns true if this region intersects left, top, right, bottom.

Link copied to clipboard
fun op(rect: IRect, op: Region.Op): Boolean
fun op(left: Int, top: Int, right: Int, bottom: Int, op: Region.Op): Boolean

Replaces this region with result of this op rect.

fun op(region: Region, op: Region.Op): Boolean

Replaces this region with result of this op region.

fun op(rect: IRect, region: Region, op: Region.Op): Boolean
fun op(left: Int, top: Int, right: Int, bottom: Int, region: Region, op: Region.Op): Boolean

Replaces this region with result of rect op region.

fun op(region: Region, rect: IRect, op: Region.Op): Boolean
fun op(region: Region, left: Int, top: Int, right: Int, bottom: Int, op: Region.Op): Boolean

Replaces this region with result of region op rect.

fun op(regionA: Region, regionB: Region, op: Region.Op): Boolean

Replaces this region with result of regionA op regionB.

Link copied to clipboard

Fast conservative containment check. Returns true only when this region is a single rectangle containing rect.

fun quickContains(left: Int, top: Int, right: Int, bottom: Int): Boolean

Fast conservative containment check for rectangle coordinates.

Link copied to clipboard

Fast conservative rejection check for rect.

fun quickReject(region: Region): Boolean

Fast conservative rejection check for region.

fun quickReject(left: Int, top: Int, right: Int, bottom: Int): Boolean

Fast conservative rejection check for rectangle coordinates.

Link copied to clipboard
fun set(src: Region): Boolean

Sets this region to src.

Link copied to clipboard

Sets this region to empty.

Link copied to clipboard
fun setPath(path: Path, clip: Region): Boolean

Sets this region to the rasterized outline of path clipped by clip.

Link copied to clipboard
fun setRect(rect: IRect): Boolean

Sets this region to rect. Returns true if rect is not empty.

fun setRect(left: Int, top: Int, right: Int, bottom: Int): Boolean

Sets this region to left, top, right, bottom.

Link copied to clipboard
fun setRects(rects: Array<IRect>): Boolean

Sets this region to a union of rects.

Link copied to clipboard
fun setRegion(region: Region): Boolean

Sets this region to region.

Link copied to clipboard
expect open override fun toString(): String
Link copied to clipboard
fun translate(dx: Int, dy: Int)

Offsets this region by (dx, dy).