Moved merge to Save
This commit is contained in:
parent
d768306ab1
commit
0e06026b10
@ -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("<title>Untitled</title><body><img src='"+d+"' width='"+ronin.surface.size.width+"px' height='"+ronin.surface.size.height+"px'/></body>");
|
||||
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;
|
||||
}
|
||||
}
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user