# Color change for overlapping objects

**URL:** <https://discourse.processing.org/t/color-change-for-overlapping-objects/40645>\
**Category:** Coding Questions\
**Created:** [January 19, 2023, 8:32am UTC](https://discourse.processing.org/t/color-change-for-overlapping-objects/40645 "2023-01-19T08:32:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pastel](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Pastel](https://discourse.processing.org/u/Pastel)\
**Post date:** [January 19, 2023, 8:32am UTC](https://discourse.processing.org/t/color-change-for-overlapping-objects/40645/1 "2023-01-19T08:32:02Z")

</div>

With two objects (circles, rectangles, …) overlapping I’d like to color them in another color on the overlapping part.

**For example two objects are blue and the overlapping part is orange.**

1. Could this be done by any filter function and the `circle()`, `rect()`, …? Or drawing point by point?

I also know about drawing the forms by coding the x/y coordinates.

1. How do I get the color of a point (x, y)? I tried `brightness(get(x, y));`. Is that right?

2. For setting the color of a pixel `point()` is to slow and I have to use `pixels[]`, right?

Thank you for helping me with this topic.

---

<div class="post-metadata">

**Author:** ![Pastel](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Pastel](https://discourse.processing.org/u/Pastel)\
**Post date:** [January 19, 2023, 9:01am UTC](https://discourse.processing.org/t/color-change-for-overlapping-objects/40645/2 "2023-01-19T09:01:43Z")

</div>

After writing the article I had the idea of filtering or blending and found the solution:

```auto
blendMode(DIFFERENCE);

```

So easy after all the coding… 😉
