public class DpOffset(public 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
x
public val x: Dp
The horizontal aspect of the offset in Dp
y
public val y: Dp
The vertical aspect of the offset in Dp
Functions
copy
public 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
minus
public operator fun minus(other: DpOffset): DpOffset
Subtract a DpOffset from another one.
plus
public operator fun plus(other: DpOffset): DpOffset
Add a DpOffset to another one.
Members
Companion
public companion object
Properties
Zero
public val Zero: DpOffset
A DpOffset with 0 DP x and 0 DP y values.
Unspecified
public val Unspecified: DpOffset
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.