Translucency?

I want to blit translucency, one pixel at a time. I got a short array for the off-screen buffer, and I can do something like this to draw a pixel:

 short color = 0x000000;
 offScreenBuffer[i] = color;

The question is, how do I do translucency?

 offScreenBuffer[i] = calcTranslucency(offScreenBuffer[i], color); ????????

Thx in advance,
evan

Have a look at the Javadoc for java.awt.AlphaComposite, it has an explanation of how all the different possible compositing rules work.
Everything you need is there if you insist on implementing alpha compositing yourself. (though i can’t see a good reason to)

This was asked just a few months ago…

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=cluebies;action=display;num=1086024248

Hope it helps,

  • Dom

Thanks Guys!

I needed that info to use in my texture mapper. For each pixel, I have to be able to decide wether to draw it or not, based on a z-buffer.

Oh, one more thing. Is there a way to determine wether a pixel is translucent or completely opaque? I know how to figure out if a pixel is transparent, but not translucent. That would help optimize the code alot.

Thanks!
evanofsky