private static Point TopLeftCorner(FlatImage image) { var topLeftCornerFragments = new[] { new FlatImage(OctaneRenderWindow.UpperLeftCorner1), new FlatImage(OctaneRenderWindow.UpperLeftCorner2), new FlatImage(OctaneRenderWindow.UpperLeftCorner3), }; var topLeftCornerX = 0; var topLeftCornerY = 0; foreach (var topLeftCornerFragment in topLeftCornerFragments) { for (var x = 0; x < image.Width - topLeftCornerFragment.Width; x++) { for (var y = 0; y < image.Height - topLeftCornerFragment.Height; y++) { if (image.CompareWithFragmentWithTolerance(topLeftCornerFragment, x, y)) { topLeftCornerX = x + topLeftCornerFragment.Width - 1; topLeftCornerY = y + topLeftCornerFragment.Height - 1; return(new Point(topLeftCornerX, topLeftCornerY)); } } } } return(new Point(0, 0)); }
private static Point BottomRightCorner(FlatImage image) { var bottomRightCornerFragments = new[] { new FlatImage(OctaneRenderWindow.LowerRightCorner1), new FlatImage(OctaneRenderWindow.LowerRightCorner2), }; var bottomRightCornerX = 0; var bottomRightCornerY = 0; foreach (var bottomRightCornerFragment in bottomRightCornerFragments) { for (var x = image.Width - bottomRightCornerFragment.Width - 1; x > 0; x--) { for (var y = 0; y < image.Height - bottomRightCornerFragment.Height; y++) { if (image.CompareWithFragmentWithTolerance(bottomRightCornerFragment, x, y)) { bottomRightCornerX = x; bottomRightCornerY = y; return(new Point(bottomRightCornerX, bottomRightCornerY)); } } } } return(new Point(0, 0)); }