Browse Source

Fix floating point comparison.

Former-commit-id: 6fc6b632b9503961177e54900865a5dc5c2fd88a
Former-commit-id: c92c380815264dd35829d99a1f044fe15d51b9b4
Former-commit-id: 6b989a97e50c19a701f46e4809cb83ea50e2f9b3
af/merge-core
James Jackson-South 11 years ago
parent
commit
11589eff7f
  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