toDataURL() is now synchronous, and works with all nodes, including the stage, layers, groups, and shapes. This also sets things up nicely for node caching. You can now cache anything, including the whole stage, layers, groups, or shapes, manifested as Kinetic Images that were instantiated with data urls

This commit is contained in:
Eric Rowell
2012-07-14 18:10:37 -07:00
parent d62df7ba5c
commit 4692c51c74
11 changed files with 295 additions and 219 deletions

View File

@@ -1468,14 +1468,7 @@ Test.prototype.tests = {
});
Ellipse.on('click', function() {
stage.toDataURL(function(dataUrl) {
/*
* here you can do anything you like with the data url.
* In this tutorial we'll just open the url with the browser
* so that you can see the result as an image
*/
window.open(dataUrl);
});
window.open(stage.toDataURL());
});
layer.add(Ellipse);
@@ -1499,14 +1492,7 @@ Test.prototype.tests = {
});
Ellipse.on('click', function() {
stage.toDataURL(function(dataUrl) {
/*
* here you can do anything you like with the data url.
* In this tutorial we'll just open the url with the browser
* so that you can see the result as an image
*/
window.open(dataUrl);
}, 'image/jpeg', 0);
window.open(stage.toDataURL('image/jpeg', 0));
});
layer.add(Ellipse);
@@ -1530,14 +1516,7 @@ Test.prototype.tests = {
});
Ellipse.on('click', function() {
stage.toDataURL(function(dataUrl) {
/*
* here you can do anything you like with the data url.
* In this tutorial we'll just open the url with the browser
* so that you can see the result as an image
*/
window.open(dataUrl);
}, 'image/jpeg', 1);
window.open(stage.toDataURL('image/jpeg', 1));
});
layer.add(Ellipse);