Jump to content

  • Log In with Google      Sign In   
  • Create Account


SDL/Rotozoom with Alpha


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 gdg   Members   -  Reputation: 100

Like
0Likes
Like

Posted 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?

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