{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ScaleFactor

value public final class ScaleFactor


Holds 2 dimensional scaling factors for horizontal and vertical axes

Summary

Nested types

public static class ScaleFactor.Companion

Public methods

final float
final float
final @NonNull ScaleFactor
copy(float scaleX, float scaleY)

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

final @NonNull ScaleFactor
div(float operand)

Division operator.

final float

Returns the scale factor to apply along the horizontal axis

final float

Returns the scale factor to apply along the vertical axis

final @NonNull ScaleFactor
times(float operand)

Multiplication operator.

@NonNull String

Extension functions

final boolean

false when this is ScaleFactor.Unspecified.

final boolean

true when this is ScaleFactor.Unspecified.

final @NonNull ScaleFactor
ScaleFactorKt.takeOrElse(
    @NonNull ScaleFactor receiver,
    @NonNull Function0<@NonNull ScaleFactor> block
)

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

final @NonNull Size

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

Public methods

component1

public final float component1()

component2

public final float component2()

copy

public final @NonNull ScaleFactor copy(float scaleX, float scaleY)

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

div

public final @NonNull ScaleFactor div(float operand)

Division operator.

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

getScaleX

public final float getScaleX()

Returns the scale factor to apply along the horizontal axis

getScaleY

public final float getScaleY()

Returns the scale factor to apply along the vertical axis

times

public final @NonNull ScaleFactor times(float operand)

Multiplication operator.

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

toString

public @NonNull String toString()

Extension functions

ScaleFactorKt.isSpecified

public final boolean ScaleFactorKt.isSpecified(@NonNull ScaleFactor receiver)

false when this is ScaleFactor.Unspecified.

ScaleFactorKt.isUnspecified

public final boolean ScaleFactorKt.isUnspecified(@NonNull ScaleFactor receiver)

true when this is ScaleFactor.Unspecified.

ScaleFactorKt.takeOrElse

public final @NonNull ScaleFactor ScaleFactorKt.takeOrElse(
    @NonNull ScaleFactor receiver,
    @NonNull Function0<@NonNull ScaleFactor> block
)

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

ScaleFactorKt.times

public final @NonNull Size ScaleFactorKt.times(@NonNull ScaleFactor receiver, @NonNull Size size)

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

Return a new Size with the width and height multiplied by the ScaleFactor.scaleX and ScaleFactor.scaleY respectively