mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
using SixLabors.ImageSharp.PixelFormats;
|
|
using SixLabors.Primitives;
|
|
|
|
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
|
|
{
|
|
public readonly struct PixelDifference
|
|
{
|
|
public PixelDifference(
|
|
Point position,
|
|
int redDifference,
|
|
int greenDifference,
|
|
int blueDifference,
|
|
int alphaDifference)
|
|
{
|
|
this.Position = position;
|
|
this.RedDifference = redDifference;
|
|
this.GreenDifference = greenDifference;
|
|
this.BlueDifference = blueDifference;
|
|
this.AlphaDifference = alphaDifference;
|
|
}
|
|
|
|
public PixelDifference(Point position, Rgba64 expected, Rgba64 actual)
|
|
: this(position,
|
|
actual.R - expected.R,
|
|
actual.G - expected.G,
|
|
actual.B - expected.B,
|
|
actual.A - expected.A)
|
|
{
|
|
}
|
|
|
|
public Point Position { get; }
|
|
|
|
public int RedDifference { get; }
|
|
public int GreenDifference { get; }
|
|
public int BlueDifference { get; }
|
|
public int AlphaDifference { get; }
|
|
|
|
public override string ToString() =>
|
|
$"[Δ({this.RedDifference},{this.GreenDifference},{this.BlueDifference},{this.AlphaDifference}) @ ({this.Position.X},{this.Position.Y})]";
|
|
}
|
|
}
|