https://kotlinlang.org logo
#compose
Title
# compose
t

Travis Griggs

09/26/2023, 12:37 AM
I'm trying to figure out how to construct a path with a "cutout" in it the middle of it. In other graphics frameworks, I've done this by reversing the winding order nested shapes, and/or using different fill rules with nested rectangles/shapes to achieve that effect. But I'm not seeing where I can do that. drawPath style only takes Fill, no parameters to tweak the fill rule (I thought it would be like the Stroke style that takes a width). What's the secret sauce here? What I'm trying to accomplish is a drawWithContent modifier that draws a "skrim" over my content, but with a RoundRect "hole" in the middle
e

ephemient

09/26/2023, 12:39 AM
if you just have reverse-direction winding enclosed inside a forward-direction winding, it should work regardless of fill type
r

romainguy

09/26/2023, 2:03 AM
You can also do this when you perform boolean operations on Path, the winding is a parameter of the boolean operation
t

Travis Griggs

09/26/2023, 2:03 AM
Thanks. Kept search for FillRule. Should have been fill type. Not used to it being part of the path itself. Though I guess it kind of is in SVG. EvenOdd did the trick I was looking for
2 Views