Saving image quality

This commit is contained in:
Devine Lu Linvega
2017-04-16 14:09:53 -10:00
parent 710b807e89
commit 540452ea39
7 changed files with 43 additions and 38 deletions

View File

@@ -8,7 +8,7 @@ function Filter_Stencil()
var angle = cmd.angle() ? cmd.angle().degrees : 20;
var color = cmd.color() ? cmd.color().hex : "#ffffff";
ronin.render.layer.clear();
ronin.frame.active_layer.clear();
this.draw(ronin.frame.context(),angle,color);
}

View File

@@ -130,21 +130,18 @@ function Cursor(rune)
this.update = function(event)
{
// if(ronin.terminal.module_name){
// this.set_mode(ronin.module);
// }
// else if(event.altKey == true && event.shiftKey == true){
// this.set_mode(ronin.frame.active_layer);
// }
// else if(event.altKey == true){
// this.set_mode(ronin.default);
// }
// else{
// this.set_mode(ronin.brush);
// }
if(event.altKey == true && event.shiftKey == true){
this.set_mode(ronin.frame.active_layer);
}
else if(event.altKey == true){
this.set_mode(ronin.default);
}
else{
this.set_mode(ronin.brush);
}
}
this.set_mode = function(mode)
this.set_mode = function(mode = ronin.brush)
{
if(this.mode == mode){ return; }
this.mode = mode;

View File

@@ -2,6 +2,8 @@ function Source(rune)
{
Module.call(this,rune);
this.settings = {"format":"jpg","quality":"1"};
this.add_method(new Method("save",["name","rect","format"]));
this.add_method(new Method("load",["path","position","rect"]),"Add point");
@@ -50,21 +52,24 @@ function Source(rune)
ronin.terminal.query("terminal.display mini");
if(this.settings["format"] == "jpg"){
ronin.terminal.log(new Log(this,"<img src='"+this.merge().element.toDataURL('image/jpeg',parseFloat(this.settings["quality"]))+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/>","image"));
}
else{
ronin.terminal.log(new Log(this,"<img src='"+this.merge().element.toDataURL('image/png',parseFloat(this.settings["quality"]))+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/>","image"));
}
/*
if(params.setting("format") && params.setting("format").value == "svg"){
ronin.terminal.log(new Log(this,ronin.path.create_svg(),"image"));
}
else if(params.setting("format") && params.setting("format").value == "jpg"){
ronin.terminal.log(new Log(this,"<img src='"+this.merge().element.toDataURL('image/png')+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/>","image"));
}
else if(params.setting("format") && params.setting("format").value == "rin"){
var w = window.open('about:blank','source');
var html = "";
for (i = 0; i < ronin.terminal.history.length; i++) { html += ronin.terminal.history[i]+";<br />"; }
w.document.write("<title>Source</title><pre>"+html+"</pre>");
}
else{
ronin.terminal.log(new Log(this,"<img src='"+this.merge().element.toDataURL('image/png')+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/>","image"));
}
else
*/
this.layer.remove(this);
}

View File

@@ -187,7 +187,7 @@ function Terminal(rune)
}
}
else{
ronin.cursor.set_mode(ronin.brush);
ronin.cursor.set_mode();
}
this.hint(content);