Stay organized with collections
Save and categorize content based on your preferences.
ScaleToFit
class ScaleToFit
Known Direct Subclasses
Matrix.ScaleToFit.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 |
Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst.
|
Matrix.ScaleToFit.FILL |
Scale in X and Y independently, so that src matches dst exactly.
|
Matrix.ScaleToFit.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 |
Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst.
|
Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst.
|
Scale in X and Y independently, so that src matches dst exactly.
|
Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst.
|
Enum values
CENTER
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
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
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
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Matrix.ScaleToFit\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nScaleToFit\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/graphics/Matrix.ScaleToFit \"View this page in Java\") \n\n```\nclass ScaleToFit\n```\n\n|---|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [kotlin.Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c[android.graphics.Matrix.ScaleToFit](#)\\\u003e ||\n| | ↳ | [android.graphics.Matrix.ScaleToFit](#) |\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [Matrix.ScaleToFit.CENTER](#ENUM_VALUE:CENTER), [Matrix.ScaleToFit.END](#ENUM_VALUE:END), [Matrix.ScaleToFit.FILL](#ENUM_VALUE:FILL), [Matrix.ScaleToFit.START](#ENUM_VALUE:START) |------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------| | [Matrix.ScaleToFit.CENTER](#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](#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](#ENUM_VALUE:FILL) | Scale in X and Y independently, so that src matches dst exactly. | | [Matrix.ScaleToFit.START](#ENUM_VALUE:START) | Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. | |\n\nControls how the src rect should align into the dst rect for setRectToRect().\n\nSummary\n-------\n\n| Enum values ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [CENTER](#ENUM_VALUE:CENTER) Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. |\n| [END](#ENUM_VALUE:END) Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. |\n| [FILL](#ENUM_VALUE:FILL) Scale in X and Y independently, so that src matches dst exactly. |\n| [START](#ENUM_VALUE:START) Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. |\n\nEnum values\n-----------\n\n### CENTER\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val CENTER : Matrix.ScaleToFit\n```\n\nCompute 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. \n\n### END\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val END : Matrix.ScaleToFit\n```\n\nCompute 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. \n\n### FILL\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val FILL : Matrix.ScaleToFit\n```\n\nScale in X and Y independently, so that src matches dst exactly. This may change the aspect ratio of the src. \n\n### START\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val START : Matrix.ScaleToFit\n```\n\nCompute 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."]]