Size

interface Size : Comparable<Size>

Represents a rectangular area in a 2D space. This class is immutable and cannot change its internal state after creation. Size supports destructuring to width and height.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

compareTo
Link copied to clipboard
common
abstract operator fun compareTo(other: Size): Int
component1
Link copied to clipboard
common
open operator fun component1(): Int
component2
Link copied to clipboard
common
open operator fun component2(): Int
containsPosition
Link copied to clipboard
common
abstract fun containsPosition(position: Position): Boolean
Tells whether this Size contains the given Position.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
fetchBottomLeftPosition
Link copied to clipboard
common
abstract fun fetchBottomLeftPosition(): Position
fetchBottomRightPosition
Link copied to clipboard
common
abstract fun fetchBottomRightPosition(): Position
fetchBoundingBoxPositions
Link copied to clipboard
common
abstract fun fetchBoundingBoxPositions(): Set<Position>
Creates a list of Positions which represent the bounding box of this size.
fetchPositions
Link copied to clipboard
common
abstract fun fetchPositions(): Iterable<Position>
Creates a list of Positions in the order in which they should be iterated when drawing (first rows, then columns in those rows).
fetchTopLeftPosition
Link copied to clipboard
common
abstract fun fetchTopLeftPosition(): Position
fetchTopRightPosition
Link copied to clipboard
common
abstract fun fetchTopRightPosition(): Position
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
max
Link copied to clipboard
common
abstract fun max(other: Size): Size
Takes a different Size and returns a new Size that has the largest dimensions of the two, measured separately.
min
Link copied to clipboard
common
abstract fun min(other: Size): Size
Takes a different Size and returns a new Size that has the smallest dimensions of the two, measured separately.
minus
Link copied to clipboard
common
abstract operator fun minus(other: Size): Size
plus
Link copied to clipboard
common
abstract operator fun plus(other: Size): Size
to3DSize
Link copied to clipboard
common
open fun to3DSize(zLength: Int = 0): Size3D
Creates a new Size3D from this Size and the given zLength.
toPosition
Link copied to clipboard
common
abstract fun toPosition(): Position
toRect
Link copied to clipboard
common
abstract fun toRect(): Rect
Converts this Size to a Rect using Position.zero.
abstract fun toRect(position: Position): Rect
Converts this Size to a Rect with the given Position.
toSize3D
Link copied to clipboard
common
open fun toSize3D(zLength: Int = 0): Size3D
Creates a new Size3D from this Size and the given zLength.
toString
Link copied to clipboard
common
open fun toString(): String
with
Link copied to clipboard
common
abstract fun with(size: Size): Size
Returns itself if it is equal to the supplied size, otherwise the supplied size.
withHeight
Link copied to clipboard
common
abstract fun withHeight(height: Int): Size
Creates a new size based on this size, but with a different height.
withRelative
Link copied to clipboard
common
abstract fun withRelative(delta: Size): Size
Creates a new Size object representing a size based on this object's size but with a delta applied.
withRelativeHeight
Link copied to clipboard
common
abstract fun withRelativeHeight(delta: Int): Size
Creates a new Size object representing a size with the same number of width, but with a height size offset by a supplied value.
withRelativeWidth
Link copied to clipboard
common
abstract fun withRelativeWidth(delta: Int): Size
Creates a new Size object representing a size with the same number of height, but with a width size offset by a supplied value.
withWidth
Link copied to clipboard
common
abstract fun withWidth(width: Int): Size
Creates a new size based on this size, but with a different width.

Properties

height
Link copied to clipboard
common
abstract val height: Int
isNotUnknown
Link copied to clipboard
common
abstract val isNotUnknown: Boolean
Tells whether this Sizeis not the same as Size.unknown.
isUnknown
Link copied to clipboard
common
abstract val isUnknown: Boolean
Tells whether this Sizeis the same as Size.unknown.
width
Link copied to clipboard
common
abstract val width: Int

Inheritors

BaseSize
Link copied to clipboard

Sources

(source)
Link copied to clipboard