File save is working again.
This commit is contained in:
parent
8a74bcb3ab
commit
5a3ae0e7c8
@ -55,48 +55,6 @@ function Commander(element,element_input)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.hide();
|
this.hide();
|
||||||
|
|
||||||
/*
|
|
||||||
var parts = command;
|
|
||||||
|
|
||||||
// Brush
|
|
||||||
if(parts[0] == "&"){
|
|
||||||
parts.shift();
|
|
||||||
brush.settings(parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pointers
|
|
||||||
if(parts[0] == ">"){
|
|
||||||
parts.shift();
|
|
||||||
brush.add(parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save
|
|
||||||
if(parts[0] == "$"){
|
|
||||||
var d=canvas.toDataURL("image/png");
|
|
||||||
var w=window.open('about:blank','image from canvas');
|
|
||||||
w.document.write("<title>"+parts[1]+"</title><img src='"+d+"' alt='from canvas'/>");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load
|
|
||||||
if(parts[0] == "/"){
|
|
||||||
parts.shift();
|
|
||||||
ronin.load_image(parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill
|
|
||||||
if(parts[0] == "*"){
|
|
||||||
parts.shift();
|
|
||||||
ronin.fill(parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Guides
|
|
||||||
if(parts[0] == "|"){
|
|
||||||
parts.shift();
|
|
||||||
ronin.add_guide(parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.passive = function(cmd_array)
|
this.passive = function(cmd_array)
|
||||||
@ -134,15 +92,5 @@ function Commander(element,element_input)
|
|||||||
ronin.filter.passive(cmd);
|
ronin.filter.passive(cmd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
if(parts[0] == "/"){
|
|
||||||
parts.shift();
|
|
||||||
parts.shift();
|
|
||||||
ronin.guide(parts);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,9 +2,21 @@ function File()
|
|||||||
{
|
{
|
||||||
Module.call(this);
|
Module.call(this);
|
||||||
|
|
||||||
this.active = function()
|
this.active = function(cmd)
|
||||||
{
|
{
|
||||||
ronin.overlay.clear();
|
ronin.overlay.clear();
|
||||||
|
|
||||||
|
if(!cmd.position()){ return; }
|
||||||
|
if(!cmd.rect()){ return; }
|
||||||
|
|
||||||
|
var position = cmd.position() ? cmd.position() : new Position();
|
||||||
|
|
||||||
|
base_image = new Image();
|
||||||
|
base_image.src = cmd.path();
|
||||||
|
base_image.onload = function(){
|
||||||
|
position.normalize(cmd.rect());
|
||||||
|
context.drawImage(base_image, position.x, position.y, cmd.rect().width, cmd.rect().height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.passive = function(cmd)
|
this.passive = function(cmd)
|
||||||
@ -20,4 +32,11 @@ function File()
|
|||||||
ronin.overlay.draw(position);
|
ronin.overlay.draw(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.save = function(cmd)
|
||||||
|
{
|
||||||
|
var d=canvas.toDataURL("image/png");
|
||||||
|
var w=window.open('about:blank','image from canvas');
|
||||||
|
w.document.write("<title>"+(cmd.cmd_array[0] ? cmd.cmd_array[0] : "Untitled")+"</title><img src='"+d+"' alt='from canvas'/>");
|
||||||
|
}
|
||||||
}
|
}
|
@ -6,25 +6,6 @@ function Ronin()
|
|||||||
this.brush = new Brush();
|
this.brush = new Brush();
|
||||||
this.file = new File();
|
this.file = new File();
|
||||||
|
|
||||||
this.load_image = function(p)
|
|
||||||
{
|
|
||||||
base_image = new Image();
|
|
||||||
base_image.src = p[0]; // media/logo.png
|
|
||||||
base_image.onload = function(){
|
|
||||||
|
|
||||||
var rec_w = parseFloat(p[3]);
|
|
||||||
var rec_h = parseFloat(p[4]);
|
|
||||||
var pos_x = parseFloat(p[1]);
|
|
||||||
var pos_y = parseFloat(p[2]);
|
|
||||||
|
|
||||||
pos_x = pos_x < 0 ? canvas.width - Math.abs(pos_x) - rec_w : pos_x;
|
|
||||||
pos_y = pos_y < 0 ? canvas.height - Math.abs(pos_y) - rec_h : pos_y;
|
|
||||||
|
|
||||||
context.drawImage(base_image, pos_x, pos_y, rec_w, rec_h);
|
|
||||||
}
|
|
||||||
this.draw_guides();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fill = function(p)
|
this.fill = function(p)
|
||||||
{
|
{
|
||||||
cvSave = canvas.toDataURL("image/png");
|
cvSave = canvas.toDataURL("image/png");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user