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

PxCubed

@Immutable inline class PxCubed : Comparable<PxCubed>
kotlin.Any
   ↳ androidx.ui.unit.PxCubed

Holds a unit of cubed dimensions, such as 1.value * 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 cubed dimensions, such as 1.value * 2.value * 3.px.

Public methods
operator Int

Support comparing PxCubed with comparison operators.

operator PxCubed
div(other: Float)

Divide a PxCubed by a scalar.

operator Float
div(other: PxCubed)

Divide by a PxCubed to get a scalar result.

operator PxCubed
minus(dimension: PxCubed)

Subtract a PxCubed from another one.

operator PxCubed
plus(dimension: PxCubed)

Add two PxCubed together.

operator PxCubed
times(other: Float)

Multiply by a scalar to get a PxCubed result.

String

Properties
Float

Public constructors

<init>

PxCubed(value: Float)

Holds a unit of cubed dimensions, such as 1.value * 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: PxCubed): Int

Support comparing PxCubed with comparison operators.

div

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

Divide a PxCubed by a scalar.

div

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

Divide by a PxCubed to get a scalar result.

minus

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

Subtract a PxCubed from another one.

plus

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

Add two PxCubed together.

times

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

Multiply by a scalar to get a PxCubed result.

toString

@Stable fun toString(): String

Properties

value

val value: Float