aduros / flambe

Rapidly cook up games for HTML5, Flash, Android, and iOS.
https://github.com/aduros/flambe/wiki
MIT License
745 stars 118 forks source link

html5 color / masking bug #352

Open SavedByZero opened 9 years ago

SavedByZero commented 9 years ago

I have this masking code:

g.save(); g.drawTexture(_texture, 0, 0); g.setBlendMode(BlendMode.Mask); g.drawTexture(_mask, 0, 0);

    g.restore();

It works fine for the Flash and android targets, but for html5, the colors of that object appear all black. The odd thing is, this only used to happen for Chrome. But now it's started happening in Firefox also.

aduros commented 9 years ago

Do you know if that's with the WebGL or canvas renderer?

There's an issue with Mask that's documented in the BlendMode API doc. In canvas, the blend mode is unbounded, meaning the source alpha will be applied to the entire destination image. On other renderers, only the parts of the destination within the bounds of the source image will be affected. Could that be what's going on here?