canvas-color
Advanced tools
Comparing version 2.0.4 to 2.0.5
{ | ||
"name": "canvas-color", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "color", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -29,2 +29,11 @@ ;(function(root, factory) { | ||
function getBase64(img) { | ||
var canvas = document.createElement('canvas'); | ||
canvas.height = img.height; | ||
canvas.width = img.width; | ||
var ctx=canvas.getContext('2d'); | ||
ctx.drawImage(img, 0, 0); | ||
return canvas.toDataURL(); | ||
} | ||
CanvasColor.prototype.init = function() { | ||
@@ -36,3 +45,2 @@ var that = this; | ||
canvas.height = this.size; | ||
document.body.appendChild(canvas); | ||
var context = canvas.getContext('2d'); | ||
@@ -46,5 +54,4 @@ var img = new Image(); | ||
var res = that.getRGB(data, that.size, that.size); | ||
res.imgData = img.src; | ||
res.imgData = getBase64(img); | ||
that.onSuccess(res); | ||
canvas.parentNode.removeChild(canvas); | ||
}; | ||
@@ -51,0 +58,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4638
115