FIX: issue #9 - applying css attribs over img ruins the palette function. FIX: issue #3- update README regarding createPalette return val

This commit is contained in:
Lokesh Dhakar
2012-04-23 17:13:05 -04:00
parent 5cf0e60319
commit 79d4c70838
4 changed files with 169 additions and 147 deletions

View File

@@ -28,17 +28,17 @@
*/
var CanvasImage = function (image) {
// If jquery object is passed in, get html element
this.imgEl = (image.jquery) ? image[0] : image;
imgEl = (image.jquery) ? image[0] : image;
this.canvas = document.createElement('canvas');
this.context = this.canvas.getContext('2d');
document.body.appendChild(this.canvas);
this.width = this.canvas.width = $(this.imgEl).width();
this.height = this.canvas.height = $(this.imgEl).height();
this.width = this.canvas.width = imgEl.width;
this.height = this.canvas.height = imgEl.height;
this.context.drawImage(this.imgEl, 0, 0);
this.context.drawImage(imgEl, 0, 0, this.width, this.height);
};
CanvasImage.prototype.clear = function () {