Skip to content

Instantly share code, notes, and snippets.

@cbosco
Created August 22, 2011 17:21
Show Gist options
  • Save cbosco/1162950 to your computer and use it in GitHub Desktop.
Save cbosco/1162950 to your computer and use it in GitHub Desktop.
Filter pattern
var filter = function(dest, src, w, h, filterSpecific) {
// HIPSTERHASHIT!
};
var canvas = document.getElementById('canvas');
var width = canvas.width;
var height = canvas.height;
var cc = canvas.getContext('2d');
var oldCanvasData = cc.getImageData(0, 0, c.width, c.height);
var newCanvasData = cc.createImageData(width, height); // blank
var val = 100; // whatever...
filter(newCanvasData.data,
oldCanvasData.data,
oldCanvasData.width,
oldCanvasData.height,
val);
cc.putImageData(this.newCanvasData, 0, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment