Image and Painter APIs in compose consume a ContentScale parameter to determine how to scale the drawing contents uniformly about the size of the composable they are drawing within.
However, there have been some feature requests to scale content in a non-uniform manner similar to the framework API's ScaleType.FIT_XY API. We should come up with a way to support non-uniform scaling.
Following feature requests:
Is there an equivalent to FitXY for Image? Or a way to do it in Compose that I’m missing? I have a vector asset that I want to stretch depending on the size of the composables within a Stack
i have a LinearProgressIndicator component that i’ve implemented using a VectorPainter with 360dp and 2dp intrinsic width/height respectively. i want this component to have a customizable width and height though. so for example, i want it to be possible to define a LinearProgressIndicator that fills the entire screen’s width and has a custom thickness/height of 4dp.
it seems like you can only stretch a VectorPainter in a single direction. ideally there would be a ContentScale.FillWidthAndHeight or something like that.
i wasn’t sure what you meant by calling VectorPainter.draw within the draw scope (i don’t see a draw() method on VectorPainter) (edited)
Description
Image and Painter APIs in compose consume a ContentScale parameter to determine how to scale the drawing contents uniformly about the size of the composable they are drawing within.
However, there have been some feature requests to scale content in a non-uniform manner similar to the framework API's ScaleType.FIT_XY API. We should come up with a way to support non-uniform scaling.
Following feature requests: