Any trick to inverse fill from Path?


I am currently using the Path class to implement (alpha blended) selections on a GUI and it works OK otherwise but I can't figure out any nice way to make an inverse fill out of the path. (To allow for inverting the user selection.)

Maybe Path is the wrong class to use for this to begin with? But it sure is pretty convenient to allow for "lasso" style selections, for example.


Not sure I understand - do you want your lassoed area to effectively cut out of the full rectangle? If so, then draw the rectangle, change the winding rule with setUsingNonZeroWinding() and then add the lasso path.


Starting from a state like shown in the screenshot, I would like to switch the filled in area to be outside the freeform selection, leaving the lassoed area in its original state.


Yes, Andrew's suggestion is what you need to do then.


OK, I was able to implement this by adding a rectangle into the Path and setting the winding rule as needed.