[SOLVED] Using `addPathNodes` ```addPath( pat...
# compose
m
[SOLVED] Using
addPathNodes
Copy code
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
?
any references/articles to understand the
pathData
part? so we can translate it to
ImageVector
I’m confused with
a
parts for
arcToRelative
Compose
ImageVector
adding this handy API:
Copy code
fun arcToRelative(
        a: Float,
        b: Float,
        theta: Float,
        isMoreThanHalf: Boolean,
        isPositiveArc: Boolean,
        dx1: Float,
        dy1: Float
    )
my attempts from `pathData`:
Copy code
a0.6,0.6 0,0 0,0 -1.2
to:
Copy code
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:
Copy code
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#PathDataEllipticalArcCommands
Copy code
addPath(
   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 succeeds
We can use
Image
inside
BadgeBox
as well instead of using
Icon
e.g:
Copy code
BadgeBox(
    ....
) {
  Image(painter = painterResource(R.drawable.your_drawable, contentDescription = null)
}