Browse Source

Added createImageData(ImageData) support

v1.x
Tj Holowaychuk 14 years ago
parent
commit
2334fc859a
  1. 9
      lib/context2d.js

9
lib/context2d.js

@ -469,15 +469,20 @@ Context2d.prototype.getImageData = function(x, y, width, height){
};
/**
* Create `ImageData` with the given dimensions.
* Create `ImageData` with the given dimensions or
* `ImageData` instance for dimensions.
*
* @param {Number} width
* @param {Number|ImageData} width
* @param {Number} height
* @return {ImageData}
* @api public
*/
Context2d.prototype.createImageData = function(width, height){
if (width instanceof ImageData) {
height = width.height;
width = width.width;
}
var arr = new PixelArray(width, height);
return new ImageData(arr);
};
Loading…
Cancel
Save