Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SSH on Mon 08/05/2006 17:17:02

Title: Bug resizing sprites
Post by: SSH on Mon 08/05/2006 17:17:02
If I use DynamicSprite.Resize or RawDrawResized and expand a sprite 4x the first and last column and row are all expanded only 2x. If this expected behaviour, it should at least be documented. I worked around it by grabbing an extra pixel around each side, but its a pain!
Title: Re: Bug resizing sprites
Post by: Pumaman on Mon 08/05/2006 20:32:30
The resize routines are pretty much standard nearest-neighbour affairs, however you can't really rely on an exact implementation of resizing. I don't really think it's something that requires documentation.
Title: Re: Bug resizing sprites
Post by: SSH on Mon 08/05/2006 21:12:46
Well, I mean all the pixels around the edge were only 2-pixels wide on 4x resize. One in the middle were all 4x.
Title: Re: Bug resizing sprites
Post by: Kweepa on Mon 08/05/2006 22:37:00
So you're saying if you resize a 3x3 like this:

123
456
789

You end up with this:

11222233
11222233
44555566
44555566
44555566
44555566
77888899
77888899

I must be misunderstanding. That's not 12x12.
Title: Re: Bug resizing sprites
Post by: SSH on Tue 09/05/2006 05:51:59
yes, butl, i presume that the pixels in the middle are being consequently expanded by more. In your example the widths would be 3 and 6... in my code, I am using larger sprites (e.g. 10x10 expanded to 120x120) where the effect is very visible.

To see the effect, download my walkcycle generator beta http://ssh.me.uk/wcgendemo.zip, press "Head" for example, then click on the head picture to make it appear in the drawing window at the bottom. Thn click the grid icon to make the grid toggle: you can see how I have added a ring of 1 pixel around the edge of the Zoomed picture to avoid the problem, and the grid shows the edges with narrow pixels.
Title: Re: Bug resizing sprites
Post by: Kweepa on Wed 10/05/2006 20:26:42
Ah yes, I see. So it looks like the nearest neighbour choice starts from the center (or thereabouts) of the edge pixels.