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 / Set image mask (Alpha channel)

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th May 2016 07:17
Set image mask requires that;
The DESTINATION image has a mask when copying the alpha channel, other wise it will not work.
The DESTINATION image mask must also be smaller than the dimensions of the image, other wise it will not work.

Attachments

Login to view attachments
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 9th May 2016 18:26
I find image mask functionality in AppGameKit to be extraordinarily confusing and poorly documented.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th May 2016 21:37
i think it is that one thing i mentioned that scares people away. if you setup the mask correctly then it all works as documented.
i would be great if it was mentioned in the documentation i think
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th May 2016 07:42
Quote: "i would be great if it was mentioned in the documentation"

Great?

or a simple and basic expectation to have all commands documented?
AGK V2 user - Tier 1 (mostly)
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th May 2016 04:09 Edited at: 12th May 2016 04:09
my mistake
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 14th May 2016 17:05
Since the nomask_squiggle image has no transparency, the sprite it is applied to turns off transparency to improve performance. It doesn't realise that you later added transparency using the SetImageMask command. Using SetSpriteTransparency(nomask_sprite,1) fixes this.

Quote: "I find image mask functionality in AppGameKit to be extraordinarily confusing and poorly documented."

Sorry, I'm not sure how else to describe it, it copies a color channel from one image to another as mentioned in the documentation. Could you be more specific about which part you find confusing and I'll see if I can update the documentation to address this.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 15th May 2016 00:03
@Paul, I think sometimes having a few visuals can do wonders in explaining certain commands or concepts. In the case of image masking it can be confusing to understand exactly how the channels will blend and be affected by the original destination image color. E.g.,



To add:

Quote: "This is a slow command and should not be called every frame."


Is there any reason this command cannot be worked into either shaders of GL BlendFunc control so that it can be called each frame without slowing down an app? There are many more possibilities if we can dynamically adjust masks each frame rather than doing it only occasionally. I have not personally tested this command on mobile but would like to believe it could be done more efficiently so as not to be a slow command.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 15th May 2016 01:23
Quote: "Is there any reason this command cannot be worked into either shaders of GL BlendFunc control so that it can be called each frame without slowing down an app?"

You could assign each image to a different texture stage, then write a shader that selectively chooses which channel from which image goes to the final output.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th May 2016 13:04
Quote: "Since the nomask_squiggle image has no transparency"


I'm sorry. The name was a little misleading. Nomask_squiggle DOES have a mask. It's just that it occupies the entire image. load it into an image editor and you will see

Login to post a reply

Server time is: 2024-11-17 07:08:52
Your offset time is: 2024-11-17 07:08:52