ID:2081098
 
Not a bug
BYOND Version:509
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Firefox 46.0
Applies to:DM Language
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
When using
icon1.Blend(icon2, ICON_OVERLAY)

If icon2 is a wider/taller icon than icon1, icon2 will be cropped to fit in the width/heigth of icon1.
This behavior isn't mentioned in the DM Help menu entry on the Blend() proc, so I figure it's possibly unintentional; Mainly because it means that you can't properly overlay bigger icons without using an atom's overlays list.

Numbered Steps to Reproduce Problem:
1. Make a new /icon, named icon1
2. Make another new /icon, with a larger width/height, named icon2
3. Attempt to use icon1.Blend(icon2, ICON_OVERLAY)
4. Observe that icon2 is cropped to fit in the width/height of icon1

Code Snippet (if applicable) to Reproduce Problem:
/mob
icon = 'obj32x32.dmi'
icon_state = "obj"

/mob/verb/give_sprite()
var/icon/S = new /icon('obj32x32.dmi', "obj") //32x32 icon file with a test sprite
S.Blend(new /icon('obj64x32.dmi', "obj"), ICON_OVERLAY, -15, 1) //64x32 icon file with a test sprite
icon = S


Expected Results:
The larger icon would be overlayed on the smaller icon, displaying fully.

Actual Results:
The larger icon is cropped to fit in the smaller icon's width/height.

Does the problem occur:
Every time? Or how often? Always.
In other games? Yes.
In other user accounts? N/A
On other computers? Not able to test.

When does the problem NOT occur?
Unknown.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
As far back as 507, the problem is still there.

Workarounds:
None known.
I believe this is intentional as the canvas isn't being expanded. You can however use Crop() with a value outside of the icon bounds to effectively pad the first icon with transparent pixels to make room for the larger icon to be blended in.

var/icon
my_icon = src.icon
big_icon = 'some_big_icon.dmi'

my_icon.Crop(1,1,big_icon.Width(),big_icon.Height())
my_icon.Blend(big_icon,...)


As an example, you'd obviously want to do things like making sure things exist and whether my_icon is indeed smaller than big_icon.
In this particular case with a 32x32 and a 32x64 icon, you can just switch them;
var/icon/small_icon = '32x32_icon.dmi'
var/icon/large_icon = '32x64_icon.dmi'

large_icon.Blend(small_icon, ICON_UNDERLAY)


this won't work if, say, you have a 32x64 and a 64x32.
Lummox JR resolved issue (Not a bug)
Alright, that's what I thought the case might be. I'll try using Crop(). Thanks.