diff --git a/sources/scripts/modules/file.save.js b/sources/scripts/modules/file.save.js index 4613718..800b8d0 100644 --- a/sources/scripts/modules/file.save.js +++ b/sources/scripts/modules/file.save.js @@ -20,13 +20,26 @@ function FileSave(rune) var d = null; if(cmd.variable("format") && cmd.variable("format").value == "jpg"){ - var d = ronin.surface.active_layer.element.toDataURL('image/jpeg'); + var d = this.merge().element.toDataURL('image/jpeg'); } else{ - var d = ronin.surface.active_layer.element.toDataURL('image/png'); + var d = this.merge().element.toDataURL('image/png'); } var w = window.open('about:blank','image from canvas'); w.document.write("Untitled"); + this.layer.clear(); + } + + this.merge = function() + { + var a = []; + Object.keys(ronin.surface.layers).forEach(function (key) { + a.push(ronin.surface.layers[key]); + }); + for (i = 0; i < a.length; i++) { + this.layer.context().drawImage(a[i].context().canvas,0,0,ronin.surface.size.width,ronin.surface.size.height); + } + return this.layer; } } \ No newline at end of file diff --git a/sources/scripts/modules/surface.js b/sources/scripts/modules/surface.js index e5d3334..ad01f5c 100644 --- a/sources/scripts/modules/surface.js +++ b/sources/scripts/modules/surface.js @@ -131,22 +131,6 @@ function Surface(rune) { return this.active_layer.context(); } - - this.merge = function() - { - // this.render_layer = this.layers["render"]; - - // var a = []; - // Object.keys(ronin.surface.layers).forEach(function (key) { - // if(key != "render"){ - // a.push(ronin.surface.layers[key]); - // } - // }); - // for (i = a.length; i > 0 ; i--) { - // ronin.surface.render_layer.context().drawImage(a[i-1].context().canvas,0,0,this.size.width,this.size.height); - // } - return this.context(); - } // Cursor