indigo icon indicating copy to clipboard operation
indigo copied to clipboard

Allow `Graphics` to be clipped by a path

Open hobnob opened this issue 1 year ago • 2 comments

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.

hobnob avatar May 19 '23 08:05 hobnob

Reference https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip

hobnob avatar May 19 '23 08:05 hobnob

As discussed with @hobnob elsewhere. There's a few things to know about this one:

  1. Browser canvas clipping won't do the job.
  2. It may be possible to do something cheap with a custom shader...
  3. 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.

davesmith00000 avatar May 28 '23 08:05 davesmith00000