Improved guides

This commit is contained in:
Devine Lu Linvega 2017-05-25 08:58:00 -10:00
parent de467bc47b
commit 741b5c4a5a
7 changed files with 101 additions and 79 deletions

View File

@ -10,14 +10,14 @@ function Filter_Chromatic()
{ {
var position = cmd.position() ? cmd.position() : new Position(ronin.frame.size.width,ronin.frame.size.height); var position = cmd.position() ? cmd.position() : new Position(ronin.frame.size.width,ronin.frame.size.height);
var value = cmd.value() ? cmd.value().float : 5; var value = cmd.value() ? cmd.value().float : 5;
this.draw(this.context(),value,position); this.draw(this.context(),value,position);
} }
this.preview = function(cmd) this.preview = function(cmd)
{ {
if(cmd.position()){ if(cmd.position()){
ronin.overlay.clear(); ronin.overlay.draw(cmd.position());
ronin.overlay.draw_pointer(cmd.position());
} }
} }

View File

@ -15,17 +15,14 @@ function Cursor(rune)
this.update = function(event = null) this.update = function(event = null)
{ {
if(this.is_inside){ if(ronin.terminal.cmd().module()){
this.set_mode(ronin.default)
}
else if(ronin.terminal.cmd().module()){
this.set_mode(ronin.terminal.cmd().module()); this.set_mode(ronin.terminal.cmd().module());
} }
else if(keyboard.shift_held,keyboard.alt_held){ else if(keyboard.shift_held,keyboard.alt_held){
this.set_mode(ronin.frame.active_layer); this.set_mode(ronin.frame.active_layer);
} }
else if(event && event.altKey == true){ else if(this.is_inside){
this.set_mode(ronin.default); this.set_mode(ronin.default)
} }
else{ else{
this.set_mode(ronin.brush); this.set_mode(ronin.brush);
@ -149,20 +146,16 @@ function Cursor(rune)
this.layer.context().lineTo(position.x,position.y); this.layer.context().lineTo(position.x,position.y);
this.layer.context().lineTo(position.x,position.y + 5); this.layer.context().lineTo(position.x,position.y + 5);
this.layer.context().lineCap="round"; this.layer.context().lineCap="square";
this.layer.context().lineWidth = 3; this.layer.context().lineWidth = 2;
this.layer.context().strokeStyle = "#000000"; this.layer.context().strokeStyle = "#000000";
this.layer.context().stroke(); this.layer.context().stroke();
// Overlay
this.layer.context().moveTo(position.x + 5,position.y);
this.layer.context().lineTo(position.x,position.y);
this.layer.context().lineTo(position.x,position.y + 5);
this.layer.context().lineCap="round"; this.layer.context().lineCap="round";
this.layer.context().lineWidth = 1; this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = "#ffffff"; this.layer.context().strokeStyle = "#ffffff";
this.layer.context().stroke(); this.layer.context().stroke();
this.layer.context().closePath(); this.layer.context().closePath();
this.pointer_last = position; this.pointer_last = position;
@ -188,10 +181,16 @@ function Cursor(rune)
this.layer.context().moveTo(position.x + radius,position.y - radius); this.layer.context().moveTo(position.x + radius,position.y - radius);
this.layer.context().lineTo(position.x + size,position.y - size); this.layer.context().lineTo(position.x + size,position.y - size);
this.layer.context().lineCap="square";
this.layer.context().lineWidth = 2;
this.layer.context().strokeStyle = "#000000";
this.layer.context().stroke();
this.layer.context().lineCap="round"; this.layer.context().lineCap="round";
this.layer.context().lineWidth = 1; this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = "#ff0000"; this.layer.context().strokeStyle = "#ffffff";
this.layer.context().stroke(); this.layer.context().stroke();
this.layer.context().closePath(); this.layer.context().closePath();
this.pointer_last = position; this.pointer_last = position;
@ -206,11 +205,13 @@ function Cursor(rune)
this.layer.context().beginPath(); this.layer.context().beginPath();
this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false); this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false);
this.layer.context().lineWidth = 3;
this.layer.context().lineWidth = 2;
this.layer.context().strokeStyle = "#000000"; this.layer.context().strokeStyle = "#000000";
this.layer.context().stroke(); this.layer.context().stroke();
this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false); this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false);
this.layer.context().lineWidth = 1; this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = ronin.brush.settings["color"].value != "#000000" ? ronin.brush.settings["color"].value : "#ffffff"; this.layer.context().strokeStyle = ronin.brush.settings["color"].value != "#000000" ? ronin.brush.settings["color"].value : "#ffffff";
this.layer.context().stroke(); this.layer.context().stroke();
@ -228,9 +229,17 @@ function Cursor(rune)
this.layer.context().beginPath(); this.layer.context().beginPath();
this.layer.context().arc(position.x, position.y, (size/2), 0, 2 * Math.PI, false); this.layer.context().arc(position.x, position.y, (size/2), 0, 2 * Math.PI, false);
this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = this.settings.color; this.layer.context().lineCap="square";
this.layer.context().lineWidth = 2;
this.layer.context().strokeStyle = "#000000";
this.layer.context().stroke(); this.layer.context().stroke();
this.layer.context().lineCap="round";
this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = "#ffffff";
this.layer.context().stroke();
this.layer.context().closePath(); this.layer.context().closePath();
this.pointer_last = position; this.pointer_last = position;
@ -257,52 +266,16 @@ function Cursor(rune)
this.layer.context().moveTo(position.x - radius,position.y - radius); this.layer.context().moveTo(position.x - radius,position.y - radius);
this.layer.context().lineTo(position.x - radius,position.y + radius); this.layer.context().lineTo(position.x - radius,position.y + radius);
this.layer.context().lineCap="round"; this.layer.context().lineCap="square";
this.layer.context().lineWidth = 1; this.layer.context().lineWidth = 2;
this.layer.context().strokeStyle = this.settings.color; this.layer.context().strokeStyle = "#000000";
this.layer.context().stroke(); this.layer.context().stroke();
this.layer.context().closePath();
this.pointer_last = position;
}
this.draw_pointer = function(position,size = 1)
{
if(!this.is_inside){ return; }
if(!this.layer){ this.create_layer(); }
this.pointer_last = this.pointer_last ? this.pointer_last : position;
this.layer.context().beginPath();
this.layer.context().moveTo(this.pointer_last.x,this.pointer_last.y);
this.layer.context().lineTo(position.x,position.y);
this.layer.context().lineCap="round";
this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = this.settings.color;
this.layer.context().stroke();
this.layer.context().closePath();
this.layer.context().beginPath();
this.layer.context().arc(position.x, position.y, 0.5, 0, 2 * Math.PI, false);
this.layer.context().fillStyle = this.settings.color;
this.layer.context().fill();
this.layer.context().closePath();
this.layer.context().beginPath();
this.layer.context().moveTo(position.x + 2,position.y);
this.layer.context().lineTo(position.x + 5,position.y);
this.layer.context().moveTo(position.x,position.y + 2);
this.layer.context().lineTo(position.x,position.y + 5);
this.layer.context().moveTo(position.x - 2,position.y);
this.layer.context().lineTo(position.x - 5,position.y);
this.layer.context().moveTo(position.x,position.y - 2);
this.layer.context().lineTo(position.x,position.y - 5);
this.layer.context().lineCap="round"; this.layer.context().lineCap="round";
this.layer.context().lineWidth = 1; this.layer.context().lineWidth = 1;
this.layer.context().strokeStyle = this.settings.color; this.layer.context().strokeStyle = "#ffffff";
this.layer.context().stroke(); this.layer.context().stroke();
this.layer.context().closePath(); this.layer.context().closePath();
this.pointer_last = position; this.pointer_last = position;

View File

@ -53,20 +53,28 @@ function Overlay(rune)
this.context().lineTo(position.x-2,position.y + (rect.height/2)); this.context().lineTo(position.x-2,position.y + (rect.height/2));
// Center // Center
this.context().moveTo(position.x + (rect.width/2) + 3,position.y + (rect.height/2)); var radius = 3;
this.context().lineTo(position.x + (rect.width/2) + 5,position.y + (rect.height/2)); var radius_2 = 4;
this.context().moveTo(position.x + (rect.width/2) - 3,position.y + (rect.height/2)); this.context().moveTo(position.x + (rect.width/2) + radius,position.y + (rect.height/2));
this.context().lineTo(position.x + (rect.width/2) - 5,position.y + (rect.height/2)); this.context().lineTo(position.x + (rect.width/2) + radius_2,position.y + (rect.height/2));
this.context().moveTo(position.x + (rect.width/2) - radius,position.y + (rect.height/2));
this.context().lineTo(position.x + (rect.width/2) - radius_2,position.y + (rect.height/2));
this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) + 3); this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) + radius);
this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) + 5); this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) + radius_2);
this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) - 3); this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) - radius);
this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) - 5); this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) - radius_2);
this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000";
this.context().stroke();
this.context().lineCap="round"; this.context().lineCap="round";
this.context().lineWidth = 1; this.context().lineWidth = 1;
this.context().strokeStyle = ronin.cursor.color; this.context().strokeStyle = "#ffffff";
this.context().stroke(); this.context().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -83,10 +91,16 @@ function Overlay(rune)
this.context().moveTo(position.x,position.y - 2); this.context().moveTo(position.x,position.y - 2);
this.context().lineTo(position.x,position.y - 5); this.context().lineTo(position.x,position.y - 5);
this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000";
this.context().stroke();
this.context().lineCap="round"; this.context().lineCap="round";
this.context().lineWidth = 1; this.context().lineWidth = 1;
this.context().strokeStyle = ronin.cursor.color; this.context().strokeStyle = "#ffffff";
this.context().stroke(); this.context().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -97,10 +111,16 @@ function Overlay(rune)
this.context().moveTo(position.x,position.y); this.context().moveTo(position.x,position.y);
this.context().lineTo(to.x,to.y); this.context().lineTo(to.x,to.y);
this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000";
this.context().stroke();
this.context().lineCap="round"; this.context().lineCap="round";
this.context().lineWidth = 1; this.context().lineWidth = 1;
this.context().strokeStyle = ronin.cursor.color; this.context().strokeStyle = "#ffffff";
this.context().stroke(); this.context().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -108,9 +128,17 @@ function Overlay(rune)
{ {
this.context().beginPath(); this.context().beginPath();
this.context().arc(position.x, position.y, radius, 0, 2 * Math.PI, false); this.context().arc(position.x, position.y, radius, 0, 2 * Math.PI, false);
this.context().lineWidth = 1;
this.context().strokeStyle = "white"; this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000"
this.context().stroke(); this.context().stroke();
this.context().lineCap="round";
this.context().lineWidth = 1;
this.context().strokeStyle = "#ffffff"
this.context().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -127,10 +155,16 @@ function Overlay(rune)
this.context().moveTo(position.x,position.y-(radius-2)); this.context().moveTo(position.x,position.y-(radius-2));
this.context().lineTo(position.x,position.y-radius); this.context().lineTo(position.x,position.y-radius);
this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000"
this.context().stroke();
this.context().lineCap="round"; this.context().lineCap="round";
this.context().lineWidth = 1; this.context().lineWidth = 1;
this.context().strokeStyle = ronin.cursor.color; this.context().strokeStyle = "#ffffff"
this.context().stroke(); this.context().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -141,10 +175,17 @@ function Overlay(rune)
this.context().moveTo(position.x,0); this.context().moveTo(position.x,0);
this.context().lineTo(position.x,ronin.frame.size.height); this.context().lineTo(position.x,ronin.frame.size.height);
this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000"
this.context().stroke();
this.context().lineCap="round"; this.context().lineCap="round";
this.context().lineWidth = 1; this.context().lineWidth = 1;
this.context().strokeStyle = ronin.cursor.color; this.context().strokeStyle = "#ffffff"
this.context().stroke(); this.context().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -155,10 +196,16 @@ function Overlay(rune)
this.context().moveTo(0,position.y); this.context().moveTo(0,position.y);
this.context().lineTo(ronin.frame.size.width,position.y); this.context().lineTo(ronin.frame.size.width,position.y);
this.context().lineCap="square";
this.context().lineWidth = 2;
this.context().strokeStyle = "#000000"
this.context().stroke();
this.context().lineCap="round"; this.context().lineCap="round";
this.context().lineWidth = 1; this.context().lineWidth = 1;
this.context().strokeStyle = ronin.cursor.color; this.context().strokeStyle = "#ffffff"
this.context().stroke(); this.context().stroke();
this.context().closePath(); this.context().closePath();
} }

