Пример #1
0
        /// <summary>
        /// Search for a given color within a color list, scanning 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>
        /// <param name="forceCapture"></param>
        /// <returns></returns>
        static public Point FullScreenPixelSearch(List <int> colors, int variation, bool forceCapture = false)
        {
            if (!TakeFullScreenCapture(forceCapture))
            {
                return(Point.Empty);
            }
            SetColors(colors);
            int xRef = 0, yRef = 0;

            if (FastFindWrapper.ColorsPixelSearch(ref xRef, ref yRef, DEFAULT_SNAP) == 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.
        /// </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, List <int> colors, int variation)
        {
            if (!TakeCustomCapture(left, top, right, bottom))
            {
                return(Point.Empty);
            }
            SetColors(colors);
            int xRef = (left + right) / 2, yRef = (top + bottom) / 2;

            if (FastFindWrapper.ColorsPixelSearch(ref xRef, ref yRef, CUSTOM_SNAP) == 0)
            {
                return(Point.Empty);
            }
            return(new Point(xRef, yRef));
        }