Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Hawk_v3
2019-08-22 21:32:01 +01:00
167 changed files with 7562 additions and 3456 deletions

View File

@@ -42,4 +42,18 @@
for(var/x_pixel = 1 to I.Width())
if (I.GetPixel(x_pixel, y_pixel))
return y_pixel - 1
return null
return null
//Standard behaviour is to cut pixels from the main icon that are covered by pixels from the mask icon unless passed mask_ready, see below.
/proc/get_icon_difference(var/icon/main, var/icon/mask, var/mask_ready)
/*You should skip prep if the mask is already sprited properly. This significantly improves performance by eliminating most of the realtime icon work.
e.g. A 'ready' mask is a mask where the part you want cut out is missing (no pixels, 0 alpha) from the sprite, and everything else is solid white.*/
if(istype(main) && istype(mask))
if(!mask_ready) //Prep the mask if we're using a regular old sprite and not a special-made mask.
mask.Blend(rgb(255,255,255), ICON_SUBTRACT) //Make all pixels on the mask as black as possible.
mask.Opaque(rgb(255,255,255)) //Make the transparent pixels (background) white.
mask.BecomeAlphaMask() //Make all the black pixels vanish (fully transparent), leaving only the white background pixels.
main.AddAlphaMask(mask) //Make the pixels in the main icon that are in the transparent zone of the mask icon also vanish (fully transparent).
return main