# Painting a mask with a non-circular brush

**URL:** <https://forum.kirupa.com/t/painting-a-mask-with-a-non-circular-brush/352057>\
**Category:** flash\
**Created:** [November 20, 2014, 5:56pm UTC](https://forum.kirupa.com/t/painting-a-mask-with-a-non-circular-brush/352057 "2014-11-20T17:56:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaevictis](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/vaevictis/32/7089_2.png) [@Vaevictis](https://forum.kirupa.com/u/Vaevictis)\
**Post date:** [November 20, 2014, 5:56pm UTC](https://forum.kirupa.com/t/painting-a-mask-with-a-non-circular-brush/352057/1 "2014-11-20T17:56:34Z")

</div>

I need for the user to be able to unveil a hidden image by painting it - á la the classic scratch lottery ticket. I can get it to work by placing the hidden image on top of the background image, putting a mask on it and letting the user paint the mask with drawCircle. But I would like for the brush to have a more natural feel.

Is there any easy way to let the user paint the mask with a brush that gets its shape from a bitmap, or just to make it more natural some way? (Having an oddly shaped bitmap follow the user’s cursor around while painting doesn’t seem to work - the bitmap gets converted into a rectangular shape when placed in the mask clip.)

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [November 20, 2014, 6:19pm UTC](https://forum.kirupa.com/t/painting-a-mask-with-a-non-circular-brush/352057/2 "2014-11-20T18:19:22Z")

</div>

I made an example a long time ago demonstrating something like this:  
[http://senocular.com/flash/source/?entry=748](http://senocular.com/flash/source/?entry=748)

I don’t know what version of Flash youre using, but this is AS2, so if you want to see just the code, I can dig that out for you - maybe even up convert to AS3 if I have time.

This uses a “stamp” approach - think of it like a PS brush with spacing (more easily seen with the “/” shape). For something smoother, you could iterate through multiple stamps (based on distance) between individual mouse positions.
