Browse Source

Fix floating point comparison.

Former-commit-id: 07e46b47420a5f8d951fa42d67e8773d37e3ca6c
Former-commit-id: 759ab68a95a18a31a5a53458a21a7b3cc24b5f40
Former-commit-id: ba4905924bac7bd9ac751eafc4c2322a96c88d05
af/merge-core
James Jackson-South 10 years ago
parent
commit
9b41224ebc
  1. 10
      src/ImageProcessor/Common/Helpers/ImageMaths.cs

10
src/ImageProcessor/Common/Helpers/ImageMaths.cs

@ -216,19 +216,19 @@ namespace ImageProcessor
switch (channel)
{
case RgbaComponent.R:
delegateFunc = (imageBase, x, y, b) => imageBase[x, y].R != b;
delegateFunc = (imageBase, x, y, b) => Math.Abs(imageBase[x, y].R - b) > Epsilon;
break;
case RgbaComponent.G:
delegateFunc = (imageBase, x, y, b) => imageBase[x, y].G != b;
delegateFunc = (imageBase, x, y, b) => Math.Abs(imageBase[x, y].G - b) > Epsilon;
break;
case RgbaComponent.A:
delegateFunc = (imageBase, x, y, b) => imageBase[x, y].A != b;
delegateFunc = (imageBase, x, y, b) => Math.Abs(imageBase[x, y].A - b) > Epsilon;
break;
default:
delegateFunc = (imageBase, x, y, b) => imageBase[x, y].B != b;
delegateFunc = (imageBase, x, y, b) => Math.Abs(imageBase[x, y].B - b) > Epsilon;
break;
}
@ -240,8 +240,6 @@ namespace ImageProcessor
{
if (delegateFunc(imageBase, x, y, componentValue))
{
var c = imageBase[x, y];
return y;
}
}

Loading…
Cancel
Save