# How can I extend the context to add globalcompositeoperation = 'destination-out'?

**URL:** <https://discourse.processing.org/t/how-can-i-extend-the-context-to-add-globalcompositeoperation-destination-out/3586>\
**Category:** Coding Questions\
**Created:** [September 16, 2018, 9:45pm UTC](https://discourse.processing.org/t/how-can-i-extend-the-context-to-add-globalcompositeoperation-destination-out/3586 "2018-09-16T21:45:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lgdelacruz](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lgdelacruz](https://discourse.processing.org/u/lgdelacruz)\
**Post date:** [September 16, 2018, 9:45pm UTC](https://discourse.processing.org/t/how-can-i-extend-the-context-to-add-globalcompositeoperation-destination-out/3586/1 "2018-09-16T21:45:14Z")

</div>

I’m trying to create a draw with pencil and eraser. I really want to make use of setting the context in Render2D.globalcompositeoperation = ‘destination-out’ in order to create an erasing the line behavior. How would I go about doing that? Any hints towards the proper direction would be much appreciated.

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [September 17, 2018, 2:40am UTC](https://discourse.processing.org/t/how-can-i-extend-the-context-to-add-globalcompositeoperation-destination-out/3586/2 "2018-09-17T02:40:44Z")

</div>

I don’t know if that property is meant to be accessed through Processing, but have you checked out [blendMode()](https://p5js.org/reference/#/p5/blendMode)?

In fact, I think blendMode() was implemented through `globalCompositeOperation`, looking at [this Github issue](https://github.com/processing/p5.js/issues/204)

Maybe @lmccart can speak more to this?

**Edit** : Okay, I realize I didn’t actually answer the question.

If we want a simple, MSPaint eraser, we could draw an ellipse, filled with the background-color, wherever the mouse is.

If we wanted to get fancy, we could store the ‘pencil marks’ in a PGraphic, and draw an ellipse filled with a color with `0 alpha` onto the PGraphic using blendMode(REPLACE).
