ID:1878079
 
(See the best response by Mr_Goober.)
Code:
Blend(icon,function=ICON_ADD,x=1,y=1)


Problem description:

Is it possible to use blend() as an icon mask for another icon?
As far as I can tell, using ICON_MULTIPLY would be perfect if multiplied transparent pixels only.

So basically I'm trying to use the first icon as a 'cookie cutter' to shape a second icon.
Best response
After blending the mask shape on top of the icon, you can use that icon's SwapColor proc to turn the color of the mask to transparent.
Hm yeah that could work providing the mask's colour is not in the second icon's palette at all.

You'd have to take the first icon and create a negative (opaque pixels to transparent and transparent pixels to opaque) of it to use as the mask for that technique right?
To create the mold, indeed, you will need to use the source image and flood all of the transparent pixels with a mask. Then, turn all colors not of the mask color to transparent.
Great, thanks!
While Mr_Goober's method will work fine, I do know of another (if my understanding of the question is accurate).

If you have an icon that is 100% black rgb(0,0,0)/#000000 and you attempt to add said icon to another, it will result in an image with the texture of your first image, and the shape of your black image.

With that said, you can either make your "cookie-cutters" solid black and then proceed to add them into the icon you wish to be cropped via Blend() [example 1], or you could even go as far as to use Blend() to change the color of your cookie cutter and then manipulate [example 2].

[example 1]
var/icon/i = icon(icon)
i.Blend('black-circle.dmi',ICON_ADD)
icon = i

[example 2]
var/icon/i = icon(icon)
var/icon/shape = icon('circle.dmi')//The shape we wish
shape.Blend("#FFFFFF",ICON_SUBTRACT)//Make our shape black
i.Blend(shape,ICON_ADD)
icon = i


Furthermore, their does exist some shorthand manipulation, which means you don't need to use Blend(), or even Icon. Not sure how recommended the use of them are though..

[example 1 shorthand]
icon += 'black-circle.dmi'


And an FIY, these do seem to apply to all states and directions.
Thanks that's a good one. So R50 G50 B50 + R0 G0 B0 is still R50 G50 B50, makes sense!
BTW, if you don't need positional offsets, most of the Blend() operations have been handled by operators for some time. Not just with real cache-file icons, but also now with /icon datums too. That went in somewhere from 500 onward, but I forget which version. It requires the server be a newer version.