Android 12 Developer Preview is here! Try it out, and give us your feedback!

ScaleFactor

@Immutable inline class ScaleFactor
kotlin.Any
   ↳ androidx.compose.ui.layout.ScaleFactor

Holds 2 dimensional scaling factors for horizontal and vertical axes

Summary

Public methods
operator Float

operator Float

ScaleFactor
copy(scaleX: Float = this.scaleX, scaleY: Float = this.scaleY)

Returns a copy of this ScaleFactor instance optionally overriding the scaleX or scaleY parameters

operator ScaleFactor
div(operand: Float)

Division operator.

operator ScaleFactor
times(operand: Float)

Multiplication operator.

String

Extension functions
From androidx.compose.ui.layout
ScaleFactor

If this ScaleFactor then this is returned, otherwise block is executed and its result is returned.

operator Size

Multiplication operator with Size with reverse parameter types to maintain commutative properties of multiplication

Properties
Float

Returns the scale factor to apply along the horizontal axis

Float

Returns the scale factor to apply along the vertical axis

Companion properties
ScaleFactor

A ScaleFactor whose scaleX and scaleY parameters are unspecified.

Extension properties
From androidx.compose.ui.layout
Boolean

false when this is ScaleFactor.Unspecified.

Boolean

true when this is ScaleFactor.Unspecified.

Public methods

component1

@Stable inline operator fun component1(): Float

component2

@Stable inline operator fun component2(): Float

copy

fun copy(
    scaleX: Float = this.scaleX,
    scaleY: Float = this.scaleY
): ScaleFactor

Returns a copy of this ScaleFactor instance optionally overriding the scaleX or scaleY parameters

div

@Stable operator fun div(operand: Float): ScaleFactor

Division operator.

Returns a ScaleFactor with scale x and y values divided by the operand

times

@Stable operator fun times(operand: Float): ScaleFactor

Multiplication operator.

Returns a ScaleFactor with scale x and y values multiplied by the operand

toString

fun toString(): String

Properties

scaleX

@Stable val scaleX: Float

Returns the scale factor to apply along the horizontal axis

scaleY

@Stable val scaleY: Float

Returns the scale factor to apply along the vertical axis

Companion properties

Unspecified

@Stable val Unspecified: ScaleFactor

A ScaleFactor whose scaleX and scaleY parameters are unspecified. This is a sentinel value used to initialize a non-null parameter. Access to scaleX or scaleY on an unspecified size is not allowed