by Digby » Aug 16, 2001 @ 9:39pm
GAPI will give you a pointer to the display memory buffer. GAPI also has a function you can call to get the pixel format of this buffer. If you know both of those things, you can read and write to this buffer and things will show up on the display.<br><br>What you're doing with those masking ROPs is basically performing a transparent blit. That is, some pixels in the rect will make it to the display surface and some won't. You currently determine this with a monochrome mask, and ask GDI to perform a logic operation using this mask during the blit.<br><br>With GAPI, you don't need any of this. Since you are going to be copying data from your sprite buffer to the display buffer, all you need is a way to tell if a particular pixel in your sprite is transparent or opaque. If it's opaque, you write the value to the appropriate address in the display buffer. If it's transparent, you're done and can move to the next pixel in the sprite.<br><br>Marking pixels as transparent can be done in a number of ways. You could use your monochrome mask that you have now. You would traverse the mask along with traversing the sprite buffer. If the mask bit is set, then you copy the pixel from the sprite to the display buffer. You can also use a colorkey scheme where you pick one color that isn't used by your sprite and set all of the transparent pixels in the sprite buffer to that color. When you're traversing the sprite buffer and come across this color, you skip the pixel. You could also dedicate a bit in the pixel (an alpha bit) that could flag the pixel as being transparent or opaque.<br><br>Hope that helps. There's an article on GAPI programming on Microsoft's Pocket PC site, but I think it has errors in the code. Recently there was a series of articles on GAPI on brighthand.com written by Larry Bank. You might give that a look. As always lots of us here have dealt with GAPI and can help you if you get stuck.<br>