Jump to content

  • Log In with Google      Sign In   
  • Create Account


Copying alpha mask from one surface to another in SDL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Milo87   Members   -  Reputation: 100

Like
0Likes
Like

Posted 24 January 2012 - 12:15 PM

Hi guys, first post here!

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!

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS