Fixed issue with export

This commit is contained in:
Devine Lu Linvega 2017-01-11 10:11:38 -07:00
parent a9736cf9f9
commit efc8ac170f
3 changed files with 20 additions and 14 deletions

View File

@ -119,3 +119,8 @@ rate=10 ; variable: rate = 10
# Symmetric Light # Symmetric Light
> 1,1 600x;> 2,2 600x;> 3,3 600x;> 4,4 600x > 1,1 600x;> 2,2 600x;> 3,3 600x;> 4,4 600x
``` ```
### Twitter export & Watermark
```
# 1280x800 ; / assets/photo.jpg 1280x 0,0 ; / assets/hundredrabbits.png 60x60 20,720
```

View File

@ -9,9 +9,10 @@ function FileSave(rune)
var n = "Ronin Export"; var n = "Ronin Export";
var f = cmd.variable("format"); var f = cmd.variable("format");
var d = ronin.surface.merge(); var d = ronin.surface.merge();
d = ronin.surface.layers["render"].element.toDataURL('image/png'); d = ronin.surface.active_layer.element.toDataURL('image/png');
ronin.surface.layers["render"].clear(); // // ronin.surface.layers["render"].clear();
var w = window.open('about:blank','image from canvas'); var w = window.open('about:blank','image from canvas');
// w.document.write("hello")
w.document.write("<title>"+(n ? n : "Untitled")+"</title><body><img src='"+d+"' width='"+ronin.surface.size.width+"px' height='"+ronin.surface.size.height+"px'/></body>"); w.document.write("<title>"+(n ? n : "Untitled")+"</title><body><img src='"+d+"' width='"+ronin.surface.size.width+"px' height='"+ronin.surface.size.height+"px'/></body>");
} }

View File

@ -134,18 +134,18 @@ function Surface(rune)
this.merge = function() this.merge = function()
{ {
this.render_layer = this.layers["render"]; // this.render_layer = this.layers["render"];
var a = []; // var a = [];
Object.keys(ronin.surface.layers).forEach(function (key) { // Object.keys(ronin.surface.layers).forEach(function (key) {
if(key != "render"){ // if(key != "render"){
a.push(ronin.surface.layers[key]); // a.push(ronin.surface.layers[key]);
} // }
}); // });
for (i = a.length; i > 0 ; i--) { // 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); // ronin.surface.render_layer.context().drawImage(a[i-1].context().canvas,0,0,this.size.width,this.size.height);
} // }
return this.render_layer; return this.context();
} }
// Cursor // Cursor