It’s very very slow. I’d like to clip (reduce clip region) and get out of that clip for more drawing, but I can’t find a way to make it without transparency layer. Is there a way to revert that clip? I tried reverse windings but I had no success
Try this:
{
juce::Graphics::ScopedSaveState ss ( g );
juce::Path p;
// Clip to ellipse
p.addEllipse ( b.reduced ( 5.0f ) );
g.reduceClipRegion ( p );
g.drawImage ( img, b, 0 );
}
The ScopedSaveState save the current state of the graphics context. Then you reduce the clip region, draw whatever you want and leave the scope.
Afterwards, the clip-region is restored to it’s former shape/size.
Alternatively you can also sandwich your clipped draw-calls between a
g.saveState (); and a g.restoreState () call. Same thing.
2 Likes
life saver!
