Translucency on a 16 bit game
I making a 2d game and I want this effect for some sprites on the game.
Simple translucency is called blending or additive translucency (I think?).
It just adds the values of two colors together. I don't think you even
have to separate the RGB components before adding, it just works.
But adding two colors, like two white pixels together, can be too much and it
will overflow. So you have to decide how much of each pixel you want before
you add them together. A simple way is to add 50% color of each pixel,
because this will never be to much. You can also zero out the lower bit
of each RGB component to prevent overflowing of one RGB component into the
next RGB component when adding two colors.
And then there are DD surfaces. You can lock them, get a surface pointer,
loop through all the pixels, do your adding, and unlock them. There's also D3D
way to do it (hardware is good), but I haven't try it yet.
For fx effects like explosions, you can cheat by using transparency instead
of translucency. Just fill in the outline of the explosion with the transparent
color you want to use as a colorkey.
For see-through menus like the ones used in Starcraft, you just have to
use translucency to get that cool overlayed effect.
Reaver