views:

259

answers:

1

I have two different javax.swing.Icon objects and I want to a create new Icon which is the composite of these two. I want the composite to be a MULTIPLY effect, similair to what you would get in any photoshop-like image editing application when you choose that option. Specifically, per every pixel, if you have color Ca and Cb from image 1 and image respectively

Ca = (Ra,Ga,Ba) Cb = (Rb,Gb,Bb)

the i want output to be

Cc = (Ra*Rb,Ga*Gb,Ba*Bb)

I want to do this on the fly (in realtime), so I've got to do this using only Graphics2D operations. I've looked at AlphaComposite and don't see that this can be done. Anyone have any ideas?

+2  A: 

What you need is a "multiply" alpha composite. Conveniently, I asked the same question a while ago about a "screen" effect. I was pointed at http://www.curious-creature.org/2006/09/20/new-blendings-modes-for-java2d/, which has the multiply composite you need.

Zarkonnen
oooh. Perfect! Many thanks....
Joel Carranza