Mark
04/30/2023, 6:36 AMephemient
04/30/2023, 7:29 AMephemient
04/30/2023, 7:30 AMpainterResource() should work with vectors and bitmaps, just not other types of drawablesephemient
04/30/2023, 7:31 AMMark
04/30/2023, 7:43 AMicon: ImageVector args to icon: Painter and that seems to work well. It seems easy to convert from various image types to Painter. e.g. Icons.Outlined.MailOutline to rememberVectorPainter(image = Icons.Outlined.MailOutline) and resource id painterResource(id = iconResId) so when declaring composables, seems better to accept Painter than ImageVector or resource ids, right?ephemient
04/30/2023, 12:48 PMMark
04/30/2023, 3:32 PMIcon composables they all call through to the one that takes a Painter, so yes that seems like a good general option,
Fun fact: painterResource detects whether the resource ID is a vector vs bitmap simply by checking whether the path ends in .xml!
https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/c[…]tlin/androidx/compose/ui/res/PainterResources.android.kt