DpSquared

@Immutable inline class DpSquared : Comparable<DpSquared>
kotlin.Any
   ↳ androidx.ui.core.DpSquared

Holds a unit of squared dimensions, such as 1.value * 2.dp. DpSquared, DpCubed, and DpInverse are used primarily for Dp calculations to ensure resulting units are as expected. Many times, Dp calculations use scalars to determine the final dimension during calculation: val width = oldWidth * stretchAmount Other times, it is useful to do intermediate calculations with Dimensions directly: val width = oldWidth * newTotalWidth / oldTotalWidth

Summary

Public constructors

<init>(value: Float)

Holds a unit of squared dimensions, such as 1.value * 2.dp.

Public methods

operator Int

Support comparing DpSquared with comparison operators.

operator DpSquared
div(other: Float)

Divide a DimensionSquare by a scalar.

operator Dp
div(other: Dp)

Divide by a Dp to get a Dp result.

operator Float
div(other: DpSquared)

Divide by a DpSquared to get a scalar result.

operator DpInverse
div(other: DpCubed)

Divide by a DpCubed to get a DpInverse result.

operator DpSquared
minus(other: DpSquared)

Subtract a DimensionSquare from another one.

operator DpSquared
plus(other: DpSquared)

Add two DimensionSquares together.

operator DpSquared
times(other: Float)

Multiply by a scalar to get a DpSquared result.

operator DpCubed
times(other: Dp)

Multiply by a scalar to get a DpSquared result.

String

Properties

Float

Public constructors

<init>

DpSquared(value: Float)

Holds a unit of squared dimensions, such as 1.value * 2.dp. DpSquared, DpCubed, and DpInverse are used primarily for Dp calculations to ensure resulting units are as expected. Many times, Dp calculations use scalars to determine the final dimension during calculation: val width = oldWidth * stretchAmount Other times, it is useful to do intermediate calculations with Dimensions directly: val width = oldWidth * newTotalWidth / oldTotalWidth

Public methods

compareTo

inline operator fun compareTo(other: DpSquared): Int

Support comparing DpSquared with comparison operators.

div

inline operator fun div(other: Float): DpSquared

Divide a DimensionSquare by a scalar.

div

inline operator fun div(other: Dp): Dp

Divide by a Dp to get a Dp result.

div

inline operator fun div(other: DpSquared): Float

Divide by a DpSquared to get a scalar result.

div

inline operator fun div(other: DpCubed): DpInverse

Divide by a DpCubed to get a DpInverse result.

minus

inline operator fun minus(other: DpSquared): DpSquared

Subtract a DimensionSquare from another one.

plus

inline operator fun plus(other: DpSquared): DpSquared

Add two DimensionSquares together.

times

inline operator fun times(other: Float): DpSquared

Multiply by a scalar to get a DpSquared result.

times

inline operator fun times(other: Dp): DpCubed

Multiply by a scalar to get a DpSquared result.

toString

fun toString(): String

Properties

value

val value: Float