PxInverse
@Immutable inline class PxInverse : Comparable<PxInverse>
kotlin.Any | |
↳ | androidx.compose.ui.unit.PxInverse |
Holds a unit of an inverse dimensions, such as 1.px / (2.value * 3.px)
. PxSquared,
PxCubed, and PxInverse are used primarily for pixel calculations to
ensure resulting units are as expected. Many times, pixel 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 an inverse dimensions, such as |
Public methods | |
---|---|
operator Int |
Support comparing PxInverse with comparison operators. |
operator PxInverse |
Divide a PxInverse by a scalar. |
operator PxInverse |
Subtract a PxInverse from another one. |
operator PxInverse |
Add two PxInverse together. |
operator PxInverse |
Multiply by a scalar to get a PxInverse result. |
operator PxSquared | |
String |
toString() |
Inherited extension functions | ||
---|---|---|
From androidx.core.util
|
Properties | |
---|---|
Float |
Public constructors
<init>
PxInverse(value: Float)
Holds a unit of an inverse dimensions, such as 1.px / (2.value * 3.px)
. PxSquared,
PxCubed, and PxInverse are used primarily for pixel calculations to
ensure resulting units are as expected. Many times, pixel 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
@Stable operator fun compareTo(other: PxInverse): Int
Support comparing PxInverse with comparison operators.
minus
@Stable inline operator fun minus(dimension: PxInverse): PxInverse
Subtract a PxInverse from another one.
times
@Stable inline operator fun times(other: Float): PxInverse
Multiply by a scalar to get a PxInverse result.
toString
@Stable fun toString(): String
Properties
value
val value: Float