# ContentScale

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/ContentScale.kt+class:androidx.compose.ui.layout.ContentScale) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface ContentScale
  ```
Known direct subclasses [FixedScale](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/FixedScale)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/FixedScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` implementation that always scales the dimension by the provided fixed floating point value |

*** ** * ** ***

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

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#Crop()` Scale the source uniformly (maintaining the source's aspect ratio) so that both dimensions (width and height) of the source will be equal to or larger than the corresponding dimension of the destination. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#FillBounds()` Scale horizontal and vertically non-uniformly to fill the destination bounds. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#FillHeight()` Scale the source maintaining the aspect ratio so that the bounds match the destination height. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#FillWidth()` Scale the source maintaining the aspect ratio so that the bounds match the destination width. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#Fit()` Scale the source uniformly (maintaining the source's aspect ratio) so that both dimensions (width and height) of the source will be equal to or less than the corresponding dimension of the destination | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#Inside()` Scale the source to maintain the aspect ratio to be inside the destination bounds if the source is larger than the destination. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/FixedScale` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#None()` Do not apply any scaling to the source | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ScaleFactor` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#computeScaleFactor(androidx.compose.ui.geometry.Size,androidx.compose.ui.geometry.Size)(srcSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size, dstSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size)` Computes the scale factor to apply to the horizontal and vertical axes independently of one another to fit the source appropriately with the given destination | Cmn |

## Public companion properties

### Crop

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Crop: ContentScale
```

Scale the source uniformly (maintaining the source's aspect ratio) so that both dimensions (width and height) of the source will be equal to or larger than the corresponding dimension of the destination.

This `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` implementation in combination with usage of `https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment#Center()` provides similar behavior to android.widget.ImageView.ScaleType.CENTER_CROP

### FillBounds

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val FillBounds: ContentScale
```

Scale horizontal and vertically non-uniformly to fill the destination bounds.

### FillHeight

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val FillHeight: ContentScale
```

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.

### FillWidth

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val FillWidth: ContentScale
```

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

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Fit: ContentScale
```

Scale the source uniformly (maintaining the source's aspect ratio) so that both dimensions (width and height) of the source will be equal to or less than the corresponding dimension of the destination

This `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` implementation in combination with usage of `https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment#Center()` provides similar behavior to android.widget.ImageView.ScaleType.FIT_CENTER

### Inside

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Inside: ContentScale
```

Scale the source to maintain the aspect ratio to be inside 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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale#None()`. This will always be contained within the bounds of the destination.

This `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` implementation in combination with usage of `https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment#Center()` provides similar behavior to android.widget.ImageView.ScaleType.CENTER_INSIDE

### None

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val None: FixedScale
```

Do not apply any scaling to the source

## Public functions

### computeScaleFactor

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun computeScaleFactor(srcSize: Size, dstSize: Size): ScaleFactor
```

Computes the scale factor to apply to the horizontal and vertical axes independently of one another to fit the source appropriately with the given destination