In my object’s paint() method, I’m trying to:
- draw some stuff
- set up a clipping rect and draw several paths with different colors such that anything outside the clip region is clipped.
- go back to the original clipping shape, and draw some more stuff outside of my clipping rect.
EDIT: deleted long explanation and wrong assumptions…
I found the answer here:
All I needed to do is:
// draw some stuff first
g.fillAll(someColour.withAlpha(alpha));
// set up a clipping rect
Rectangle<int> clip = getLocalBounds().reduced(20, 20);
// save state
g.saveState();
// reduce the clipping region:
g.reduceClipRegion(clip);
// draw all the path stuff here
// restore the state
g.restoreState();
// draw more stuff here outside of the clipping rect