Been playing with Canvas, DrawScope, Path, and dra...
# compose
t
Been playing with Canvas, DrawScope, Path, and drawPath(). Been going good, but now I want to "fill" a path with R.drawable.my_background_thingie. I've been poking around, but it's not clear to me what the intermediary I need to work though. On iOS, you can make a Color that wraps around an image. But I'm guessing, I need to use the Brush variant of the drawPath() function? But how to make a Brush that tiles a vector drawable isn't clear? Does it need to be converted to a bitmap first?
r
If the drawable is a vector, then yes you'll need to convert it to an image (or do the tiling yourself)
Then you can use the image as a brush indeed
t
Is there a "compose way" to do this idiomatically? I've really been trying to not have to learn "all the old" stuff as I go forward with this
r
To convert a drawable to a
Bitmap
?
This has nothing to do with Compose, but you can use androidx-core-ktx and its
Drawable.toBitmap()
extension function to make it easy
t
Thank you