androidx.xr.compose.unit

Classes

DpVolumeOffset

Represents the offset of an object in 3D space.

DpVolumeSize

Represents the size of a volume in density-independent pixels (Dp).

IntVolumeOffset

Represents the offset of an object in 3D space.

IntVolumeSize

Represents the size of a volume in pixels.

Meter

Represents a dimension value in meters within 3D space.

VolumeConstraints

Defines constraints for a 3D volume, specifying minimum and maximum values for width, height, and depth.

Extension functions summary

VolumeConstraints

Constrains the dimensions of this VolumeConstraints object to fit within the bounds of the other VolumeConstraints object.

Int

Constrains a given depth value to fit within the bounds of this VolumeConstraints object.

Int

Constrains a given height value to fit within the bounds of this VolumeConstraints object.

Int

Constrains a given width value to fit within the bounds of this VolumeConstraints object.

inline operator Meter
Int.div(other: Meter)

Divides an Int value by a Meter value.

inline operator Meter
Float.div(other: Meter)

Divides a Float value by a Meter value.

inline operator Meter
Double.div(other: Meter)

Divides a Double value by a Meter value.

VolumeConstraints
VolumeConstraints.offset(
    horizontal: Int,
    vertical: Int,
    depth: Int,
    resetMins: Boolean
)

Creates a new VolumeConstraints object by offsetting the minimum and maximum values of this one.

inline operator Meter
Int.times(other: Meter)

Multiplies an Int factor by a Meter value.

inline operator Meter
Float.times(other: Meter)

Multiplies a Float factor by a Meter value.

inline operator Meter
Double.times(other: Meter)

Multiplies a Double factor by a Meter value.

inline Meter

Converts a Dp value to Meter.

Extension functions

VolumeConstraints.constrain

fun VolumeConstraints.constrain(otherConstraints: VolumeConstraints): VolumeConstraints

Constrains the dimensions of this VolumeConstraints object to fit within the bounds of the other VolumeConstraints object.

Parameters
otherConstraints: VolumeConstraints

the other VolumeConstraints to constrain against.

Returns
VolumeConstraints

a new VolumeConstraints object with dimensions constrained within the bounds of otherConstraints.

VolumeConstraints.constrainDepth

fun VolumeConstraints.constrainDepth(depth: Int): Int

Constrains a given depth value to fit within the bounds of this VolumeConstraints object.

Parameters
depth: Int

the depth value to constrain.

Returns
Int

the constrained depth value, ensuring it's within the minimum and maximum depth bounds.

VolumeConstraints.constrainHeight

fun VolumeConstraints.constrainHeight(height: Int): Int

Constrains a given height value to fit within the bounds of this VolumeConstraints object.

Parameters
height: Int

the height value to constrain.

Returns
Int

the constrained height value, ensuring it's within the minimum and maximum height bounds.

VolumeConstraints.constrainWidth

fun VolumeConstraints.constrainWidth(width: Int): Int

Constrains a given width value to fit within the bounds of this VolumeConstraints object.

Parameters
width: Int

the width value to constrain.

Returns
Int

the constrained width value, ensuring it's within the minimum and maximum width bounds.

inline operator fun Int.div(other: Meter): Meter

Divides an Int value by a Meter value.

Parameters
other: Meter

the Meter value to divide by.

Returns
Meter

a new Meter representing the quotient.

inline operator fun Float.div(other: Meter): Meter

Divides a Float value by a Meter value.

Parameters
other: Meter

the Meter value to divide by.

Returns
Meter

a new Meter representing the quotient.

Double.div

inline operator fun Double.div(other: Meter): Meter

Divides a Double value by a Meter value.

Parameters
other: Meter

the Meter value to divide by.

Returns
Meter

a new Meter representing the quotient.

VolumeConstraints.offset

fun VolumeConstraints.offset(
    horizontal: Int = 0,
    vertical: Int = 0,
    depth: Int = 0,
    resetMins: Boolean = false
): VolumeConstraints

Creates a new VolumeConstraints object by offsetting the minimum and maximum values of this one.

Parameters
horizontal: Int = 0

the horizontal offset to apply.

vertical: Int = 0

the vertical offset to apply.

depth: Int = 0

the depth offset to apply.

resetMins: Boolean = false

if true, the minimum values in the new constraints will be set to 0, otherwise. they will be offset.

Returns
VolumeConstraints

a new VolumeConstraints object with offset values.

inline operator fun Int.times(other: Meter): Meter

Multiplies an Int factor by a Meter value.

Parameters
other: Meter

the Meter value to multiply by.

Returns
Meter

a new Meter representing the product.

Float.times

inline operator fun Float.times(other: Meter): Meter

Multiplies a Float factor by a Meter value.

Parameters
other: Meter

the Meter value to multiply by.

Returns
Meter

a new Meter representing the product.

Double.times

inline operator fun Double.times(other: Meter): Meter

Multiplies a Double factor by a Meter value.

Parameters
other: Meter

the Meter value to multiply by.

Returns
Meter

a new Meter representing the product.

Dp.toMeter

inline fun Dp.toMeter(): Meter

Converts a Dp value to Meter.

Handles unspecified and infinite Dp values gracefully.

Returns
Meter

the equivalent value in meters, or Meter.NaN if the Dp is unspecified, or Meter.Infinity if the Dp is infinite.