var/offset = rand(-12, -14)
world << "Doing icon blend thing"
//Lets cutoff part of the plant
var/icon/I = getFlatIcon(src)
I.Blend(new /icon('icons/obj/hydroponics_vines.dmi', "blank"),ICON_MULTIPLY, y=abs(offset-1))

icon = I
src.transform = M

Problem description:
Hi all. I'm attempting to do something that should be very simple, i want to cut off the bottom of a sprite. At runtime. A perfectly even horizontal cut.

The code above is how i'm trying to do it, the blank icon state is just a square sprite fully colored in with white, and i'm trying to blend it at an offset.

My idea is, by offsetting it upwards, all the pixels below a certain point should be transparent, and when blended with the underlying icon, it should OR the transparent pixels and blank out all parts that are transparent in either image.
It is not working though, appears to do nothing

I've confirmed it is doing something though, I tested with blend underlay (in a prob(50)) and got this.

That colored square is in more or less the right place. Everything below it is supposed to be cutoff and completely transparent, according to the docs. I don't understand why it isn't

My use case here, incase its not clear. I've got these plants that i want to look like they're growing out of the wall. And since we use a perspective view, that means they have to be covered by the north side of the wall, but be visible on other sides of it.

Adjusting layers and planes isn't a practical solution here, due to that affecting interactions with other objects, so i'm trying to make this work instead.

The plant does move via transform translation instead of pixel offset, could that be related? Or does blend offset not work how i'm expecting

So an update, i've solved it.

It turns out the problem is, byond only looks at the pixels in the images. Like, the 32x32 of white that made up the blank image.

The area below, and generally outside of the image wasn't treated as transparent pixels, it was treated as no data, and not blended with anything.

My solution then, was to change the blank white image to an entirely transparent one, and offset it downwards so it only covered the bottom of the plant. This correctly erased the pixels within its boundaries and now our plants are looking great