```+imageResource(R.drawable.ic_arrow_core_lines_w...
# compose
c
Copy code
+imageResource(R.drawable.ic_arrow_core_lines_white)
do Compose support vectors?
g
Yes,
Copy code
+vectorResource(id)
But there isn't yet a
SimpleVector
Composable function.
Find here an example of a custom Composable function for vectors:
Copy code
@Composable
fun SimpleVector(@DrawableRes id: Int, tint: Color = Color.Transparent) {
    val vector = +vectorResource(id)
    WithDensity {
        Container(
            width = vector.defaultWidth.toDp(),
            height = vector.defaultHeight.toDp()
        ) {
            DrawVector(vector, tint)
        }
    }
}
c
👍
i want to return an image like imageResource, it is possible?
a
vectors are not images. there is a special type we return from vectorResource(id). how do you want to use it so you wanted Image?
c
i have a drawable that is a vector, i want to retrieve it from the resources and pass it as a parameter to a component that requires an Image
a
unfortunately currently you can't pass it as an Image. We are working on a Painter api which will allow this. But currently you should be able to directly use vectors if there is a slot api for the the composable you are using. for example for FloatingActionButton there are two overloads, one with Image param and the second one with a Composable children
👍 2