Trying to build a contrast & saturation filter
This commit is contained in:
@@ -86,7 +86,9 @@ function Brush(rune)
|
||||
}
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
{
|
||||
if(position.is_outside()){ return; }
|
||||
|
||||
if(keyboard.shift_held == true){
|
||||
this.erase();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ function Frame(rune)
|
||||
ronin.frame.element.style.marginTop = -(this.settings["size"].height/2);
|
||||
|
||||
ronin.on_resize();
|
||||
ronin.terminal.log(new Log(this,"Resized Surface to "+this.settings["size"].render()));
|
||||
}
|
||||
|
||||
this.crop = function(params, preview = false)
|
||||
@@ -95,8 +94,6 @@ function Frame(rune)
|
||||
|
||||
this.add_layer = function(layer)
|
||||
{
|
||||
ronin.terminal.log(new Log(this,"Creating layer:"+layer.name+(layer.manager ? "["+layer.manager.constructor.name+"]" : "")));
|
||||
|
||||
layer.resize(this.settings["size"]);
|
||||
this.layers[layer.name] = layer;
|
||||
this.element.appendChild(layer.element);
|
||||
@@ -158,21 +155,6 @@ function Frame(rune)
|
||||
if(keys[loc-1] != null){this.select_layer(ronin.frame.layers[keys[loc-1]]);}
|
||||
}
|
||||
|
||||
// this.passive = function(cmd)
|
||||
// {
|
||||
// var crop = ronin.terminal.cmd().method("crop");
|
||||
|
||||
// if(crop && crop.params.length == 2){
|
||||
// console.log(crop);
|
||||
// ronin.overlay.get_layer(true).clear();
|
||||
// ronin.overlay.draw_rect(new Position(crop.params[0]),new Rect(crop.params[1]));
|
||||
// }
|
||||
// else{
|
||||
// console.log("Missing params")
|
||||
// }
|
||||
// ronin.terminal.update_hint();
|
||||
// }
|
||||
|
||||
// Cursor
|
||||
|
||||
this.mouse_mode = function()
|
||||
|
||||
@@ -62,8 +62,6 @@ function Layer(name,manager = null)
|
||||
|
||||
this.resize = function(rect)
|
||||
{
|
||||
ronin.terminal.log(new Log(this,"Resize "+this.name+" to "+rect.render()));
|
||||
|
||||
var pixels_rect = new Rect(this.element.width+"x"+this.element.height);
|
||||
|
||||
this.element.width = rect.width * 2;
|
||||
@@ -76,7 +74,6 @@ function Layer(name,manager = null)
|
||||
|
||||
this.remove = function(manager)
|
||||
{
|
||||
ronin.terminal.log(new Log(this,"Removing layer "+this.name));
|
||||
manager.layer = null;
|
||||
ronin.frame.layers[this.name].element.outerHTML = "";
|
||||
delete ronin.frame.layers[this.name];
|
||||
|
||||
@@ -22,7 +22,6 @@ function Path(rune)
|
||||
|
||||
var context = preview ? this.context() : ronin.frame.context();
|
||||
|
||||
console.log(this.settings["line_width"]);
|
||||
context.beginPath();
|
||||
context.lineCap = this.settings["line_cap"];
|
||||
context.lineWidth = this.settings["line_width"];
|
||||
|
||||
@@ -2,7 +2,6 @@ function Render(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
this.parameters = [Any];
|
||||
this.collection = {};
|
||||
|
||||
this.collection["rotate"] = new Filter_Rotate();
|
||||
@@ -12,6 +11,8 @@ function Render(rune)
|
||||
this.collection["invert"] = new Filter_Invert();
|
||||
this.collection["chromatic"] = new Filter_Chromatic();
|
||||
this.collection["sharpen"] = new Filter_Sharpen();
|
||||
this.collection["saturate"] = new Filter_Saturate();
|
||||
this.collection["contrast"] = new Filter_Contrast();
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
function Source(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
this.parameters = [Filepath,Position,Rect];
|
||||
|
||||
this.add_method(new Method("save",["name","rect","format"]));
|
||||
this.add_method(new Method("load",["path","position","rect"]),"Add point");
|
||||
|
||||
this.load = function(params,preview = false) // source.load ../assets/todo.jpg 200x200 40,40
|
||||
{
|
||||
if(!params.filepath() || !params.rect() || !params.position()){ ronin.terminal.log(new Log(this,"Missing image path.","error")); return; }
|
||||
if(!params.filepath() || !params.rect()){ ronin.terminal.log(new Log(this,"Missing image path.","error")); return; }
|
||||
|
||||
this.get_layer(true).clear();
|
||||
|
||||
@@ -17,8 +15,8 @@ function Source(rune)
|
||||
|
||||
ronin.overlay.get_layer(true).clear();
|
||||
|
||||
var position = params.position() ? params.position() : new Position();
|
||||
ronin.overlay.draw_rect(params.position(),params.rect());
|
||||
var position = params.position() ? params.position() : new Position("0,0");
|
||||
ronin.overlay.draw_rect(position,params.rect());
|
||||
|
||||
base_image = new Image();
|
||||
base_image.src = "../assets/"+params.filepath().path;
|
||||
@@ -50,13 +48,13 @@ function Source(rune)
|
||||
|
||||
var d = null;
|
||||
|
||||
var w = window.open('about:blank','image from canvas');
|
||||
ronin.terminal.query("terminal.display mini");
|
||||
|
||||
if(params.setting("format") && params.setting("format").value == "svg"){
|
||||
w.document.write("<title>Untitled</title><body>"+ronin.path.create_svg()+"</body>");
|
||||
ronin.terminal.log(new Log(this,ronin.path.create_svg(),"image"));
|
||||
}
|
||||
else if(params.setting("format") && params.setting("format").value == "jpg"){
|
||||
w.document.write("<title>Untitled</title><body><img src='"+this.merge().element.toDataURL('image/jpeg')+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/></body>");
|
||||
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');
|
||||
@@ -65,8 +63,7 @@ function Source(rune)
|
||||
w.document.write("<title>Source</title><pre>"+html+"</pre>");
|
||||
}
|
||||
else{
|
||||
console.log("!!")
|
||||
w.document.write("<title>Untitled</title><body><img src='"+this.merge().element.toDataURL('image/png')+"' width='"+ronin.frame.settings["size"].width+"px' height='"+ronin.frame.settings["size"].height+"px'/></body>");
|
||||
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"));
|
||||
}
|
||||
|
||||
this.layer.remove(this);
|
||||
|
||||
@@ -132,6 +132,9 @@ function Terminal(rune)
|
||||
else if(ronin[module_name]){
|
||||
ronin.terminal.log(new Log(ronin.terminal,"Unknown method: "+method_name));
|
||||
}
|
||||
else if(module_name == "render"){
|
||||
ronin.terminal.log(new Log(ronin.terminal,"Unknown filter: "+method_name));
|
||||
}
|
||||
else{
|
||||
ronin.terminal.log(new Log(ronin.terminal,"Unknown module: "+module_name));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user