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

DpCubed

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

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

Public methods
operator Int

Support comparing DpCubed with comparison operators.

operator DpCubed
div(other: Float)

Divide a DpCubed by a scalar.

operator DpSquared
div(other: Dp)

Divide by a Dp to get a DpSquared result.

operator Dp
div(other: DpSquared)

Divide by a DpSquared to get a Dp result.

operator Float
div(other: DpCubed)

Divide by a DpCubed to get a scalar result.

operator DpCubed
minus(dimension: DpCubed)

Subtract a DpCubed from another one.

operator DpCubed
plus(dimension: DpCubed)

Add two DpCubed together.

operator DpCubed
times(other: Float)

Multiply by a scalar to get a DpCubed result.

String

Inherited extension functions
From androidx.core.util
infix Range<T>
T.rangeTo(that: T)

Creates a range from this Comparable value to that.

Properties
Float

Public constructors

<init>

DpCubed(value: Float)

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

@Stable operator fun compareTo(other: DpCubed): Int

Support comparing DpCubed with comparison operators.

div

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

Divide a DpCubed by a scalar.

div

@Stable inline operator fun div(other: Dp): DpSquared

Divide by a Dp to get a DpSquared result.

div

@Stable inline operator fun div(other: DpSquared): Dp

Divide by a DpSquared to get a Dp result.

div

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

Divide by a DpCubed to get a scalar result.

minus

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

Subtract a DpCubed from another one.

plus

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

Add two DpCubed together.

times

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

Multiply by a scalar to get a DpCubed result.

toString

@Stable fun toString(): String

Properties

value

val value: Float