Skip to content

Instantly share code, notes, and snippets.

@jfsiii
Created October 14, 2010 13:32
Show Gist options
  • Save jfsiii/626165 to your computer and use it in GitHub Desktop.
Save jfsiii/626165 to your computer and use it in GitHub Desktop.
/*
* Moved forgeImage and hasSameOrigin to canvasFromImage. Still cleaning up the internal structure, but it works now.
*
* Killed renderClosePixels and reorganized closePixelate.
*
* What do you think?
*/
function closePixelate( img, renderOptions ) {
var onCanvasReady = function ( canvas, image ) {
var parent = image.parentNode,
ctx = canvas.getContext('2d');
canvas.className = image.className;
canvas.id = image.id;
// perform the Close pixelations
processData( ctx, renderOptions, image.width, image.height );
// add canvas and remove image
image.parentNode.replaceChild( canvas, image );
};
canvasFromImage( img, onCanvasReady );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment