Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an a image comparer #137

Merged
merged 1 commit into from
Aug 30, 2022
Merged

Add an a image comparer #137

merged 1 commit into from
Aug 30, 2022

Conversation

mattleibow
Copy link
Contributor

Description of Change

Add an API to generate image diffs. This is pretty basic with just a difference being used in each channel, but is surprisingly simple and accurate.

Bugs Fixed

None.

API Changes

public static class SKPixelComparer
{
	public static SKPixelComparisonResult Compare(SKBitmap first, SKBitmap second);
	public static SKPixelComparisonResult Compare(SKPixmap first, SKPixmap second);
	public static SKPixelComparisonResult Compare(SKImage first, SKImage second);
	public static SKPixelComparisonResult Compare(SKBitmap first, SKBitmap second, SKBitmap mask);
	public static SKPixelComparisonResult Compare(SKPixmap first, SKPixmap second, SKPixmap mask);
	public static SKPixelComparisonResult Compare(SKImage first, SKImage second, SKImage mask);
	public static SKImage GenerateDifferenceMask(SKBitmap first, SKBitmap second);
	public static SKImage GenerateDifferenceMask(SKPixmap first, SKPixmap second);
	public static SKImage GenerateDifferenceMask(SKImage first, SKImage second);
}
public class SKPixelComparisonResult
{
	public SKPixelComparisonResult(int totalPixels, int errorPixelCount, int absoluteError);
	public int TotalPixels { get; }
	public int ErrorPixelCount { get; }
	public double ErrorPixelPercentage { get; }
	public int AbsoluteError { get; }
}

Behavioral Changes

None. All new APIs.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation

@mattleibow mattleibow merged commit 71b9352 into main Aug 30, 2022
@mattleibow mattleibow deleted the dev/image-compare branch August 30, 2022 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant