Browse Source

Merge branch 'kamilbielawski-feature/62-output-diff-portion-from-inputs'

pull/112/head
james.cryer 7 years ago
parent
commit
c43c1adb3f
  1. 4
      demoassets/main.js
  2. 2
      index.html
  3. 14
      resemble.js

4
demoassets/main.js

@ -179,9 +179,9 @@ $(function(){
resembleControl.repaint();
}
else
if($this.is('#outputDiff')){
if($this.is('#diffOnly')){
resemble.outputSettings({
outputDiff: true
errorType: 'diffOnly'
});
resembleControl.repaint();
}

2
index.html

@ -119,7 +119,7 @@
<button class="btn" id="movement">Movement</button>
<button class="btn" id="flatDifferenceIntensity">Flat with diff intensity</button>
<button class="btn" id="movementDifferenceIntensity">Movement with diff intensity</button>
<button class="btn" id="outputDiff">Diff portion from the input</button>
<button class="btn" id="diffOnly">Diff portion from the input</button>
</div>
<br/>
<br/>

14
resemble.js

@ -67,7 +67,7 @@ URL: https://github.com/Huddle/Resemble.js
px[offset + 2] = ((1 - ratio) * (d2.b * (errorPixelColor.blue / 255)) + ratio * errorPixelColor.blue);
px[offset + 3] = d2.a;
},
copySecondImage: function (px, offset, d1, d2) {
diffOnly: function (px, offset, d1, d2) {
px[offset] = d2.r;
px[offset + 1] = d2.g;
px[offset + 2] = d2.b;
@ -76,10 +76,10 @@ URL: https://github.com/Huddle/Resemble.js
};
var errorPixel = errorPixelTransform.flat;
var errorType;
var boundingBox;
var largeImageThreshold = 1200;
var useCrossOrigin = true;
var outputDiff = false;
var document = typeof window != "undefined" ? window.document : {
createElement: function() {
// This will work as long as only createElement is used on window.document
@ -374,7 +374,7 @@ URL: https://github.com/Huddle/Resemble.js
}
function copyPixel(px, offset, data){
if (outputDiff) {
if (errorType === 'diffOnly') {
return;
}
@ -385,7 +385,7 @@ URL: https://github.com/Huddle/Resemble.js
}
function copyGrayScalePixel(px, offset, data){
if (outputDiff) {
if (errorType === 'diffOnly') {
return;
}
@ -739,6 +739,7 @@ URL: https://github.com/Huddle/Resemble.js
if(options.errorType && errorPixelTransform[options.errorType] ){
errorPixel = errorPixelTransform[options.errorType];
errorType = options.errorType;
}
if(options.errorPixel && typeof options.errorPixel === "function") {
@ -759,11 +760,6 @@ URL: https://github.com/Huddle/Resemble.js
boundingBox = options.boundingBox;
}
if (options.outputDiff) {
outputDiff = options.outputDiff;
errorPixel = errorPixelTransform.copySecondImage;
}
return this;
};

Loading…
Cancel
Save