ID:2166245
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
http://www.byond.com/forum/?post=2112574

Basically, it would really help to have some kind of masking functionality natively implemented into DM without having to resort to slow, imperfect hacks to try to replicate it.

Strangely enough, icon/DrawBox() already... SORT OF has clipping functionality. Of course, it only works for rectangle shapes or single pixels, which isnt really optimal in this case.

I don't really have a whole lot to suggest on how this would look on the language-side of things. I think how CSS and the Javascript canvas handle masking could be looked to for some inspiration, though!
++
Masking is something I would very much like to add. It falls under the general umbrella of filter support. Problem is I haven't come up with any good ideas for how to implement filters, in terms of a friendly syntax and something that will play reasonably well with appearances.
In response to Lummox JR
Lummox JR wrote:
Masking is something I would very much like to add. It falls under the general umbrella of filter support. Problem is I haven't come up with any good ideas for how to implement filters, in terms of a friendly syntax and something that will play reasonably well with appearances.

Make a topic on your next BYOND announcement asking for suggestions, Ter, Kaiochao, and the others often got plenty of good ideas! :)

Would making making the clipping/mask editor built into the DMI editor something feasible? As in having it done via UI elements and not only with DM codes.
I sort of got it working. Unfortunately, it leaves a white outline the way I handled it. A feature like this built-in would definitely help. Here's some example code that does work, as long the icon completely covers over the mask. If it doesn't, it leaves a white outline.

Wall1
parent_type = /obj
density = 1
bound_x = 0
bound_y = 0
bound_width = 16
bound_height = 16
appearance_flags = KEEP_TOGETHER
New()
var/image/I = image('Special.dmi')
overlays += I
I = image('Player.dmi', null, "Stand")
I.blend_mode = BLEND_MULTIPLY
overlays += I


And here's a screenshot:


I was able to partially accomplish it, but ended up with outlines.
Could implement stencils and have a stencil var on appearances that when set writes to the stencil buffer that value. Alternatively, give appearances a CSS (compiled on server to keep communication down) which would allow you to add even more power without adding a ton of vars.
Bump. Would be a neat feature to have, yep yep.
This is actually technically already possible, but it's hilariously memory-intensive and uses barely documented behaviour- You can see this for a reference. This comment basically sums up how it functions.
In response to Tigercat2000
Yes, it's hilariously memory-intensive (which is why we want this), but it's documented behavior; see "icon arithmetic" and "Blend proc (icon)". What you've shown is simply the ICON_ADD behavior.

We're trying to avoid using icon procs, like what atom.color and atom.transform do.
Is it possible to do this by adding another blend mode? BLEND_MASK or BLEND_ALPHA perhaps?

My thought was any appearance set to BLEND_MASK would act as an alpha channel for its parent appearance. So in practice it would probably be used by adding an image as an overlay to another appearance, and setting that overlays blend_mode to BLEND_MASK.