HTML and CSS Reference
In-Depth Information
to the data returned from toDataURL() . Finally, using the image data as the URL for the
window, we call window.open() . When we do this, a window will pop open, displaying
the actual image created from the canvas (see Figure 3-11 ). You can right-click and save
this image, just like any other image displayed in an HTML page. Pretty cool, eh?
function createImageDataPressed(e) {
var imageDataDisplay = document.getElementById('imageDataDisplay');
imageDataDisplay.value = theCanvas.toDataURL();
window.open(imageDataDisplay.value,"canvasImage","left=0,top=0,width=" +
theCanvas.width + ",height=" + theCanvas.height +
",toolbar=0,resizable=0");
}
Figure 3-11. Canvas exported image with toDataURL()
 
Search WWH ::




Custom Search