Members - Reputation: 100
Posted 24 January 2012 - 12:15 PM
Is there a way to easily copy the alpha mask from one SDL surface to another?
I have a surface containing a dirt texture, and can carve out tunnels by modifying its per pixel alpha using a function. Is there a way to have another surface (a shadow, offset down and to the right of the dirt surface) inherit the dirt surface's alpha mask so that the shadow matches the carved-out dirt. At the moment I'm just parsing two surfaces into the carve function:
carveHole(SDL_Surface* surface, SDL_Surface* shadow, int x, int y, int radius)
However, this isn't very neat in my opinion, and I'd prefer to automate the shadow carving.
Failing that, would it be possible to blit the dirt twice, but have the first blit filled in black to simulate the shadow? Would save on having a whole different surface in memory, right?
Please forgive any stupidity, still early days with SDL!