ID:303418
 
Not a bug
BYOND Version:493
Operating System:Windows 7 Ultimate
Web Browser:Chrome 16.0.912.77
Applies to:Dream Maker
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 Developer forums.
Descriptive Problem Summary:
I'm generating different sizes for an icon (a simple blue 32x32 circle) and inserting them into one resultant icon. The problem is the artifact that's generated. Instead of clean states with just the resized icon, I get this:

Note that the icon itself is 100x100 (100 icon states with sizes 1x1 to 100x100). I don't think those bars should be forming, regardless of how it's cropping.

Numbered Steps to Reproduce Problem:
Rescale an icon and insert them into one icon (this will make the icon's actual size be the maximum size inserted)

Code Snippet (if applicable) to Reproduce Problem:
var circle_icon =   generate_icon_sizes('icons.dmi', "body")
var hole_icon = generate_icon_sizes('icons.dmi', "hole")

proc/generate_icon_sizes(file, state)
var icon/base = icon(file, state)
var icon/result = icon(base)
var icon/temp

for(var/n in 1 to 100)
temp = icon(base)
temp.Scale(n, n)
result.Insert(temp, "[n]")

return result

mob/verb/save_icons()
src << ftp(circle_icon, "circle.dmi")
src << ftp(hole_icon, "hole.dmi")


Expected Results:
An icon with 100 states of the same base icon, rescaled.

Actual Results:
See image above.

Does the problem occur:
Every time? Or how often? Every time
In other games? n/a
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
n/a

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.)
n/a

Workarounds:

I'm not sure I 100% follow what you're trying to do, but I do see you're making an incorrect assumption with Insert(). As legacy behavior, Insert() modifies the destination icon to fit the source icon's size. If you want the inserted icon to be 100x100, you'll have to Crop() it first.
Lummox JR resolved issue (Not a bug)
I guess my bug report is that the legacy behavior is stretching the north and west edges of the icon. The bars you see in the icon shouldn't be there, I simply resized a 32x32 icon of a circle (no bars could possibly fit inside it) and stored all the sizes into one file.

In other words, it's taking the pixels at x=n and y=n and stretching them to x=1 and y=100(ymax).

In other other words, it's taking the pixels at the top and left side of the circle and copy/pasting them all the way to the edge of the icon state.

Is that intended behavior, or just not a bug because I'm using Insert unexpectedly?
When you use Insert() at the 1x1 size, you're shrinking the destination icon down to 1x1. Then it's scaling up to 2x2. This continues until it reaches 100x100. There are definitely gonna be some artifacts from scaling up incrementally. But if you crop the inserted icon to the 100x100 size after scaling it, before inserting it, those artifacts won't happen.

Basically, your intent is to end up with a 100x100 icon with these 100 states in it, so you need to make sure any icons you insert match that size.
Okey dokey. Thanks.