etc, but there's no method for either bitmap drawing (like I get bitmap from VectorDrawable) or directly for
VectorAsset
. I did tried it using the the vector path in form of string like in this example (https://github.com/JorgeCastilloPrz/ComposeFillableLoaders) from @Jorge Castillo . But, I am not able to fill color inside the path with this method. I want to fill the whole drawable from inside. Can anyone tell me how can I do this?
j
Jorge Castillo
08/12/2020, 9:56 AM
There are probably other ways but if you've got the path you can draw path and use a paint with fill style so it fills the content. There are examples about that on that repository also
n
Nader Jawad
08/12/2020, 10:53 PM
ImageAsset is Compose's Bitmap API. So DrawScope.drawImage should be what you would use there. If you have an android.graphics.Bitmap object you can call asImageAsset to convert to the compose API
Nader Jawad
08/12/2020, 10:55 PM
If you have a VectorPainter (fully resolved VectorDrawable) and you want to draw it within a DrawScope you can just call vectorPainter.draw within a DrawScope receiver scope. You could get a DrawScope receiver scope in various ways either through Modifier.drawBehind or as the trailing lambda in the Canvas composable