Posted 19 January 2000 - 01:42 PM
You can shift the pixel to the right one bit to darken it, and bitwise AND it with a pre-prepared value (it needs to contain the MSB for the red green and blue components). If you are in 16-bit mode you can make a 128k lookup table, which is an alternative way of doing it. Another shortcut in 16-bit mode with the original method is operating on 2 pixels at a time (just remember to make your AND value work with this by shifting it left 16 bits and bitwise ORing it with the original value). I''ve assumed that you don''t need to have different levels of shadow, but if you do, then alpha blending isn''t going to be much slower than a specific function optimised for darkening.