Author Topic: Feature request: scaling options in DS.DrawImage  (Read 616 times)

Jack

  • Think deviant
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
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

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Feature request: scaling options in DS.DrawImage
« Reply #1 on: 14 Dec 2017, 14:56 »
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.
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.
« Last Edit: 14 Dec 2017, 15:03 by Crimson Wizard »

Jack

  • Think deviant
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: Feature request: scaling options in DS.DrawImage
« Reply #2 on: 15 Dec 2017, 19:35 »
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

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: Feature request: scaling options in DS.DrawImage
« Reply #3 on: 19 Dec 2017, 17:25 »
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

  • Think deviant
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: Feature request: scaling options in DS.DrawImage
« Reply #4 on: 20 Dec 2017, 20:40 »
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.