best way to reshape a sprite (with alpha), using the alpha of another sprite?

Started by Monsieur OUXX, Sun 13/04/2014 18:48:14

Previous topic - Next topic

Monsieur OUXX

[AGS 3.3.0]
I'm struggling with a paradigm that doesn't seem to have a straightforward solution in AGS.

- I have a sprite s1 (it has some transparent pixels, i.e. a custom shape).
- I have another sprite s2 that also has alpha: I use only for its shape.

I want s1 to be "recut" with the shape of s2: Its transparent bits should remain transparent, but the non-transparent bits should become transparent if s2 is transparent in that location. (s2 would be some sort of transparency mask for s1).

I thought I was a smart guy by doing CopyTransparencyMask of s2 over s1... what I didn't anticipate, though, is that the alpha channels are not additive -- that means everything transparent in s2 becomes transparent in s1, and that's cool,  BUT everything that was transparent in s1 becomes pink. Dang.

Is there a simple way to do that? Or am I doomed to process the sprites pixel by pixel??? I've scripted that solution already but I don't reach sufficent performance rates.


 

Monsieur OUXX

failing to find a suitable solution, I'll just use a walkbehind, since the mask (s2) is not supposed to move around.
 

SMF spam blocked by CleanTalk