# Matrix.ScaleToFit

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# ScaleToFit

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/graphics/Matrix.ScaleToFit "View this page in Java")  

```
class ScaleToFit
```

|---|---|--------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                              |||
| ↳ | [kotlin.Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\<[android.graphics.Matrix.ScaleToFit](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#)\> ||
|   | ↳ | [android.graphics.Matrix.ScaleToFit](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#) |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [Matrix.ScaleToFit.CENTER](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:CENTER),[Matrix.ScaleToFit.END](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:END),[Matrix.ScaleToFit.FILL](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:FILL),[Matrix.ScaleToFit.START](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:START) |---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| | [Matrix.ScaleToFit.CENTER](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:CENTER) | Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. | | [Matrix.ScaleToFit.END](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:END)       | Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. | | [Matrix.ScaleToFit.FILL](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:FILL)     | Scale in X and Y independently, so that src matches dst exactly.                                                          | | [Matrix.ScaleToFit.START](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:START)   | Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. | |

Controls how the src rect should align into the dst rect for setRectToRect().

## Summary

|                                                                                                                Enum values                                                                                                                 ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [CENTER](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:CENTER) Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. |
| [END](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:END) Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst.       |
| [FILL](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:FILL) Scale in X and Y independently, so that src matches dst exactly.                                                              |
| [START](https://developer.android.com/reference/kotlin/android/graphics/Matrix.ScaleToFit#ENUM_VALUE:START) Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst.   |

## Enum values

### CENTER

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val CENTER : Matrix.ScaleToFit
```

Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. The result is centered inside dst.  

### END

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val END : Matrix.ScaleToFit
```

Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. END aligns the result to the right and bottom edges of dst.  

### FILL

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val FILL : Matrix.ScaleToFit
```

Scale in X and Y independently, so that src matches dst exactly. This may change the aspect ratio of the src.  

### START

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
enum val START : Matrix.ScaleToFit
```

Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. START aligns the result to the left and top edges of dst.