fredsa / forplay

Automatically exported from code.google.com/p/forplay
Apache License 2.0
12 stars 4 forks source link

setCompositeOperation with alpha on Canvas #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
You can draw an image to a canvas with a composite mode via 
setCompositeOperation, but you can't set the overall alpha for composition. 
This would be useful for scene cross-fades.

Ideally you would be able to call setCompositeOperation(Composite, float) to 
set an associated alpha for the composition mode. This would map to 
AlphaComposite. getInstance(int, int) in Java and globalAlpha for the HTML5 
canvas. I'm not sure of the WebGL equivalent.

Original issue reported on code.google.com by m...@gri.pe on 27 May 2011 at 10:40

GoogleCodeExporter commented 9 years ago
I believe this is roughly equivalent to Canvas.setGlobalAlpha(). IIRC, there 
was something that made this tricky to do the same way in Java2D, but I'll have 
to dig back into it to remember precisely what that was. Either way, the 
use-case is a good one.

Original comment by jgw@google.com on 29 May 2011 at 12:41

GoogleCodeExporter commented 9 years ago
Philip sent out a patch for issue 26 that should be committed soon. This will 
give us alpha on layers, and includes most of the infrastructure we need for 
alpha on Surface/Canvas.

@Philip: Since you like alpha so much, want to have a stab at this one as well? 
:)

Original comment by jgw@google.com on 14 Jun 2011 at 1:31