Sign in to follow this  
Salmakis

Blend modes inside a canvas (wich is inside a java webView)

Recommended Posts

Hey, im using PixiJS 4 in a plattform that uses a java WebView on some plattfroms to display the Game.

It all seeems to work fine ,i allready made some small games and they are all working well.

But when i try to use the blend Mode "ADD" for some effects, then the rendering is broken anyhow, i made some images of the cases:
 

 

javaAdd.png

Anyone ever had this problem? anyone knows a solution?

Share this post


Link to post
Share on other sites

hi, thanks for you effort

i testet it with this little modified w3schools sample:

 

without the lighter blend the image is blue, with the ligther its than purple (red+blue)

and this variant is working in the java view thingy (its purple there)

 

<!DOCTYPE html>
<html>
<body>

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;">
	Your browser does not support the HTML5 canvas tag.</canvas>

<script>
	var c = document.getElementById("myCanvas");
	var ctx = c.getContext("2d");
	ctx.globalCompositeOperation = 'lighter';
	// Create gradient
	var grd = ctx.createRadialGradient(75,50,5,90,60,100);
	grd.addColorStop(0,"red");
	grd.addColorStop(1,"black");


	var grd2 = ctx.createRadialGradient(75,50,5,90,60,100);
	grd2.addColorStop(0,"blue");
	grd2.addColorStop(1,"black");

	// Fill with gradient
	ctx.fillStyle = grd;
	ctx.fillRect(10,10,150,80);
	ctx.fillStyle = grd2;
	ctx.fillRect(10,10,150,80);
</script>

</body>
</html>

 

Share this post


Link to post
Share on other sites
6 hours ago, ivan.popelyshev said:

Its strange. That's the only thing that is changed when you switch to ADD blendMode. Is there any kind of console?

What if you add that thing after you create a renderer?


renderer.blendModes[1] = 'lighter';

 

i just tried that, but changed nothing :(

yes i can hack some console style stuff into it, the value of renderer.blendModes[1] was "lighter" from begin

Share this post


Link to post
Share on other sites

hey, finally i had time to test this out.

i just used the latest pixijs.download/dev/pixi.js (28 dec)

but still the same issue :(

all grey as soon as something with ADD blending (and also a few others) blend has ben drawn (like the pictures above)

Share this post


Link to post
Share on other sites

Do you still need it? wow. Yeah, i have so many serious issues for v4, for next v5, and webgl, i cant focus on canvas. You can wait one more year when I have free time to setup Java environment like yours (or half-yeah, i already got intellij idea ultimate). Or you can provide more information to my telepathic abilities adn there's a chance i get you one-liner answer.

Or you can just take pixi sources and fix them, if its ok , make PR :)

More info, zip-file with environment and stuff => more chances that I can help you. And I think I'm the only one here with java background.

Share this post


Link to post
Share on other sites

Hello, if anyone like me finds this topic in search of answer to very same question, here are some links for you:

https://github.com/javafxports/openjdk-jfx/issues/552

and 

https://bugs.openjdk.java.net/browse/JDK-8229264

This issue wasn't created by me but reflects my experience with Canvas + WebView -- none of blend modes works.

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.