예제 #1
0
        /// <summary>
        /// Search for a given color within all the client area of BS. Faster then PixelSearch, as it doesn't do a new capture each time.
        /// </summary>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="right"></param>
        /// <param name="bottom"></param>
        /// <param name="color1"></param>
        /// <param name="variation"></param>
        /// <returns></returns>
        static public Point FullScreenPixelSearch(Color color1, int variation, bool forceCapture = false)
        {
            if (!TakeFullScreenCapture(forceCapture))
            {
                return(Point.Empty);
            }
            int nbMatchMin = 1, xRef = 0, yRef = 0;

            if (FastFindWrapper.GenericColorSearch(1, ref nbMatchMin, ref xRef, ref yRef, color1.ToArgb(), variation, DEFAULT_SNAP) == 0 || nbMatchMin == 0)
            {
                return(Point.Empty);
            }
            return(new Point(xRef, yRef));
        }
예제 #2
0
        /// <summary>
        /// Beware: do not use this function extensively, at it does a screen shot each time. Better use higher level functions when needed.
        /// </summary>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="right"></param>
        /// <param name="bottom"></param>
        /// <param name="color1"></param>
        /// <param name="variation"></param>
        /// <param name="forceCapture"></param>
        /// <returns></returns>
        static public Point PixelSearch(int left, int top, int right, int bottom, Color color1, int variation)
        {
            if (!TakeCustomCapture(left, top, right, bottom))
            {
                return(Point.Empty);
            }
            int nbMatchMin = 1, xRef = (left + right) / 2, yRef = (top + bottom) / 2;

            if (FastFindWrapper.GenericColorSearch(1, ref nbMatchMin, ref xRef, ref yRef, color1.ToArgb(), variation, CUSTOM_SNAP) == 0 || nbMatchMin == 0)
            {
                return(Point.Empty);
            }
            return(new Point(xRef, yRef));
        }