Image render
This commit is contained in:
parent
1fd7202893
commit
0b4142b1ad
14
README.md
14
README.md
@ -13,11 +13,11 @@ Ronin is a simple open-source graphic design tool.
|
|||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
### Ports
|
### Ports
|
||||||
- `speed->` *0/50* The cursor speed.
|
- `speed->` **(0/50)** The cursor speed.
|
||||||
- `distance->` *0/9999* The cursor distance.
|
- `distance->` **(0/9999)** The cursor distance.
|
||||||
- `->red->` *0/255* The brush color value(red).
|
- `->red->` **(0/255)** The brush color value(red).
|
||||||
- `->green->` *0/255* The brush color value(green).
|
- `->green->` **(0/255)** The brush color value(green).
|
||||||
- `->blue->` *0/255* The brush color value(blue).
|
- `->blue->` **(0/255)** The brush color value(blue).
|
||||||
|
|
||||||
## eraser
|
## eraser
|
||||||
### Settings
|
### Settings
|
||||||
@ -46,8 +46,8 @@ Ronin is a simple open-source graphic design tool.
|
|||||||
- `stroke:`, no details.
|
- `stroke:`, no details.
|
||||||
|
|
||||||
### Ports
|
### Ports
|
||||||
- `step->` *0/100* The tween line index..
|
- `step->` **(0/100)** The tween line index..
|
||||||
- `->thickness->` *4/100* The tween line thickness..
|
- `->thickness->` **(4/100)** The tween line thickness..
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
@ -14,7 +14,7 @@ function Docs()
|
|||||||
|
|
||||||
dialog.showSaveDialog((fileName) => {
|
dialog.showSaveDialog((fileName) => {
|
||||||
if (fileName === undefined){ return; }
|
if (fileName === undefined){ return; }
|
||||||
fs.writeFile("README.md", str, (err) => {
|
fs.writeFile(fileName+".md", str, (err) => {
|
||||||
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
if(err){ alert("An error ocurred creating the file "+ err.message); return; }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -73,7 +73,7 @@ function Docs()
|
|||||||
for(port_name in ports){
|
for(port_name in ports){
|
||||||
var port = ports[port_name];
|
var port = ports[port_name];
|
||||||
console.log(ports);
|
console.log(ports);
|
||||||
html += "- `"+(port.input ? '->' : '')+""+port.name+""+(port.output ? '->' : '')+"` *"+port.value+"/"+port.max+"* "+port.docs+".\n";
|
html += "- `"+(port.input ? '->' : '')+""+port.name+""+(port.output ? '->' : '')+"` **("+port.value+"/"+port.max+")** "+port.docs+".\n";
|
||||||
}
|
}
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
function IO()
|
function IO()
|
||||||
{
|
{
|
||||||
|
this.render = function()
|
||||||
|
{
|
||||||
|
var fs = require('fs');
|
||||||
|
var img = ronin.render.image();
|
||||||
|
var data = img.replace(/^data:image\/\w+;base64,/, "");
|
||||||
|
var buf = new Buffer(data, 'base64');
|
||||||
|
|
||||||
|
dialog.showSaveDialog((fileName) => {
|
||||||
|
if (fileName === undefined){ return; }
|
||||||
|
fs.writeFile(fileName+'.png', buf);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.drag_over = function(e)
|
this.drag_over = function(e)
|
||||||
{
|
{
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -33,6 +33,11 @@ function Keyboard()
|
|||||||
ronin.render.clear();
|
ronin.render.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(e.key == "r" && (e.ctrlKey || e.metaKey)){
|
||||||
|
e.preventDefault();
|
||||||
|
ronin.io.render();
|
||||||
|
}
|
||||||
|
|
||||||
if(e.key == "H" && (e.ctrlKey || e.metaKey) && e.shiftKey){
|
if(e.key == "H" && (e.ctrlKey || e.metaKey) && e.shiftKey){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ronin.docs.export();
|
ronin.docs.export();
|
||||||
|
@ -35,7 +35,7 @@ function Layer()
|
|||||||
|
|
||||||
this.image = function()
|
this.image = function()
|
||||||
{
|
{
|
||||||
return this.element.toDataURL('image/png');
|
return this.el.toDataURL('image/png');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clear = function()
|
this.clear = function()
|
||||||
|
@ -14,6 +14,7 @@ function Port(host,name,input,output,value,max,docs)
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
var target = this.host.routes[this.name];
|
var target = this.host.routes[this.name];
|
||||||
|
|
||||||
|
if(!this.output){ return; }
|
||||||
if(!target){ console.log("No output for",this.name); return; }
|
if(!target){ console.log("No output for",this.name); return; }
|
||||||
|
|
||||||
this.host.ports[target].write(this.value);
|
this.host.ports[target].write(this.value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user