Browse Source

Resolves bug address by PR #70. Removes defensive CORS from e6dab9aaf0 and optimisation a1a41fc526. Works for me.

gh-pages
james.cryer 9 years ago
parent
commit
e50ea2a7db
  1. 3
      demoassets/main.js
  2. 3
      index.html
  3. 29
      resemble.js

3
demoassets/main.js

@ -108,6 +108,9 @@ $(function(){
resembleControl.ignoreNothing();
}
else
if($this.is('#less')){
resembleControl.ignoreLess();
}
if($this.is('#colors')){
resembleControl.ignoreColors();
}

3
index.html

@ -89,7 +89,8 @@
<br/>
<div class="btn-group buttons" style="display:none">
<button class="btn active" id="raw">Ignore nothing</button>
<button class="btn" id="raw">Ignore nothing</button>
<button class="btn active" id="less">Ignore less</button>
<button class="btn" id="colors">Ignore colors</button>
<button class="btn" id="antialising">Ignore antialiasing</button>
</div>

29
resemble.js

@ -148,17 +148,9 @@ URL: https://github.com/Huddle/Resemble.js
function loadImageData( fileData, callback ){
var fileReader;
var hiddenImage = new Image();
if (!(typeof fileData === 'string'
&& fileData.length > 6
&& fileData.charAt(4)===':'
&& fileData.charAt(5)!=='/'
)) {
if (httpRegex.test(fileData) && !documentDomainRegex.test(fileData)) {
hiddenImage.setAttribute('crossorigin', 'anonymous');
}
}
hiddenImage.setAttribute('crossorigin', 'anonymous');
hiddenImage.onerror = function () {
hiddenImage.onerror = null; //fixes pollution between calls
images.push({ error : "Image load error."});
@ -622,6 +614,21 @@ URL: https://github.com/Huddle/Resemble.js
if(hasMethod) { param(); }
return self;
},
ignoreLess: function(){
tolerance.red = 16;
tolerance.green = 16;
tolerance.blue = 16;
tolerance.alpha = 16;
tolerance.minBrightness = 16;
tolerance.maxBrightness = 240;
ignoreAntialiasing = false;
ignoreColors = false;
if(hasMethod) { param(); }
return self;
},
ignoreAntialiasing: function(){
tolerance.red = 32;

Loading…
Cancel
Save