Jump to content

  • Log In with Google      Sign In   
  • Create Account


gdg

Member Since 21 Mar 2012
Offline Last Active Mar 21 2012 10:14 PM
-----

Topics I've Started

SDL/Rotozoom with Alpha

21 March 2012 - 09:55 PM

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.
Posted Image

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.

Posted Image

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

Posted Image

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?

PARTNERS