Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Can CreateRenderImage create sprites with transparency

Author
Message
Polaraul
9
Years of Service
User Offline
Joined: 13th Dec 2014
Location:
Posted: 3rd Mar 2015 19:58
Does CreateRenderImage() always create a black opaque image? Is it at all possible to create sprites with a transparent background using this command. All sprites created using this command just have a black opaque background with no alpha information (even if the original sprite pasted onto the render image did)

www.polaraul.com
Mike Archer
9
Years of Service
User Offline
Joined: 19th Feb 2015
Location: Wales
Posted: 3rd Mar 2015 23:10
The alpha values in the original sprite aren't preserved because they are used to determine how the sprite is placed onto the rendered image. If you placed 2 overlapping sprites into the image, you would not expect the overlapping parts of the original sprite to be overwritten with the alpha values & colours of the second sprite, you would expect the pixels to be merged according to the alpha values of the second sprite drawn. So that behaviour is correct.

I don't believe you can set the rendered image as transparent to start with either (Which would solve the problem).

You could use SetImageTransparentColor(), but this is a crude solution where the alpha value is either 0 or 255 and nothing in between. This only appears to work when the image is used as a sprite, and can't be used to set the image as initially transparent before you draw sprites to it.

Login to post a reply

Server time is: 2024-03-28 23:28:57
Your offset time is: 2024-03-28 23:28:57