Some fun on the side, DirectX Test 4: Alpha Blending
By popular demand, I threw together an alpha blending example.
This takes two surfaces and blends them together. It currently "animates" them, with the alpha value increasing by .1, then decreasing by .1 from 0 to 1.
You can change this if you desire.
With my example, the two surfaces need to be exactly the same size. If you would like, you could add checks and balances to make this not so. You can change the pictures to whatever you'd like, as long as they are the same size.
It takes just over a second for each frame to do a 300x306 bitmap. I wouldnt recommend doing this in real time, unless they were very, very small surfaces and you only had to do a few of them. It would probably be faster to make the alpha blending code into a DLL file and make calls to it.
however, you could "pre-render" the alpha blending stages, then just blt them to the surface when you need them.
For example, if you wanted to turn a sprite green, you could open another copy of the sprite, and alpha blend it with a green color. Then use that sprite, since all the frames are done already.
You can download my source at
http://www.eternalflameonline.com/dxtes ... ending.rar
Enjoy it! Show me what you get working with it
