Code:
datum/object
var/icon/onscreen_image
proc/generate_icon()
onscreen_image = icon('icons/effects/effects.dmi', "nothing")
var/image/background = new('icons/obj/background.dmi', "background_[pick(0,1,2,3)]")
var/image/texture = new('icons/obj/textures.dmi', "texture_0")
var/image/elevation = new('icons/obj/elevation.dmi', "elevation_0")
elevation.alpha = 126
var/icon/I
I += background
I += texture
I += elevation
var/icon/stamp = getFlatIcon(I)
onscreen_image.Blend(stamp, ICON_OVERLAY)
And to display it on the browser:
user << browse_rsc(Q:onscreen_image, "onscreenimage.png")
dat += "<div class='statusDisplay'><center><img src=onscreenimage.png width=64 height=64></center></div>"
And when I test it out, the icon inside the browser is blank (icon('icons/effects/effects.dmi', "nothing")) (The first line in generate_icon proc)
Does anyone know what I did wrong?
Thanks :)
But one thing I see that I believe is incorrect is your use of browse_rsc(). For the file parameter (the first argument), you are sending a given datum's onscreen_image, which is an icon object, not a file (not sure if the former would work in that case though).
Another thing I noticed is you are creating those images incorrectly; the second argument used in creating an image is the atom it should be attached to (if any). You are passing icon_states instead, so your images don't actually have icon_states.