Transparent Background with nw.js

0 favourites
  • 13 posts
From the Asset Store
40 Funky tanks PNG transparent in different colours - 2048x2048
  • 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?

  • 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...

  • It seems this thread is my best hope at the moment:

    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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Paster, or Canvas plugs will do what you are wanting.

  • 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.

  • 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.

  • did you try with Browser object(Execute Javascript)?

    Transparency Window

    "var gui = window.require('nw.gui');
    gui.Window.get().setTransparent();"[/code:hu9hlanh]
  • did you try with Browser object(Execute Javascript)?

    Transparency Window

    "var gui = window.require('nw.gui');
    gui.Window.get().setTransparent();"[/code:3fmrz68n]
    

    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.

  • .. but it sadly doesn't seem to be working..

    are you sure?

  • > .. 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

  • yea...probably works only if you disable WebGl...not the best solution...

  • yea...probably works only if you disable WebGl...not the best solution...

    I wonder why turning webgl off allows transparent backgrounds? Sadly as I'm using a lot of effects like tint this isn't an option, but I'm going to keep exploring it :/

  • > yea...probably works only if you disable WebGl...not the best solution...

    >

    I wonder why turning webgl off allows transparent backgrounds? Sadly as I'm using a lot of effects like tint this isn't an option, but I'm going to keep exploring it :/

    AlexFrancois

    Hi, I’m trying to achieve the same(transparent background with nw.js and WebGL), did you find the solution to this problem?

    Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)