Feature request: scaling options in DS.DrawImage

Started by Jack, Mon 11/12/2017 23:20:14

Previous topic - Next topic

Jack

It would be great to have a few scaling options other than simple pixel resize in DrawImage for DrawingSurface.

Usually blitting or resizing functions include a flag or enum to specify other resizing methods, like resampling. I am hoping that the function which the AGS engine uses for this allows something similar, so that it is just a simple matter of passing an optional parameter through AGS to whichever API it is employing for DrawImage. Default will be what it currently uses of course, and it will up to the game dev to take the needed CPU time into consideration.

It would make a huge difference in the game I am working on.

Crimson Wizard

#1
Quote from: Jack on Mon 11/12/2017 23:20:14I am hoping that the function which the AGS engine uses for this allows something similar, so that it is just a simple matter of passing an optional parameter through AGS to whichever API it is employing for DrawImage.
Unfortunately this is not the case, Allegro4 does not have any built-in resampling options.
There is only an additional "anti-aliasing stretch" function in AGS, it is used to scale characters and objects when "smooth scaled sprites" option is enabled in winsetup.

I believe writing scaling function in script (could perform slow, but there are examples of cool effects done in AGS Scripts, like mirrors or dynamic lighting), or plugin may be a good alternative.

Jack

I tried script resample and it's super slow for what I need (There were about 800 dynamic sprites in the end, generating them took about 11 seconds). Maybe I could optimize that somewhat and/or stick a loading bar on it, but getpixel/drawpixel doesn't work with partial transparency.

Now that I've seen how terrible script resample looks, plain old pixel resize doesn't look so bad anymore. :D

Monsieur OUXX

Quote from: Jack on Fri 15/12/2017 19:35:00
I tried script resample and it's super slow for what I need (There were about 800 dynamic sprites in the end, generating them took about 11 seconds). Maybe I could optimize that somewhat and/or stick a loading bar on it, but getpixel/drawpixel doesn't work with partial transparency.

Now that I've seen how terrible script resample looks, plain old pixel resize doesn't look so bad anymore. :D

Alternatively you could use the Lua plugin, which could probably let you tap indirectly into direct3D, onto which you could unload the mainprocess of resizing. Or, worst-case scenario, bulk-process arrays of pixels.
 

Jack

Quote from: Monsieur OUXX on Tue 19/12/2017 17:25:50
Alternatively you could use the Lua plugin, which could probably let you tap indirectly into direct3D, onto which you could unload the mainprocess of resizing. Or, worst-case scenario, bulk-process arrays of pixels.
Would probably work well but I'd like to stay linux compatible.

SMF spam blocked by CleanTalk