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())); }
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."); } }
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)); } } }
private void Move(int regionNumber, ScanInfo info) { regions[regionNumber].Add(info); }
public void SetScanInfo(int x, int y, ScanInfo scanInfo) { infos[x, y] = scanInfo; }