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 Studio Chat / Creating a renderImage froma loaded image retaining transparency.

Author
Message
Fokr
4
Years of Service
User Offline
Joined: 13th Mar 2020
Location:
Posted: 11th Feb 2021 16:47 Edited at: 11th Feb 2021 16:50
I'm trying to create a render image with transparence and then render further images and/or text to that image for use later. After trying a number of approaches I ca't get this working. I'm guessing I'm doing something wrong. Any ideas.

I need to:

1. Load a specified image from disk (with tranparency).
2. Create a render image from the image dimensions above (with transparency).
3. Draw the initial image to the render image.
4. Then I will draw further images to this render image retaining transparency.

Here is some latest experimental code. It's tier 2 but I guess similar calls in tier 1. Everything works as intended but there is no transparency around the initial image (just black). Any ideas? Thanks.

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 11th Feb 2021 19:57
Fokr
4
Years of Service
User Offline
Joined: 13th Mar 2020
Location:
Posted: 17th Feb 2021 15:38
I added the agk::SetSpriteTransparency( iSpriteRef, 1 ); after the final CreateSprite call and it appeared to be ok (on the PC at least).

However, when I built and ran on iOS the transparent area was corrupt with random pixels.

Is this a problem with the order I am doing things or is it a bug on iOS?

Thanks
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 17th Feb 2021 17:26
Is the Alpha Channel output white noise? Or is there a pattern to it?
Fokr
4
Years of Service
User Offline
Joined: 13th Mar 2020
Location:
Posted: 18th Feb 2021 13:31
Quote: "Is the Alpha Channel output white noise? Or is there a pattern to it?"


There seems to be some kind of pattern. As I said it's fine on the PC. This is a screenshot from the iPad. I basicaly put a loop around the above code (including the SetSpriteTransparency call).

Login to post a reply

Server time is: 2024-04-20 06:45:31
Your offset time is: 2024-04-20 06:45:31