Skip to content

Instantly share code, notes, and snippets.

@mmiliaus
Created December 24, 2011 21:23
Show Gist options
  • Save mmiliaus/1518386 to your computer and use it in GitHub Desktop.
Save mmiliaus/1518386 to your computer and use it in GitHub Desktop.
cold JS cuts
canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d");
canvas.className = "myClass";
canvas.id = "myId";
canvas.width = image.width;
canvas.height = image.height;
ctx.drawImage(image, 0, 0);
pixelData = ctx.getImageData(0, 0, image.width, image.height);
var yourNamespace = {
foo: function() {
},
bar: function() {
}
};
...
yourNamespace.foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment