linebender / piet

An abstraction for 2D graphics.
Apache License 2.0
1.25k stars 94 forks source link

Looking to accomplish "reverse" clip #532

Open theresia-tobii opened 1 year ago

theresia-tobii commented 1 year ago

In skia for instance, it's possible to accomplish a reverse clip meaning that the clip area is not used as an intersection, but as a subtraction instead. This is useful when trying to accomplish more graphical features such as rendering strokes with outside alignment (default is centered, inner alignment can be accomplished by doubling the stroke width and using the shape as clip shape, but outer alignment requires inverse clipping). I have tried without success to accomplish this in piet. Is this something we can add? Can this be done by allowing the clip shape to use an even-odd fill rule? I am using druid on windows so I assume I am using the d2d backend. It specifies nonzero as fill rule which seems wrong.