Created
August 26, 2009 00:31
-
-
Save eligrey/175160 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this example script uses a user-submitted script to modify image | |
// data from a canvas in which the user drew art | |
var sandbox = new JSandbox(), | |
userArt = document.getElementById("userArt").getContext("2d"), | |
imageData = userArt.getImageData(0, 0, userArt.width, userArt.height); | |
sandbox.load("user-submitted-script.js", function () { // onload | |
this.eval("doStuffWithImageData(input)", function (modifiedImageData) { | |
userArt.putImageData(modifiedImageData, 0, 0); | |
this.terminate(); | |
sandbox = null; | |
}, imageData); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment