Google is committed to advancing racial equity for Black communities. See how.

PxInverse

@Immutable inline class PxInverse : Comparable<PxInverse>
kotlin.Any
   ↳ androidx.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
<init>(value: Float)

Holds a unit of an inverse dimensions, such as 1.px / (2.value * 3.px).

Public methods
operator Int

Support comparing PxInverse with comparison operators.

operator PxInverse
div(other: Float)

Divide a PxInverse by a scalar.

operator PxInverse
minus(dimension: PxInverse)

Subtract a PxInverse from another one.

operator PxInverse
plus(dimension: PxInverse)

Add two PxInverse together.

operator PxInverse
times(other: Float)

Multiply by a scalar to get a PxInverse result.

operator PxSquared
times(other: PxCubed)

Multiply by a PxCubed to get a PxSquared result.

String

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.

div

@Stable inline operator fun div(other: Float): PxInverse

Divide a PxInverse by a scalar.

minus

@Stable inline operator fun minus(dimension: PxInverse): PxInverse

Subtract a PxInverse from another one.

plus

@Stable inline operator fun plus(dimension: PxInverse): PxInverse

Add two PxInverse together.

times

@Stable inline operator fun times(other: Float): PxInverse

Multiply by a scalar to get a PxInverse result.

times

@Stable inline operator fun times(other: PxCubed): PxSquared

Multiply by a PxCubed to get a PxSquared result.

toString

@Stable fun toString(): String

Properties

value

val value: Float