private static FindNearestY ( int xStart, int xEnd, int yStart, int yIncrement, IScreenShot screenshot ) : |
||
xStart | int | |
xEnd | int | |
yStart | int | |
yIncrement | int | |
screenshot | IScreenShot | |
return |
public static IntRect Collapse(IntRect rect, IScreenShot screenshot) { int left = ScreenCoordinates.FindNearestX(rect.Left, rect.Top, rect.Bottom, 1, screenshot).X; int right = ScreenCoordinates.FindNearestX(rect.Right, rect.Top, rect.Bottom, -1, screenshot).X + 1; int top = ScreenCoordinates.FindNearestY(rect.Left, rect.Right, rect.Top, 1, screenshot).Y - 1; int bottom = ScreenCoordinates.FindNearestY(rect.Left, rect.Right, rect.Bottom, -1, screenshot).Y; if (right > left && bottom > top) { return(new IntRect(left, top + 1, right - left, bottom - top)); } return(IntRect.Empty); }
public static IntRect ExpandPoint(IntPoint position, IScreenShot screenshot) { int x = position.X; int y = position.Y; int left = ScreenCoordinates.FindNearestX(x, y - 5, y + 5, -1, screenshot).X + 1; int right = ScreenCoordinates.FindNearestX(x, y - 5, y + 5, 1, screenshot).X; int top = ScreenCoordinates.FindNearestY(x - 5, x + 5, y, -1, screenshot).Y + 1; int bottom = ScreenCoordinates.FindNearestY(x - 5, x + 5, y, 1, screenshot).Y; if (right > left && bottom > top) { return(new IntRect(left, top, right - left, bottom - top)); } return(IntRect.Empty); }