🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

DpOffset

A two-dimensional offset using Dp for units.

Source set: Common
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

Source set: Common
public val x: Dp

The horizontal aspect of the offset in Dp

y

Source set: Common
public val y: Dp

The vertical aspect of the offset in Dp

Functions

copy

Source set: Common
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

Source set: Common
public operator fun minus(other: DpOffset): DpOffset

Subtract a DpOffset from another one.

plus

Source set: Common
public operator fun plus(other: DpOffset): DpOffset

Add a DpOffset to another one.

Members

Companion

Source set: Common
public companion object

Properties

Zero

Source set: Common
public val Zero: DpOffset

A DpOffset with 0 DP x and 0 DP y values.

Unspecified

Source set: Common
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.