ronin/sources/scripts/modules/file.save.js
Devine Lu Linvega 8b963e6283 Improved design
2017-01-16 21:01:27 -07:00

22 lines
624 B
JavaScript

function FileSave(rune)
{
Module.call(this,rune);
this.parameters = [Any];
this.variables = {"format" : "png"};
this.active = function(cmd)
{
var d = null;
if(cmd.variable("format").value == "jpg"){
var d = ronin.surface.active_layer.element.toDataURL('image/jpeg');
}
else{
var d = ronin.surface.active_layer.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>");
}
}