Jump to content
  • Advertisement
Sign in to follow this  
gdg

SDL/Rotozoom with Alpha

This topic is 2463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, basically my problem is the following.

Firstly, my setup: I have an object which is actually one surface blitted onto another surface blitted onto the screen. Essentially it's a submarine, with a rudder, and the rudder of course has to stay "attached" to the submarine in the same position when the submarine rotates (diving and such). I felt it was easier to bind both to the same surface so I wouldn't have to rotate each separately, calculate the rudder's position, etc.

I preferred to sprite both with a black outline since I'm comfortable with that, I suppose. I also made the PNG backgrounds plain red so that I can manually alpha-filter this color instead of dealing with occasional funkiness if the images already have a transparent alpha channel.
Tur21.png

I included within my surface blitting functions an option for alpha filtering (via SDL_SetColorKey), which just eliminates red. It worked and I was able to successfully blit the rudder to the submarine, and the submarine to the screen without issue.

mWp7M.png

Now when I rotozoomSurface() the final product, of course it develops that big black background within the empty space as the rotozoomed surface expands.

eWOSx.png

Now granted, I understand exactly why it does this, so I'm not so concerned with strange behavior or anything so much as how exactly I can eliminate that black background without eliminating the natural border around my sprites. One option of course is to use an extremely deep gray outline/sprite without the borders altogether, but I'd prefer to keep the border and simply eliminate the excess black.

Any thoughts?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!