Example #1
0
        private bool DetermineBoundary(int cx, int cy)
        {
            ScanInfo left   = maskSelector.Invoke(cx - 1, cy, cx, cy, source);
            ScanInfo right  = maskSelector.Invoke(cx + 1, cy, cx, cy, source);
            ScanInfo top    = maskSelector.Invoke(cx, cy - 1, cx, cy, source);
            ScanInfo bottom = maskSelector.Invoke(cx, cy + 1, cx, cy, source);
            ScanInfo center = maskSelector.Invoke(cx, cy, cx, cy, source);

            return(center.Color.IsWhite() &&
                   (!left.Color.IsWhite() ||
                    !right.Color.IsWhite() ||
                    !top.Color.IsWhite() ||
                    !bottom.Color.IsWhite()));
        }
Example #2
0
        private void AddRegionAndMove(int regionNumber, ScanInfo info)
        {
            List <ScanInfo> region = new List <ScanInfo> {
                info
            };

            if (!regions.ContainsKey(regionNumber))
            {
                regions.Add(regionNumber, region);
            }
            else
            {
                Log.Current.Error("Region with specified number has already been added.");
            }
        }
Example #3
0
        public LockableBitmapWrapper(LockableBitmap source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            this.source = source;

            infos = new ScanInfo[source.Width, source.Height];

            for (int y = 0; y < source.Height; y++)
            {
                for (int x = 0; x < source.Width; x++)
                {
                    infos[x, y] = new ScanInfo(source.GetPixel(x, y), new Point(x, y));
                }
            }
        }
Example #4
0
 private void Move(int regionNumber, ScanInfo info)
 {
     regions[regionNumber].Add(info);
 }
Example #5
0
 public void SetScanInfo(int x, int y, ScanInfo scanInfo)
 {
     infos[x, y] = scanInfo;
 }