示例#1
0
        public Point? Find(Bitmap findBitmap)
        {
            if (sourceImage == null || findBitmap == null)
                throw new InvalidOperationException();

            findImage = new ImageData(findBitmap);
            findImage.PixelMaskTable(this.Variation);

            var SourceRect = new Rectangle(new Point(0, 0), sourceImage.Size);
            var NeedleRect = new Rectangle(new Point(0, 0), findImage.Size);

            if (SourceRect.Contains(NeedleRect))
            {
                resets = new ManualResetEvent[threads];
                Provider = new CoordProvider(sourceImage.Size, NeedleRect.Size);

                for (int i = 0; i < threads; i++)
                {
                    resets[i] = new ManualResetEvent(false);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(ImageWorker), i);
                }

                WaitHandle.WaitAll(resets);

                return match;
            }

            return null;
        }
示例#2
0
        public Point? Find(Color ColorId)
        {
            findPixel = new PixelMask(ColorId, Variation);

            resets = new ManualResetEvent[threads];
            Provider = new CoordProvider(sourceImage.Size, new Size(1, 1));

            for (int i = 0; i < threads; i++)
            {
                resets[i] = new ManualResetEvent(false);
                ThreadPool.QueueUserWorkItem(new WaitCallback(PixelWorker), i);
            }

            WaitHandle.WaitAll(resets);
            return match;
        }