tags:

views:

188

answers:

1
+2  A: 

This is a way to do it: (although it doesnt sound fast, it uses pure blitfunctions so potentially it could be fast enough)

  1. Create an offscreen bitmap the size of your window. (you only need to do this once, you could keep it for subsequent paints)
  2. Fill it with the solid color.
  3. Cookiecut holes in the offscreen bitmap with a distinct color (purple for instance)
  4. bitblt the entire bitmap onto your window, half opaque and with purple as the colorkey. (so purple is not copied).
Toad
Reinier, using a single color for the colorkey won't give me transparancy, but the idea has merit. I can create an offscreen image with an alpha channel and overlay it. It won't be anywhere near as fast as a bitblt op, but might still be fast enough. Thanks.
David Rutten
hi, I'm still convinced the colorkey works. This is the typical way to blit graphics with holes in them (the way sprites are blit in videogames). The rest of the image which doesn't have the colorkey, is blitted semi transparent. Not by setting the alpha in de offscreen image, but by overriding the alpha component in the blit. Anyhow, let me know how things progress
Toad
I've actually abandoned this approach altogether. I've tried about 10 different algorithms and the only one which looked good required me to post-process every pixel in a nested loop. Even with unsafe C# direct pixel access it proved to be too slow. I've resorted to merging the hole shapes prior to drawing, so I can get rid of all the overlaps. Thanks again for the effort though, much appreciated.
David Rutten