canvasImage.js
function(width, height){
    var canvas = document.createElement("canvas");
    canvas.width = width;
    canvas.height = height;
    var context = canvas.getContext("2d");
    var imageData = context.getImageData(0, 0, width, height);
    var buffer = new ArrayBuffer(width*height*4);
    var buffer8 = new Uint8ClampedArray(buffer);
    var buffer32 = new Uint32Array(buffer);
    return {
      canvas: canvas,
      context: context,
      width: width,
      height: height,
      imageData: imageData,
      buffer8: buffer8,
      buffer32: buffer32};
  }
function(width, height){
    var canvas = document.createElement("canvas");
    canvas.width = width;
    canvas.height = height;
    var context = canvas.getContext("2d");
    var imageData = context.getImageData(0, 0, width, height);
    var buffer = new ArrayBuffer(width*height*4);
    var buffer8 = new Uint8ClampedArray(buffer);
    var buffer32 = new Uint32Array(buffer);
    return {
      canvas: canvas,
      context: context,
      width: width,
      height: height,
      imageData: imageData,
      buffer8: buffer8,
      buffer32: buffer32};
  }
function ( width , height ) { var canvas = document . createElement ( "canvas" ) ; canvas . width = width ; canvas . height = height ; var context = canvas . getContext ( "2d" ) ; var imageData = context . getImageData ( 0 , 0 , width , height ) ; var buffer = new ArrayBuffer ( width * height * 4 ) ; var buffer8 = new Uint8ClampedArray ( buffer ) ; var buffer32 = new Uint32Array ( buffer ) ; return { canvas : canvas , context : context , width : width , height : height , imageData : imageData , buffer8 : buffer8 , buffer32 : buffer32 } ; }
Uint, Uint -> CanvasImage
Uint Uint - > CanvasImage