# Drawing the inverse of a circle in a bounding rectangle

**URL:** <https://discourse.processing.org/t/drawing-the-inverse-of-a-circle-in-a-bounding-rectangle/13333>\
**Category:** Coding Questions\
**Created:** [August 12, 2019, 2:11pm UTC](https://discourse.processing.org/t/drawing-the-inverse-of-a-circle-in-a-bounding-rectangle/13333 "2019-08-12T14:11:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LoliProcessor](https://avatars.discourse-cdn.com/v4/letter/l/6a8cbe/32.png) [@LoliProcessor](https://discourse.processing.org/u/LoliProcessor)\
**Post date:** [August 12, 2019, 2:11pm UTC](https://discourse.processing.org/t/drawing-the-inverse-of-a-circle-in-a-bounding-rectangle/13333/1 "2019-08-12T14:11:09Z")

</div>

I am trying to draw an overlay for the rounded corner of cards.  
There is the rounded corners mode by drawing regular rectangles, but the cards are stored in images.  
Is there a more efficient method in processing other than drawing a circle, replace the pixels with 0 alpha pixels and drawing the result image over the target? ( I mean I hope so )

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [August 12, 2019, 5:13pm UTC](https://discourse.processing.org/t/drawing-the-inverse-of-a-circle-in-a-bounding-rectangle/13333/2 "2019-08-12T17:13:21Z")

</div>

Hi,

If you save your images with transparent background (so you round the corners in image edition tool) it should be displayed with rounded corner within processing too.

Can you show us your code and the image that you are using to see what’s not working?

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [August 15, 2019, 4:17pm UTC](https://discourse.processing.org/t/drawing-the-inverse-of-a-circle-in-a-bounding-rectangle/13333/3 "2019-08-15T16:17:14Z")

</div>

One approach (if I understand your problem) is to draw a rounded rect to a mask layer, and use mask().

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/18819/how-to-copy-a-triangle-out-of-an-image)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.
