I don't really know what to say here. The alpha masking isn't working right. Ter told me it's broken, so I'm making a bug report.
Numbered Steps to Reproduce Problem:
make pixel icon
copy code into project
try to draw box, flail on a bunch of different settings if so inclined
Code Snippet (if applicable) to Reproduce Problem:
This is done with a single white pixel.
obj
bounding_box
icon = 'assets/pixel.dmi'
layer = FLOAT_LAYER
var/tmp/_x
var/tmp/_y
New(atom/movable/source)
pixel_x = source.bound_x + (source.bound_width / 2)
pixel_y = source.bound_y + (source.bound_height / 2)
color = "red"
transform = matrix().Scale(source.bound_width, source.bound_height)
atom/movable
var/obj/bounding_box/bounding_box
proc
DrawBoundingBox()
bounding_box = new (src)
vis_contents += bounding_box
var/obj/mask = new
mask.pixel_x = bound_x + (bound_width / 2)
mask.pixel_y = bound_y + (bound_height / 2)
mask.icon = 'assets./pixel.dmi'
mask.layer = 100
bounding_box.render_target = "mask"
mask.transform = matrix().Scale(bound_width-2, bound_height-2)
mask.filters += filter(type = "alpha", render_source = "mask", flags = MASK_SWAP, x = 1, y = 1)
bounding_box.vis_contents += mask
HideBoundingBox()
del bounding_box
New()
..()
if(density)
DrawBoundingBox()
Expected Results:
Single pixel bounding box
Actual Results:
sadness
Workarounds:
Unity