private static void TryFeather(D2dFloodfillIsland island, int x, int y) { if (x >= 0 && y >= 0 && x < width && y < height) { var i = x + y * width; if (cells[i] == CELL_EMPTY) { cells[i] = CELL_CLAIM; island.AddPixel(x, y); } } else { island.AddPixel(x, y); } }
private static void SpreadTo(int i, int x, int y) { cells[i] = CELL_CLAIM; var spread = default(Spread); if (spreadCount >= spreads.Count) { spread = new Spread(); spreads.Add(spread); } else { spread = spreads[spreadCount]; } spreadCount += 1; spread.i = i; spread.x = x; spread.y = y; currentIsland.AddPixel(x, y); }