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 |
|
---|---|
Holds a unit of squared dimensions, such as |
Public methods |
|
---|---|
operator Int |
Support comparing DpSquared with comparison operators. |
operator DpSquared |
Divide a DimensionSquare by a scalar. |
operator Dp | |
operator Float |
Divide by a DpSquared to get a scalar result. |
operator DpInverse | |
operator DpSquared |
Subtract a DimensionSquare from another one. |
operator DpSquared |
Add two DimensionSquares together. |
operator DpSquared |
Multiply by a scalar to get a DpSquared result. |
operator DpCubed |
Multiply by a scalar to get a DpSquared result. |
String |
toString() |
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.
minus
inline operator fun minus(other: DpSquared): DpSquared
Subtract a DimensionSquare from another one.
times
inline operator fun times(other: Float): DpSquared
Multiply by a scalar to get a DpSquared result.
toString
fun toString(): String
Properties
value
val value: Float