OskarE

blendModesCanvas list not always being set correctly

Recommended Posts

Hello! I am working on a Phaser project (however, the issue is PIXI related). I was having issues with blend modes not always being set correctly when reloading my page. After a couple of days me and my colleague found that the PIXI.blendModesCanvas was being set to something like ["source-over", "lighter",  "source-over", "source-over", "source-over", "source-over"] etc. I don't know if other people have ran in to this bug, but I thought I would document this here at least, and if it still exists in newer versions of Phaser/PIXI, that is what is causing it. To fix it we just set the PIXI.blendModesCanvas to a correct list when we start loading the game.

 

We are using Phaser 2.6.2 at the moment, and the correct list is: 

["source-over", "lighter", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"]

Share this post


Link to post
Share on other sites

Its phaser-related, because you have to look in phaser source code to solve that issue.

Those modes weren't supported in old versions of browsers. 

https://github.com/photonstorm/phaser-ce/blob/master/src/pixi/renderers/canvas/CanvasRenderer.js#L274

Now you have to find out how does phaser detect whether they are supported. May be its like modern version of pixi - it tries `multiply` and checks if image data is correct. But in some browsers getImageData can be switched off for security reasons (Tor, Mozilla Nightly)

I dont know where did they move v2.6.2 in github, it was there a week ago im sure.

Share this post


Link to post
Share on other sites

I see! What was weird was it was happening randomly on Chrome Version 63.0.3239.84. It might be related to Phaser 2.6.2 then (haven't had the time to try out any later versions yet, and we are too far into production to change). I will have to try some different browsers and see if just forcing to array to be specified from us and if it still works then, or if we have to check what browser is being used. 

 

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.