Rect

interface Rect : Boundable

Represents a rectangular area with a given Size and Position on a 2D plane. Augments Boundable with additional information like topLeft and rightCenter, supports destructuring and can be copied with the with* functions.

A Rect destructures into x, y, width and height.

Note to Kotlin users: these functions/properties could have been extensions but we opted to use an interface for Java compatibility reasons.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

component1
Link copied to clipboard
common
open operator fun component1(): Int
The first component (for destructuring) is x position.
component2
Link copied to clipboard
common
open operator fun component2(): Int
The second component (for destructuring) is y position.
component3
Link copied to clipboard
common
open operator fun component3(): Int
The third component (for destructuring) is width.
component4
Link copied to clipboard
common
open operator fun component4(): Int
The fourth component (for destructuring) is height.
containsBoundable
Link copied to clipboard
common
abstract infix fun containsBoundable(boundable: Boundable): Boolean
Tells whether this boundable contains the other boundable.
containsPosition
Link copied to clipboard
common
abstract infix fun containsPosition(position: Position): Boolean
Tells whether position is within this boundable's bounds.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
fetchPositions
Link copied to clipboard
common
abstract fun fetchPositions(): Iterable<Position>
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
intersects
Link copied to clipboard
common
abstract infix fun intersects(boundable: Boundable): Boolean
Tells whether this Boundable intersects with the other boundable.
minus
Link copied to clipboard
common
abstract operator fun minus(rect: Rect): Rect
plus
Link copied to clipboard
common
abstract operator fun plus(rect: Rect): Rect
splitHorizontal
Link copied to clipboard
common
abstract fun splitHorizontal(splitAtX: Int): Pair<Rect, Rect>
splitVertical
Link copied to clipboard
common
abstract fun splitVertical(splitAtY: Int): Pair<Rect, Rect>
toString
Link copied to clipboard
common
open fun toString(): String
withHeight
Link copied to clipboard
common
abstract fun withHeight(height: Int): Rect
withPosition
Link copied to clipboard
common
abstract fun withPosition(position: Position): Rect
withRelativeHeight
Link copied to clipboard
common
abstract fun withRelativeHeight(delta: Int): Rect
withRelativePosition
Link copied to clipboard
common
abstract fun withRelativePosition(position: Position): Rect
withRelativeSize
Link copied to clipboard
common
abstract fun withRelativeSize(size: Size): Rect
withRelativeWidth
Link copied to clipboard
common
abstract fun withRelativeWidth(delta: Int): Rect
withRelativeX
Link copied to clipboard
common
abstract fun withRelativeX(delta: Int): Rect
withRelativeY
Link copied to clipboard
common
abstract fun withRelativeY(delta: Int): Rect
withSize
Link copied to clipboard
common
abstract fun withSize(size: Size): Rect
withWidth
Link copied to clipboard
common
abstract fun withWidth(width: Int): Rect
withX
Link copied to clipboard
common
abstract fun withX(x: Int): Rect
withY
Link copied to clipboard
common
abstract fun withY(y: Int): Rect

Properties

bottomCenter
Link copied to clipboard
common
abstract val bottomCenter: Position
bottomLeft
Link copied to clipboard
common
abstract val bottomLeft: Position
bottomRight
Link copied to clipboard
common
abstract val bottomRight: Position
center
Link copied to clipboard
common
abstract val center: Position
height
Link copied to clipboard
common
open override val height: Int
leftCenter
Link copied to clipboard
common
abstract val leftCenter: Position
position
Link copied to clipboard
common
open val position: Position
Shorthand for Rect.position
rect
Link copied to clipboard
common
abstract val rect: Rect
A Rect contains the coordinates and the size of a Boundable.
rightCenter
Link copied to clipboard
common
abstract val rightCenter: Position
size
Link copied to clipboard
common
abstract override val size: Size
topCenter
Link copied to clipboard
common
abstract val topCenter: Position
topLeft
Link copied to clipboard
common
abstract val topLeft: Position
topRight
Link copied to clipboard
common
abstract val topRight: Position
width
Link copied to clipboard
common
open override val width: Int
x
Link copied to clipboard
common
open val x: Int
Shorthand for Rect.x
y
Link copied to clipboard
common
open val y: Int
Shorthand for Rect.y

Inheritors

BaseRect
Link copied to clipboard

Sources

(source)
Link copied to clipboard