How do I export the canvas with the effect applied?

0 favourites
  • 12 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • I have a canvas(plugin by rojohound) that export the content in a .png file with alpha.

    If this object have any blend applied also export the result correctly.

    But if the object have any other effect like the "tint" one to get things colored, in the export appear the sprite without the effect.

    What's wrong? Or the effects applied on a sprite are not supported in canvas?

    Edit: Well the blend effects like Destination TOp and other ones not works correclty either

  • matriax

    If you mean the 'canvas plugin' by rojohound, I dont think it works with webgl...try using the paster plugin instead.

  • Thanks chrisbrobs , this paster works with effects... but not with blends(Additive,XOr,Source Atop..) like the Canvas plugin, that some ones export correctly and other not but at least the additive and the importants work.

    So R0J0hound the "blend mode" on sprites are not supported with paster?

    Edit: I'm using NW.Js

    And in paster the "set resolution" works correctly so now i guess i will can asjust to the window size. In canvas the "resize canvas" option, stretch all the draw when export .

  • As far as I know pasting stuff with blend modes to either canvas or paster works fine. With paster some of the blend modes have slightly different behavior with webgl on but this has to do with webgl and not the plugin.

    You'll need to give examples of how it doesn't work since blend modes worked fine for both plugins all the times I've used them.

  • Hi R0J0hound ! thanks for the fast reply!

    Here is the event i'm using, is the same on canvas.

    With canvas plugin some ones worked but with paster none works using the same event.

    Here is the program i'm doing, a 2d tool:

    https://dl.dropboxusercontent.com/u/659 ... _p102.capx

    The events is bookmarked, you can find in the "Global" event sheet, the last event, in group Paster inside the Options.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • matriax

    What is the line- system...wait 0 seconds .. meant to do?

  • I don't have all those plugins so I can't open it. I made a test and everything seems to be working fine with the paster object from my end.

    I added a sprite and a paster object to the layout. Then made an event:

    start of layout:

    --- paster: clear to (0,0,0,100)

    --- paster: paste sprite

    --- browser: invoke download of paster.imageUrl

    That worked fine. Even when changing the sprite's blend mode to any of the others. The only exception is xor, which doesn't work with webgl, but that is C2 wide.

  • chrisbrobs Is to be sure the event will run at the last of the tick, to be sure all sprites are pastes, but seems there is no need.

    R0J0hound I found the problem. If the sprite have an effect, like "Tint" the Paster plugin export without blend. If i remove the effect tint all the blend works as you said.

    Edit: The effect tint is added to the Sprite Family.

  • Ah, it's probably an issue with pasting with effects and blend modes then. I won't be fixing any part of the plugin that involves applying effects any time soon.

    A possible solution could be to paste the object to another paster first, then apply a blendmode to that.

  • But if i create various sprites, each one with their effects and blend modes, that not works because only will apply one blend or type of effect to the entire paste composition, or i'm missing something? Also an object always have effects added but are disabled until the user will active one or other.

    Other way can be find the code of each blend mode and create their effect, so only effects will be used. I tried to look in the folders but i can't find where they saved, the other are in the "effects" folders but the blend modes built-in i not saw anything.

  • In a nutshell the paster object only has limited support for effects as I recall. It works fine if the object uses only one effect, but it ignores alpha and blendmodes apparently. Also multiple effects are not chained correctly. There are also issues with effects relying on screen position. It uses a heavily modified version of the code C2's renderer uses to apply effects. The goal was to make results identical but there were a number of things that needed to be reworked to make it work, and I lost interest before working out solutions to many of them. In the end I don't use webgl since it performs worse on my PC than with it disabled so I haven't had any reason to persue it further. Not to mention it is a very time consuming thing to work on, and unfortunately I don't have that kind of time anymore.

    The blend modes are built in and don't use effects. A solution could be to only do one step at a time and use multiple paster objects to store each step:

    paster1: paste sprite //sprite has effect1

    paster2: paste paster1 //paster1 has blend mode

    paster3: paste paster2.

    Another idea is maybe just using the canvas snapshot system action?

  • The snapshot simply do a capture of an area, not saves the alpha , i already tried.

    About the pasters i think is the same problem if i understood you well. All sprites have their efects and blend types. To do that i have to save for each one what blend have and set normal to do the paster correctly and set after the blend mode saved. And well set all the pasters and all correctly with my skills... also will be a big change that how i have set all so before thinking to do something like that i want to test all other ideas.

    I think the best thing actually as i said is use only effects. For example the additive blend mode is equal(or very simialr) to the "screen" effect. Maybe if i can know what is the code/script of the blend modes built-in i can replicate them or look how do something similar i don't know.

    Because, without canvas/paster, there is no other way or plugin/behaviour to do the same right? At least i not found nothing.

    Well, thanks for took your time for reply!, i will investigate and try add various effects to see how works all.

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