The second Android 11 Developer Preview is now available, test it out and share your feedback.

ScaleFit

interface ScaleFit
androidx.ui.graphics.ScaleFit

Represents a rule to apply to scale a source rectangle to be inscribed into a destination

Summary

Public methods

abstract Float
scale(srcSize: PxSize, dstSize: PxSize)

Computes the scale factor to apply to both dimensions in order to fit the source appropriately with the given destination size

Companion properties

ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the destination height.

ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the maximum of the destination width or height.

ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the minimum of the destination width or height.

ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the destination width.

ScaleFit

Scale the source to maintain the aspect ratio to fit within the destination bounds if the source is larger than the destination.

FixedScale

Do not apply any scaling to the source

Public methods

scale

abstract fun scale(
    srcSize: PxSize,
    dstSize: PxSize
): Float

Computes the scale factor to apply to both dimensions in order to fit the source appropriately with the given destination size

Companion properties

FillHeight

val FillHeight: ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the destination height. This can cover a larger area than the destination if the height is larger than the width.

FillMaxDimension

val FillMaxDimension: ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the maximum of the destination width or height. This can cover a larger area than the destination.

FillMinDimension

val FillMinDimension: ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the minimum of the destination width or height. This will always fill an area smaller than or equal to the destination.

FillWidth

val FillWidth: ScaleFit

Scale the source maintaining the aspect ratio so that the bounds match the destination width. This can cover a larger area than the destination if the width is larger than the height.

Fit

val Fit: ScaleFit

Scale the source to maintain the aspect ratio to fit within the destination bounds if the source is larger than the destination. If the source is smaller than or equal to the destination in both dimensions, this behaves similarly to None. This will always be contained within the bounds of the destination.

None

val None: FixedScale

Do not apply any scaling to the source