Alpha Blending using BitBlt's raster features and, is there such as thing as Hardware Rastering in DirectDraw?
Posted on 2004-09-08
I've read up on methods for alpha blending on DirectDraw in MSDN. The only methods they offer is to do it "by hand" which means to lock the surface, do a pixel blending directly onto the back buffer, before unlocking.
So therefore, my understanding is,
Alpha Blending is a mixture of 1 or more surfaces with less than 100% opacity.
So for example, I have a magenta surface RGB(255, 0, 255) at 50% opacity. RGB(127, 0, 127)
Then I have a white surface RGB(255, 255, 255) at 50% opacity. RGB(127, 127, 127)
Logically when I blend these 2 surface together I'll get BRIGHT MAGENTA right?
Technically it should be RGB(254, 127, 254) - a bit of pink I believe.
I was thinking, could I have used a simple raster operation to actually perform this blending?
which is, SRCAND? The only raster ops I can perform is by using the WIN32's bitBlt method which is rather ... slow...
Secondly, I often find Hardware Rastering in DirectDraw a pain. It doesn't seem to work at all. Can anybody explain why?
Lastly, please do not advise me to use OpenGL 3D or Direct3D for Alpha Blending. My level of games programming is still relatively low and I'm still at DirectDraw.
Thanks for your attention and guidance.