by Digby » Sep 4, 2001 @ 2:30am
If you're trying to mimic the masking technique with BitBlt's raster ops, then the easiest and fastest way to do this with GAPI is to use a color-key. Choose a color that isn't used in your sprite's image (magenta usually works) and set every transparent pixel in your sprite to that color. When you copy the sprite to the screen buffer (or back buffer), if you come across a pixel that matches the color-key, then you don't write a pixel to the screen and go on to the next pixel.<br><br>This is extremely easy to code, doesn't involve masks, or the addition of an alpha channel and should be much faster than the multiple BitBlt calls you were previously making.<br><br>If you want to perform actual alpha blending, that's a bit more involved. You should try the above method first, if for no better reason to familiarize yourself with GAPI and copying pixel data around manually. After that, read over my previous posts on alpha blending (I seem to explain this once a week these days). I'm happy to answer questions here or in e-mail but I'm not too hip on writing code for people. It seems to cause more problems than it's worth.<br><br><br>