FindNearestX() private static method

private static FindNearestX ( int xStart, int yStart, int yEnd, int xIncrement, IScreenShot screenshot ) : IntPoint
xStart int
yStart int
yEnd int
xIncrement int
screenshot IScreenShot
return IntPoint
Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }