# Is there something like masks from photoshop?

**URL:** <https://forum.juce.com/t/is-there-something-like-masks-from-photoshop/37546>\
**Category:** General JUCE discussion\
**Created:** [February 10, 2020, 9:44am UTC](https://forum.juce.com/t/is-there-something-like-masks-from-photoshop/37546 "2020-02-10T09:44:33Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [January 19, 2021, 3:38am UTC](https://forum.juce.com/t/is-there-something-like-masks-from-photoshop/37546/13 "2021-01-19T03:38:27Z")

</div>

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:

> [@Reset clip region on Graphics](https://forum.juce.com/t/reset-clip-region-on-graphics/775/5):
>
> There’s no way to do that, and no need. If you want to reduce the clip and then reset it, you’d do something like this: [code]g.saveState(); g.reduceClipRegion (…); …draw here with the reduced region g.restoreState(); …and it’s back to normal here[/code]

All I needed to do is:

```auto
// 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

```

---

_[View the full topic](https://forum.juce.com/t/is-there-something-like-masks-from-photoshop/37546)._
