DpOffset
DpOffset
value class DpOffset(val packedValue: Long)
A two-dimensional offset using Dp for units.
To create a DpOffset, call the top-level function that accepts an x/y pair of coordinates:
val offset = DpOffset(x, y)
The primary constructor of DpOffset is intended to be used with the packedValue property to
allow storing offsets in arrays or collections of primitives without boxing.
Parameters
| packedValue | Long value encoding the x and y components of the DpOffset. Encoded values can be obtained by using the packedValue property of existing DpOffset instances. |
Properties
val x: Dp
The horizontal aspect of the offset in Dp
val y: Dp
The vertical aspect of the offset in Dp
Functions
fun copy(x: Dp = this.x, y: Dp = this.y): DpOffset
Returns a copy of this DpOffset instance optionally overriding the x or y parameter
operator fun minus(other: DpOffset) =
DpOffset(packFloats((x - other.x).value, (y - other.y).value))
Subtract a DpOffset from another one.
operator fun plus(other: DpOffset) =
DpOffset(packFloats((x + other.x).value, (y + other.y).value))
Add a DpOffset to another one.
Companion Object
Properties
val Zero = DpOffset(0x0L)
A DpOffset with 0 DP x and 0 DP y values.
val Unspecified = DpOffset(0x7fc00000_7fc00000L)
Represents an offset whose x and y are unspecified. This is usually a replacement for
null when a primitive value is desired. Access to x or y on an unspecified offset
is not allowed.
