Transparent Background with nw.js

Get help using Construct 2

Post » Thu Mar 31, 2016 10:03 am

Hi, I'm trying to export canvas snapshots with a transparent background, but nw.js by default sets the background to black. My understanding is that the lack of an alpha channel on the background is a performance optimisation, how can I reverse this?
Last edited by AlexFrancois on Fri Apr 01, 2016 9:26 am, edited 1 time in total.
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Thu Mar 31, 2016 8:24 pm

Something tells me @Ashley may be able to shed some light on this, I read an explanation for this in an old thread but I'm not technical enough to understand it...
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Fri Apr 01, 2016 9:36 am

It seems this thread is my best hope at the moment: oversight-in-node-webkit-exporter_t119147

I quote @Ashley "I added a flag in the runtime you can use to force alpha mode enabled: set runtime.forceCanvasAlpha to true." I'm not sure if this flag is still present in the latest c2 builds, furthermore I have no idea how to create a plugin, even a simple one with just this line! Any help would be greatly appreciated as this is pretty much making my app useless.
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Fri Apr 01, 2016 1:14 pm

Paster, or Canvas plugs will do what you are wanting.
Image ImageImage
B
168
S
50
G
164
Posts: 8,239
Reputation: 105,597

Post » Sat Apr 02, 2016 1:43 pm

newt wrote:Paster, or Canvas plugs will do what you are wanting.

I don't think they will help. The problem isn't importing images with transparency, it's exporting them.
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Sun Apr 03, 2016 2:46 pm

Still searching for a solution to this, been trying to build a plugin with no prior knowledge but I'm not even sure the runtime.forceCanvasAlpha flag exists any more as it doesn't appear here https://www.scirra.com/manual/26/runtime

Could really use your help @Ashley , my whole app is pretty much made redundant without alpha exported images.
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Sun Apr 03, 2016 4:26 pm

did you try with Browser object(Execute Javascript)?
Transparency Window
Code: Select all
"var gui = window.require('nw.gui');
gui.Window.get().setTransparent();"
Image
B
64
S
23
G
7
Posts: 1,483
Reputation: 10,827

Post » Sun Apr 03, 2016 5:21 pm

korbaach wrote:did you try with Browser object(Execute Javascript)?
Transparency Window
Code: Select all
"var gui = window.require('nw.gui');
gui.Window.get().setTransparent();"

Thanks for the suggestion, but it sadly doesn't seem to be working, I think it's for setting the transparency of the frame, rather than the actual content. I've also tried setting the background to transparent in the index.html with no luck.
B
11
S
3
Posts: 135
Reputation: 1,309

Post » Sun Apr 03, 2016 5:34 pm

AlexFrancois wrote:.. but it sadly doesn't seem to be working..

are you sure?
Image
B
64
S
23
G
7
Posts: 1,483
Reputation: 10,827

Post » Sun Apr 03, 2016 5:40 pm

korbaach wrote:
AlexFrancois wrote:.. but it sadly doesn't seem to be working..

are you sure?

I haven't been able to get it working, have you had any success with it?

I think the window object only really effects the frame, not what's inside the frame, hence why it says 'The transparent feature is only supported on Vista and above with DWM (Desktop Window Manager) enabled. ' as DWM deals with things like the transparency of a window's border, rather than what's inside which is determined by nw.js
B
11
S
3
Posts: 135
Reputation: 1,309

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie, Syazanie Amirin and 4 guests