phoboslab/Ejecta — pull request #219 by finscn (2013-08-12 03:49:24+00:00)
Title: add canvas.toDataURL method

// support PNG only.
// JPEG doesn't support the alpha channel , it's not commonly used in Game Developing.
// PNG is enough in most cases.

example code
```
var bufferCanvas=document.createElement("canvas");
var bufferContext=bufferCanvas.getContext("2d");
bufferContext.fillStyle="red";

var img=new Image();
img.src="./res/test.png";
img.onload=function(){
bufferCanvas.width=img.width;
bufferCanvas.height=img.height;
bufferContext.drawImage(img,0,0);

var url=bufferCanvas.toDataURL();

console.log(url)

}
```