Thread
#compose
    carbaj0

    carbaj0

    2 years ago
    +imageResource(R.drawable.ic_arrow_core_lines_white)
    do Compose support vectors?
    gpaligot

    gpaligot

    2 years ago
    Yes,
    +vectorResource(id)
    But there isn't yet a
    SimpleVector
    Composable function.
    Find here an example of a custom Composable function for vectors:
    @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)
            }
        }
    }
    carbaj0

    carbaj0

    2 years ago
    👍
    i want to return an image like imageResource, it is possible?
    Andrey Kulikov

    Andrey Kulikov

    2 years ago
    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?
    carbaj0

    carbaj0

    2 years ago
    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
    Andrey Kulikov

    Andrey Kulikov

    2 years ago
    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