Jump to content

blendModesCanvas list not always being set correctly


OskarE
 Share

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"]
Link to comment
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.

Link to comment
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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...