Tilesheet drawing with per-pixel clipping masks

Hello!

I’m drawing with Tilesheets. I’d like to have a per-drawn-tile, per-pixel clipping mask. I see there’s some kind of mask on sprites (and I haven’t dug deeper on that), but again, I’m working with tiles.

What’s the best recommendation?

As an extreme, I’m considering drawing different parts of a tile in chunks as separate tiles with different rects, but that seems sort of a bother. (I have a few dozen different tiles already that would all need the same set of pixel masks applied.) Maybe workable, but before I go down that route, I’m asking for the wisdom of others.

I found some related discussions in old OpenFL forums but nothing so far that seems really to suggest a good solution.

I’ve wondered if shaders might get the job done, too, but I’ve never even used them in GL before really, and docs on how to apply them in OpenFL seem unclear. And I’m not sure if they would get my job done anyway, since they are a new topic for me.

On a related note, I’d also like to get to custom particle and per-pixel rendering at some point. I see HaxeFlixel (which I’m not using) has particles as individual FlxSprites (drawn as tiles for native targets???). I’ve also tweaked bitmap data directly in other parts of my code. Just wondering what’s wisest/fastest-running for these kinds of operations.

Thanks so much for any help with any of this!