Legacy GM [SOLVED] Using a custom shape for a surface "mask". Is it possible?


Hi all,

Is it possible to use draw_set_blend_mode(bm_subtract) to create a non-rectangular mask on a surface?

Here is an example of what I'm trying to do. I have a grey surface, and a white surface. The grey surface is the background, and the white surface is on top. I want to cut the white surface in a triangle so only a small area of grey is showing. To do this, I set a triangle as the mask. But if I use a non-quadrilateral shape, the mask always glitches out.

Here is the mask:

And here is what happens when I try and use it.


The grey area is correctly masked out so only a small triangle of grey shows. But for some reason, it is "filling in" the rest of the area black.

Is this just a limitation of surfaces? Can they only handle perfect quadrilateral shapes?


Ok, I just figured it out. Apparently the mask sprite needs to have a transparent area that is BLACK, not white as I had thought. The white transparent area, even at 0 opacity, was causing the black "fill-in" for areas that were not perfectly square or rectangular.