Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Janik on Sat 16/09/2006 04:17:01

Title: Plugin Question: SetSpriteAlphaBlended()
Post by: Janik on Sat 16/09/2006 04:17:01
Hi,

I'm having trouble understanding how to use the plugin function SetSpriteAlphaBlended properly. Here is what I am trying to accomplish:

I have tried using SetSpriteAlphaBlended on the sprites that were imported in the editor, and as the documentation says the result was unpredictable. The same sprite, if switched from blended to not blended, would appear differently at different times. As well, the non-alpha blended sprite was not scaled smoothly.

I was able to get something working by copying the original (alpha) sprite to a dynamic sprite, and using SetSpriteAlphaBlended on this. However this requires copying ALL the character sprites, so it is a little clunky and uses up memory.

Is there a way to do what I describe directly, or could it be added?

Thanks!
Title: Re: Plugin Question: SetSpriteAlphaBlended()
Post by: Pumaman on Sun 17/09/2006 14:55:18
Forgive me if I"m missing something but the functionality you describe sounds like AGS's default behaviour with regards to alpha channels, so I'm not sure what you're trying to accomplish?
Title: Re: Plugin Question: SetSpriteAlphaBlended()
Post by: Janik on Sun 17/09/2006 18:52:41
Since a picture is worth 1000 words :), I've prepared a image showing what I want to do:

All 4 images come from the same file.
The 2 on the left are imported with the alpha channel.
For the 2 on the right, when importing the file I specified NOT to use the alpha channel when AGS asks. The antialiased edge shows up as pure black instead.

What I would like to do is circled on the picture. I want to use the same sprite (the one imported with the alpha channel) to produce both effects. At 100% scaling, use the alpha channel to keep edges anti-aliased, and at other scalings, use only the pink color for transparency, and so be able to smoothly scale the sprites.

(http://www.dmgenie.com/ags/Edge_Demo.png)
Title: Re: Plugin Question: SetSpriteAlphaBlended()
Post by: Pumaman on Sun 17/09/2006 20:03:03
Ah ok, sorry yeah I forgot that AGS didn't do the smooth scaling with alpha blended images. Really it would be better to fix that than to change how SetSpriteAlphaBlended works, but it needs more investigation.