View File

@ -6,7 +6,7 @@ function Render(rune)
this.add_method(new Method("balance",["color"])); this.add_method(new Method("balance",["color"]));
this.add_method(new Method("stencil",["angle","color"])); this.add_method(new Method("stencil",["angle","color"]));
this.add_method(new Method("chromatic",["float"])); this.add_method(new Method("chromatic",["position","float"]));
this.filters["balance"] = new Filter_Balance(); this.filters["balance"] = new Filter_Balance();
this.filters["grey"] = new Filter_Grey(); this.filters["grey"] = new Filter_Grey();
@ -31,5 +31,7 @@ function Render(rune)
if(preview){ f.preview(cmd); } if(preview){ f.preview(cmd); }
else{ f.render(cmd); } else{ f.render(cmd); }
return "Done.";
} }
} }

View File

@ -89,7 +89,7 @@ function Source(rune)
this.layer.remove(this); this.layer.remove(this);
return 1,"Rendered the "+this.settings.format+" image, quality "+this.settings["quality"].to_f()+"." return 1,"Rendered the "+this.settings.format+" image, "+this.settings.quality+"."
} }
this.help = function(params,preview = false) this.help = function(params,preview = false)

View File

@ -40,7 +40,7 @@ function Terminal(rune)
} }
if(setting){ if(setting){
module.settings[setting].update(command.values()); module.settings[setting].update(command.values());
this.log(new Log(module,setting+" = "+command.values())); this.log(new Log(module,module.settings[setting]));
} }
this.hint_element.innerHTML = ""; this.hint_element.innerHTML = "";
this.input.value = ""; this.input.value = "";