DpSize

Class

Common
value class DpSize internal constructor(@PublishedApi internal val packedValue: Long)

A two-dimensional Size using Dp for units

Properties

Common
val width: Dp

The horizontal aspect of the Size in Dp

Common
val height: Dp

The vertical aspect of the Size in Dp

Functions

fun copy(width: Dp = this.width, height: Dp = this.height): DpSize

Returns a copy of this DpSize instance optionally overriding the width or height parameter

operator fun minus(other: DpSize) =
        DpSize(packFloats((width - other.width).value, (height - other.height).value))

Subtract a DpSize from another one.

operator fun plus(other: DpSize) =
        DpSize(packFloats((width + other.width).value, (height + other.height).value))

Add a DpSize to another one.

inline operator fun component1(): Dp
inline operator fun component2(): Dp
operator fun times(other: Int): DpSize
operator fun times(other: Float): DpSize
operator fun div(other: Int): DpSize
operator fun div(other: Float): DpSize

Companion Object

Properties

Common
val Zero = DpSize(0x0L)

A DpSize with 0 DP width and 0 DP height values.

Common
val Unspecified = DpSize(0x7fc00000_7fc00000L)

A size whose width and height are unspecified. This is usually a replacement for null when a primitive value is desired. Access to width or height on an unspecified size is not allowed.