Hello, I added stroke to a rounded corner path, bu...
# doodle
c
Hello, I added stroke to a rounded corner path, but the result is not expected. The outer edges are not rounded. Is that intended?
n
This is expected since SVGs will stroke on the line of a shape, which means half of your stroke will be inside and half outside. You can fix this by insetting the shape by 1/2 your stoke thickness. So you can do
val insetRect = rect.inset(thickness / 2)
then create your path from
insetRect
instead. Same goes for drawing a rect directly:
Copy code
canvas.rect(bounds.atOrigin.inset(…), Stroke(…))