paperjs/paper.js — pull request #59 by obeattie (2011-11-16 16:11:55+00:00)
Title: Clipped groups to support clipping of any object

**Re-opened from phantom [request 56](https://github.com/paperjs/paper.js/pull/56)**

Changed implementation of clipped groups to support masking from any object

As `CanvasNode.clip()` does not seem to support clipping to anything other than a path, changed the implementation to instead render to an in-memory canvas, and use `globalCompositeOperation` to achieve the desired effect.

As discussed [on the mailing list](https://groups.google.com/d/topic/paperjs/kKApCRXdDkk/discussion), this allows a shape to be clipped within text for example.