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 / Transparent sprites looks pale using getimage()

Author
Message
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 26th Feb 2013 21:56
Finally got the bright idea to make a screenshot button for my game. However, I noticed that any sprites that uses an alpha setting lower than 255 becomes pale. It's like the transparency is replaced by a level of gray corresponding to the alpha value. Is there anything I can do about this or is this an issue that will be fixed in 108? Haven't had the time to try 108 yet. Still running 1076.

I use this code:



Demo 3 is out now!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 22:12
The alpha value does affect the opacity of the sprite. That is intentional, I believe, and not a bug to be fixed.

Its affect when used with get/save image may be a different issue.

Can you post some screen shots of the image as it appears in the app with the alpha value and then what the captured/stored image looks like?

This would help us figure out if the get/save image commands are working differently than they should.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 26th Feb 2013 22:31 Edited at: 26th Feb 2013 22:33


Noticed when I loaded the image into Photoshop that the saved .png had transparency. You got the game to the left and the AppGameKit produced screenshot to the right. You can see the transparency through the buttons. They are black in the middle and alpha set to 150. The black frame behind them is another sprite.

I also noticed a 1px border around the image that is semitransparent.


Demo 3 is out now!

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 22:55
It looks like the saved image is not getting the color for the sprite behind the buttons with alpha 150.

This appears to be in response to an issue where the get/save image combination wasn't getting the transparency of sprites at all.

Can you post this in the google issues board with the images? It looks like a legitimate issue.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 26th Feb 2013 22:55
Quote: "Is there anything I can do about this"

It depends on what you're try to get.

If it's a grey button you are getting from a white sprite, using for example;

(RGBA) 255,255,255,191 - which uses transparent white against black to get grey

you could substitute

(RGBA) 191,191,191,255 - which uses opaque grey to get the same effect.
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 26th Feb 2013 23:00 Edited at: 26th Feb 2013 23:02
I'll post it on the issues board. I'll throw together a example tomorrow. Can you upload files to the issues board?


Demo 3 is out now!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 23:05
Quote: "Can you upload files to the issues board?"

Yes.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 26th Feb 2013 23:10
Great, thanks


Demo 3 is out now!
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 27th Feb 2013 06:43 Edited at: 27th Feb 2013 06:54
This issue dates way, way back (see BatVink's post from May 2012). It was already filed as issue #288 and marked as low priority. Paul stated: "it is happening because the transparent image on top overwrites the back buffer alpha with the new alpha value. "

I ran into this same issue when porting a project from Objective C. I ended up hacking a fix myself by using the new Memblock commands in 1088, by setting the alpha byte of every pixel to 255 before saving the final image. I realize this doesn't help you as you are on 1076, but I'm sharing the solution for future reference. This project of mine is currently sitting on hold until TGC release the next version of AppGameKit, which will finally allow images to be saved to the user's image library on Android and iOS--the printImage() command "kind of" does that now but not in any usable way at least on Android.

Edit: Here's the small function I created to solve this (requires 1088+). For instance, if your original 'corrupt alpha' image is assigned to myImageID, you can call: myImageID = clearAlpha(myImageID) and it will return the modified version without any alpha.

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 27th Feb 2013 10:38
Holy mackerel, completely unrelated but I've just noticed that you can change the increments of 'for' statements with 'step'. I never knew that... Thanks xCept!
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 27th Feb 2013 15:09
Thanks xCept


Demo 3 is out now!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 28th Mar 2013 01:27
This problem seems to be similar, but I'm not sure. I have a sprite with a bit of partial transparency around it and if I duplicate the sprite from the back buffer using GetImage it appears that the transparency values are altered quite a bit.
The original sprite is on the left, the GetImage duplicate is on the right.



This is occurring in 1076, 1088, and 1089. I should be able to cope with it, but it might make my font a bit difficult to read on smaller devices.

The code is essentially:
CreateSprite(original)
ClearScreen()
DrawSprite(original)
img = GetImage(original sprite's boundaries)
ClearScreen()
CreateSprite(duplicate,img)
SetSpritePosition(duplicate, to the right of the original)
Sync()

Is there something I'm doing wrong that will allow me to prevent this alteration?

Thanks!

Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 28th Mar 2013 08:41
Naphier:
I wonder why you are doing what you are doing. What are you trying to achieve?


Demo 3 is out now!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 28th Mar 2013 16:28
What you see (or did see before the image's link broke) is just a test driver case. What I'm actually doing is making a sprite from multiple sprites.
I have a set of numbers with a transparent gradient outline. I don't need a full font file, so I'm just using numbers. I clone and arrange them as I like then use GetImage() to make a sprite out of the newly arranged numbers.
I can do this different ways, but this seemed to be the most straightforward. However, it appears this is the most bug-worthy

I started a new thread on it since it does appear to be different from your screen capture issue, though they may affect each other.
See here for code and images:
http://forum.thegamecreators.com/?m=forum_view&t=204469&b=41

Login to post a reply

Server time is: 2024-05-06 17:59:09
Your offset time is: 2024-05-06 17:59:09