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 / Strange behavior with transparent png and setImageTransparentColor

Author
Message
Timshark
17
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 10th Apr 2013 23:53
Hi.
I've asked this Question as a side-question in another thread:

http://forum.thegamecreators.com/?m=forum_view&t=204623&b=41

But the thread is getting no response anymore so I thought I should make a new thread about this strange problem.

Using this Code:


And these two images:



And it creates this output:

The first ball keeps its transparency and adds another transparency with "setImageTransparentColor" but the other changes the tranasparency to white and does not keep it's transparency.

Anybody knows whats going on here?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 11th Apr 2013 02:15
AGK will look at the color of the pixels in the transparent areas and adjust the transparency accordingly. For example the transparent pixels in the original first image could be white, in which case AppGameKit is setting them to transparent again. The second image looks to have grey and black pixels in the original transparent area so AppGameKit is setting them to opaque. AppGameKit doesn't add more transparency to the image, it completely resets it based on your choice of color.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 11th Apr 2013 02:15 Edited at: 11th Apr 2013 02:19
I'm not sure how that second PNG was initially created or saved, but it appears there was a trace amount of opacity left in the transparent area which is what causes the problem. Here is the same image, but I selected the area outside of the circle and deleted it, then resaved. Should solve the problem.



Edit: Paul's answer makes more sense--even a fully transparent pixel will still have a color value assigned, and if the color value isn't white it seems this can cause problems with that command when used in the way you are.
Timshark
17
Years of Service
User Offline
Joined: 30th Jun 2007
Location: Oslo, Norway
Posted: 11th Apr 2013 02:37
Ahh. Great. So the transparent of the png really is a color and not a mask. Now I understand.

xCept: I did just as you - selected the area around the second ball and deleted it with my foreground Color being white and saved it. And now it works. But it seems that whatever color you have selected - either foreground or background - when you hit delete just makes it work. But the strange thing is that this works even if the ball have another part wich is white....so it cannot be purely color based.

But thank you both. I can now reproduce the effect.

Login to post a reply

Server time is: 2024-11-24 12:12:53
Your offset time is: 2024-11-24 12:12:53