mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 13:54:25 +00:00
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:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user