indigo
indigo copied to clipboard
Allow `Graphics` to be clipped by a path
We should be able to provide a set of points (or a Polygon) to a Graphic that will clip out anything outside of that path similar to how a CSS clip path works.
Reference https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
As discussed with @hobnob elsewhere. There's a few things to know about this one:
- Browser canvas clipping won't do the job.
- It may be possible to do something cheap with a custom shader...
- But the real solution is to finally implement multi-pass rendering.
I think the latter is actually pretty doable, and would allow for a variety of effects that aren't possible at the moment. It would also allow clipping / masking for layers as well as for entities.