miqbaldc
09/14/2021, 7:36 AMaddPathNodes
addPath(
pathData = addPathNodes(
"M5.778,8.81a0.6,0.6 0,0 0,0 -1.2v1.2z" +
...
),
...
)
Anyone already try to convert vector pathData
to androidx.compose.ui.graphics.vector.ImageVector
?miqbaldc
09/14/2021, 7:43 AMpathData
part? so we can translate it to ImageVector
miqbaldc
09/14/2021, 8:21 AMa
parts for arcToRelative
Compose ImageVector
adding this handy API:
fun arcToRelative(
a: Float,
b: Float,
theta: Float,
isMoreThanHalf: Boolean,
isPositiveArc: Boolean,
dx1: Float,
dy1: Float
)
my attempts
from `pathData`:
a0.6,0.6 0,0 0,0 -1.2
to:
a b d,x d,y theta
arc0.6,0.6 0,0 0,0 -1.2
dx1 = 0,0 -> 0*0 -> 0
dy1 = 0,0 -> 0*0 -> 0
when using it with Compose API:
arctToRelative(
a = 0.6f,
b = 0.6,
dx1 = 0,0,
dy1 = 0,0
theta = -1.2,
isMoreThanHalf = false,
isPositiveArc = false
)
references:
1. I’m able to understand a few keyword in pathData
from here: https://medium.com/@ali.muzaffar/understanding-vectordrawable-pathdata-commands-in-android-d56a6054610e
2. And a detailed commands from here: https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommandsmiqbaldc
09/14/2021, 9:23 AMaddPath(
pathData = addPathNodes(
"M5.778,8.81a0.6,0.6 0,0 0,0 -1.2v1.2z" +
...
)
)
looks like this might simplify the conversion process, will update here if it succeedsmiqbaldc
09/22/2021, 7:18 AMImage
inside BadgeBox
as well instead of using Icon
miqbaldc
09/22/2021, 7:18 AMBadgeBox(
....
) {
Image(painter = painterResource(R.drawable.your_drawable, contentDescription = null)
}