Different Transparency
- Posted by Damien Black <the.lucky.mutt at gmail.com> Nov 16, 2005
- 483 views
Hello everyone, I've put together a type of transpareny that I think would be very useful if it can be implimented. But I seem to be having troubles getting it working, or even figuring out how to get it working. Some input from you guys would be appritiated. Ok, here is what I'm trying to do. For each pixel, there would be an additional value called height. So instead of just RGB, each pixel would be RGBH. The transparent routine would consider a pixel transparent and not place it if the current pixel's H is greated than its own. I'm sure you see the benifit, you would have a sort of home-made 256 different buffers, all in one. It will be especially useful in my isometic game program (which is coming along nicely) because instead of repinting all the graphics that may overlap a sprite, there is already a 'height' and in the isometric view, anything higher gets priority. Here's a few ways I've thought about doing this, but failed at. 1) Edit the dibs to have 4 pixels a color instead of 3. Then have my machine code test the low byte's and only copy when soure's is higher than destinations. This works out great until I try to get it onto the screen, and then the delay of switching it back over to 3 byte per pixel mode give me unacceptable delays. Or am I just doing it wrong? I think there might be an easier way then actually switching it back. Wouldn't this be even faster than existing trasparency routines since you only have to check one byte equal to or greater than rather than a 3 byte equal to? I don't know. 2) Allocate a second block for each dib containing all of the H data so as to keep the original dib intact. The problem here is that my machine / assembler isn't good enough for the task of keeping track of four addresses and copying into two in any sort of quick manner, if it is even possible. Are there any other ways to do this? Am I re-inventing the wheel and has someone else done this? Is this not practical? Should I abandon the idea? Am missing something simple that would make this easier? Any comments would be appritiated. - Damien Black