For those who know Photoshop, you can change the mode of the image; Normal, Dissolve, Darken, Multiply, Screen etc.
Is there a way to do this with in Java?
For those who know Photoshop, you can change the mode of the image; Normal, Dissolve, Darken, Multiply, Screen etc.
Is there a way to do this with in Java?
[s]That looks like modulate to me.
dstColor*=srcColor;[/s]
Ofcourse I’m wrong - that is nothing like a modulate =)
Could you summarize that any further? : ( ???)
In java2d there are those composite modes and over in opengl you have blend funcs (in this case it would be GL_ONE, GL_ONE).
I’m doing something like this, and doesnt work:
...
AlphaComposite originalComposite = (AlphaComposite)g.getComposite();
g.setComposite(makeComposite(0.5F)); // 50% transparent
g.drawImage(...);
g.setComposite(originalComposite);
..
private AlphaComposite makeComposite(float alpha) {
int type = AlphaComposite.SRC;
return(AlphaComposite.getInstance(type, alpha));
}
This is all very new to me…any help appreciated. What do I change to make it work as intended?
Amazing what a quick google can find.
http://www.pegtop.net/delphi/blendmodes/
As to how to implement that in Java - implement the Composite interface, and define your own compositing rule. (you will in turn have to define a CompositeContext - with the necessary magic in the compose(Raster src, Raster dst, WritableRaster dstOut) method.
It won’t be quick though (so don’t use it in a real-time animation).
Thank you