public Picture(Color[,] image, int width, int height) { this.width = width; this.height = height; img = (Color[, ])image.Clone(); infoLayer = new Color[width, height]; }
private void button_save_Click(object sender, EventArgs e) { var form = new PictSaveForm(); if (form.ShowDialog() == DialogResult.OK) { var data = new PictChatData() { Name = form.textBox_name.Text, Data = (Color[, ])Canvas.Clone(), }; userData.PictChats.Add(data); comboBox_pics.Items.Add(data); } }
public int GetConnectedColorsCount(Vector2D square) { var testFloodFiller = new FloodFiller((Color[, ])colors.Clone()); testFloodFiller.SetColor((int)square.X, (int)square.Y, Color.TransparentWhite); return(testFloodFiller.ProcessedCount); }
private void UploadBitmapData() { using (pictureTexture) { bmpMain = new Bitmap(picMain.Width, picMain.Height); bmpAfterConstruction = new Bitmap(picAfterConstruction.Width, picAfterConstruction.Height); bmpAlongConstruction = new Bitmap(picAlongConstruction.Width, picAlongConstruction.Height); using (var g = Graphics.FromImage(bmpMain)) { g.InterpolationMode = InterpolationMode.NearestNeighbor; g.DrawImage(pictureTexture, new Rectangle(Point.Empty, bmpMain.Size)); picMain.Image = bmpMain; } using (var g = Graphics.FromImage(bmpAfterConstruction)) { g.InterpolationMode = InterpolationMode.NearestNeighbor; g.DrawImage(pictureTexture, new Rectangle(Point.Empty, bmpAfterConstruction.Size)); colors = GetColorsFromBitmap(bmpAfterConstruction, picAfterConstruction.Width, picAfterConstruction.Height); } using (var g = Graphics.FromImage(bmpAlongConstruction)) { g.InterpolationMode = InterpolationMode.NearestNeighbor; g.DrawImage(pictureTexture, new Rectangle(Point.Empty, bmpAlongConstruction.Size)); colorsSecondVersion = GetColorsFromBitmap(bmpAlongConstruction, picAlongConstruction.Width, picAlongConstruction.Height); } } bitmapColors = (Color[, ])colors.Clone(); }
public Color[,] FillObject(Color[,] input) { if (perimeterPixels == null) { return(input); } Color[,] output = (Color[, ])input.Clone(); for (int i = 0; i < perimeterListPixels.Count; i++) { int x1 = perimeterListPixels[i].X, y1 = perimeterListPixels[i].Y; for (int j = 0; j < perimeterListPixels.Count; j++) { if (i == j) { continue; } int x2 = perimeterListPixels[j].X, y2 = perimeterListPixels[j].Y; double distance = Math.Sqrt(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2)); double stepXDistance = ((double)(x2 - x1)) / distance; double stepYDistance = ((double)(y2 - y1)) / distance; for (int k = 0; k < distance; k++) { int uv1X = OffsetX + x1 + ((int)Math.Round(stepXDistance * k)); int uv1Y = OffsetY + y1 + ((int)Math.Round(stepYDistance * k)); if (uv1X < 0) // For safety { uv1X = 0; } if (uv1X > output.GetLength(0) - 1) { uv1X = output.GetLength(0) - 1; } if (uv1Y < 0) { uv1Y = 0; } if (uv1Y > output.GetLength(1) - 1) { uv1Y = output.GetLength(1) - 1; } output[uv1X, uv1Y] = Color.Black; } } } return(output); }
internal static Color[,] FlipHorisontally(this Color[,] colors) { Color[,] temp = colors.Clone() as Color[, ]; temp[0, 0] = colors[2, 0]; temp[2, 0] = colors[0, 0]; temp[0, 1] = colors[2, 1]; temp[2, 1] = colors[0, 1]; temp[0, 2] = colors[2, 2]; temp[2, 2] = colors[0, 2]; return(temp); }
public Color[,] ClickGrid(Color[,] Grid, int left, int top) { Color[,] colorArray = (Color[, ])Grid.Clone(); Color color = (Grid[left - 1, top - 1]); Color color2 = (Grid[left, top - 1]); if (((!this.IsCrab(color) && !this.IsJelly(color)) && (!this.IsFish(color) && !this.IsCrab(color2))) && (!this.IsJelly(color2) && !this.IsFish(color2))) { (colorArray[left - 1, top - 1]) = color2; (colorArray[left, top - 1]) = color; } return(colorArray); }
internal static Color[,] RotateClockwise(this Color[,] colors, int turns) { Color[,] ret = colors.Clone() as Color[, ]; for (int i = 0; i < turns; i++) { Color[,] temp = ret.Clone() as Color[, ]; ret[0, 0] = temp[0, 2]; ret[1, 0] = temp[0, 1]; ret[2, 0] = temp[0, 0]; ret[2, 1] = temp[1, 0]; ret[2, 2] = temp[2, 0]; ret[1, 2] = temp[2, 1]; ret[0, 2] = temp[2, 2]; ret[0, 1] = temp[1, 2]; } return(ret); }
public Color[,] Colorize(Color[,] input) { Color[,] output = (Color[, ])input.Clone(); for (int i = -4; i < 5; i++) { for (int j = -4; j < 5; j++) { output[OffsetX + LongestChord.firstPixel.X + i, OffsetY + LongestChord.firstPixel.Y + j] = Color.Red; output[OffsetX + LongestChord.secondPixel.X + i, OffsetY + LongestChord.secondPixel.Y + j] = Color.Orange; output[OffsetX + LongestPerpendicularChord.firstPixel.X + i, OffsetY + LongestPerpendicularChord.firstPixel.Y + j] = Color.Blue; output[OffsetX + LongestPerpendicularChord.secondPixel.X + i, OffsetY + LongestPerpendicularChord.secondPixel.Y + j] = Color.Cyan; } } return(output); }
public static Color[,] ComputeAlgorithmVersion2(Color[,] currentImage, int Kr, int Kg, int Kb, Random random, BackgroundWorker backgroundWorker) { Color[,] image = (Color[, ])currentImage.Clone(); int nR = OrderedHelper.GetClosestN(Kr); int nG = OrderedHelper.GetClosestN(Kg); int nB = OrderedHelper.GetClosestN(Kb); for (int i = 0; i < CONST.bitmapWidth; i++) { for (int j = 0; j < CONST.bitmapHeight; j++) { int r = Values.Round255(OrderedHelper.GetColorForOrdered(currentImage[i, j].R, nR, random, i, j)); int g = Values.Round255(OrderedHelper.GetColorForOrdered(currentImage[i, j].G, nG, random, i, j)); int b = Values.Round255(OrderedHelper.GetColorForOrdered(currentImage[i, j].B, nB, random, i, j)); image[i, j] = Color.FromArgb(r, g, b); } backgroundWorker.ReportProgress((int)((double)(i * 100) / CONST.bitmapWidth)); } return(image); }
public void SimulateMove(IntPtr hwnd) { if (hwnd == IntPtr.Zero) { return; } Bitmap windowBitmap = GetWindowBitmap(hwnd); this.GetBoxColor(windowBitmap, 3, 10, true); Color[,] grid = this.MakeGrid(windowBitmap); Label_0031: if (ClickJelly(hwnd, grid)) { return; } if (!this.ClickFish(hwnd, grid)) { Point bestMove = this.GetBestMove((Color[, ])grid.Clone()); Bitmap bmpClient = GetWindowBitmap(hwnd); Color[,] colorArray = this.MakeGrid(bmpClient); for (int i = 0; i <= 5; i++) { for (int j = 0; j <= 11; j++) { if (!((colorArray[i, j]) == (grid[i, j]))) { grid = (Color[, ])colorArray.Clone(); goto Label_0031; } } } if (this.IsObject((grid[bestMove.X - 1, bestMove.Y - 1]))) { ClickBox(hwnd, bestMove.X, bestMove.Y); } } }
public static Color[,] ComputeAlgorithm(Color[,] currentImage, int K, BackgroundWorker backgroundWorker) { Color[,] image = (Color[, ])currentImage.Clone(); Color[] listOfAvailableColors = Colors.GetAllAvailableColors(currentImage, K, backgroundWorker); Color?[,,] colorsCurrentlyUsed = new Color?[256, 256, 256]; object SyncObject = new object(); object SyncObjectCurrentlyUsed = new object(); double index = 40; Parallel.For(0, CONST.bitmapWidth, i => { for (int j = 0; j < CONST.bitmapHeight; j++) { if (colorsCurrentlyUsed[currentImage[i, j].R, currentImage[i, j].G, currentImage[i, j].B] != null) { image[i, j] = (Color)colorsCurrentlyUsed[currentImage[i, j].R, currentImage[i, j].G, currentImage[i, j].B]; } else { Color color = Colors.GetClosestColor(listOfAvailableColors, currentImage[i, j].R, currentImage[i, j].G, currentImage[i, j].B); image[i, j] = color; lock (SyncObjectCurrentlyUsed) { colorsCurrentlyUsed[currentImage[i, j].R, currentImage[i, j].G, currentImage[i, j].B] = color; } } } lock (SyncObject) { index += (double)60 / CONST.bitmapWidth; backgroundWorker.ReportProgress((int)index); } }); return(image); }
public static Color[,] Stucky(Color[,] currentImage, int Kr, int Kg, int Kb, BackgroundWorker backgroundWorker) { Color[,,] listOfAvailableColors = Colors.GetAllAvailableColors(Kr, Kg, Kb); Color[,] transformedImage = (Color[, ])currentImage.Clone(); for (int j = 0; j < CONST.bitmapHeight; j++) { for (int i = 0; i < CONST.bitmapWidth; i++) { Color oldPixel = transformedImage[i, j]; Color newPixel = Colors.GetClosestColor(listOfAvailableColors, oldPixel); transformedImage[i, j] = newPixel; int redError = oldPixel.R - newPixel.R; int greenError = oldPixel.G - newPixel.G; int blueError = oldPixel.B - newPixel.B; for (int x = StuckyMatrix.x; x <= 2 * StuckyMatrix.x; x++) { for (int y = 0; y <= 2 * StuckyMatrix.y; y++) { if (Index.IsCorrectIndex(i + y - StuckyMatrix.y, j + x - StuckyMatrix.x)) { Color transformingColor = transformedImage[i + y - StuckyMatrix.y, j + x - StuckyMatrix.x]; int r = Values.Round255(transformingColor.R + ((redError * StuckyMatrix.values[x, y]) / StuckyMatrix.division)); int g = Values.Round255(transformingColor.G + ((greenError * StuckyMatrix.values[x, y]) / StuckyMatrix.division)); int b = Values.Round255(transformingColor.B + ((blueError * StuckyMatrix.values[x, y]) / StuckyMatrix.division)); transformedImage[i + y - StuckyMatrix.y, j + x - StuckyMatrix.x] = Color.FromArgb(transformingColor.A, r, g, b); } } } } backgroundWorker.ReportProgress((int)((double)(j + 1) / CONST.bitmapHeight * 100) % 101); } backgroundWorker.ReportProgress(100); return(transformedImage); }
public Color[,] ColorizeVectors(Color[,] input) { if (LongestChord.firstPixel == null || LongestChord.secondPixel == null || LongestPerpendicularChord.firstPixel == null || LongestPerpendicularChord.secondPixel == null) { return(input); } Color[,] output = (Color[, ])input.Clone(); double angle = LongestChord.orientation; double uv1CosAngle = Math.Cos(angle); double uv1SinAngle = Math.Sin(angle); double pAngle = Math.PI / 2; double[] rotationArray = new double[] { Math.Cos(pAngle), -1.0 * Math.Sin(pAngle), Math.Sin(pAngle), Math.Cos(pAngle) }; Matrix <double> rotationMatrix = new DenseMatrix(2, 2, rotationArray); Vector <double> unitVector1 = new DenseVector(new double[] { uv1CosAngle, uv1SinAngle }); Vector <double> unitVector2 = new DenseVector(new double[2]); rotationMatrix.LeftMultiply(unitVector1, unitVector2); double uv2CosAngle = unitVector2[0]; double uv2SinAngle = unitVector2[1]; int lcX = 0; if (uv1CosAngle > 0) { if (LongestChord.firstPixel.X < LongestChord.secondPixel.X) { lcX = LongestChord.firstPixel.X; } else { lcX = LongestChord.secondPixel.X; } } else if (LongestChord.firstPixel.X < LongestChord.secondPixel.X) { lcX = LongestChord.secondPixel.X; } else { lcX = LongestChord.firstPixel.X; } int lcY = 0; if (uv1SinAngle > 0) { if (LongestChord.firstPixel.Y < LongestChord.secondPixel.Y) { lcY = LongestChord.firstPixel.Y; } else { lcY = LongestChord.secondPixel.Y; } } else if (LongestChord.firstPixel.Y < LongestChord.secondPixel.Y) { lcY = LongestChord.secondPixel.Y; } else { lcY = LongestChord.firstPixel.Y; } for (int i = 0; i < LongestChord.distance; i++) { int uv1X = OffsetX + lcX + ((int)Math.Round(uv1CosAngle * i)); int uv1Y = OffsetY + lcY + ((int)Math.Round(uv1SinAngle * i)); output[uv1X, uv1Y] = Color.Red; } int lpcX = 0; if (uv2CosAngle > 0) { if (LongestPerpendicularChord.firstPixel.X < LongestPerpendicularChord.secondPixel.X) { lpcX = LongestPerpendicularChord.firstPixel.X; } else { lpcX = LongestPerpendicularChord.secondPixel.X; } } else if (LongestPerpendicularChord.firstPixel.X < LongestPerpendicularChord.secondPixel.X) { lpcX = LongestPerpendicularChord.secondPixel.X; } else { lpcX = LongestPerpendicularChord.firstPixel.X; } int lpcY = 0; if (uv2SinAngle > 0) { if (LongestPerpendicularChord.firstPixel.Y < LongestPerpendicularChord.secondPixel.Y) { lpcY = LongestPerpendicularChord.firstPixel.Y; } else { lpcY = LongestPerpendicularChord.secondPixel.Y; } } else if (LongestPerpendicularChord.firstPixel.Y < LongestPerpendicularChord.secondPixel.Y) { lpcY = LongestPerpendicularChord.secondPixel.Y; } else { lpcY = LongestPerpendicularChord.firstPixel.Y; } for (int i = 0; i < LongestPerpendicularChord.distance; i++) { int uv2X = OffsetX + lpcX + ((int)Math.Round(uv2CosAngle * i)); int uv2Y = OffsetY + lpcY + ((int)Math.Round(uv2SinAngle * i)); output[uv2X, uv2Y] = Color.Blue; } return(output); }
private void button2_Click(object sender, EventArgs e) { if (radioButton2.Checked) { if (radioButton3.Checked) pictureBox1.Image = (Bitmap)orig.Clone(); input = toColorMatr(btp); output = (Color[,])input.Clone(); median_filter(); input = (Color[,])output.Clone(); sobel(); input = (Color[,])output.Clone(); MaxFilter(); btp = toBitmap(output, pictureBox1.Image.Width, pictureBox1.Image.Height); pictureBox1.Image = btp; pictureBox1.Update(); if (radioButton3.Checked) orig = (Bitmap)pictureBox1.Image.Clone(); } else if (radioButton1.Checked) { pictureBox2.Visible = true; pictureBox2.Location = new Point(10, 10); Bitmap newIm = bicubic(); pictureBox2.Width = newIm.Width; pictureBox2.Height = newIm.Height; pictureBox2.Image = newIm; pictureBox2.Update(); } button3.Enabled = true; }
public Point GetBestMove(Color[,] Grid) { int[] numArray2; Random random = new Random(); Point point = new Point(0, 0); int num = 0; int[] gridB = new int[0]; bool flag = false; for (int i = 1; i <= 12; i++) { for (int k = 1; k <= 5; k++) { if (this.CanClick((Color[, ])Grid.Clone(), k, i)) { numArray2 = this.FindBestMove(Grid, k, i); if (this.CompareGrid(numArray2, gridB)) { gridB = numArray2; point = new Point(k, i); num = 1; flag = true; } } } } for (int j = 1; j <= 12; j++) { for (int m = 1; m <= 5; m++) { for (int n = 1; n <= 12; n++) { for (int num7 = 1; num7 <= 5; num7++) { if (this.CanClick((Color[, ])Grid.Clone(), m, j)) { numArray2 = this.FindBestMove(this.ClickGrid((Color[, ])Grid.Clone(), m, j), num7, n); if ((gridB.Length == 0) && (numArray2.Length >= 1)) { gridB = numArray2; point = new Point(m, j); num = 2; flag = true; } else if (num == 1) { if (numArray2.Length > gridB.Length) { gridB = numArray2; point = new Point(m, j); num = 2; flag = true; } } else if ((num == 2) && this.CompareGrid(numArray2, gridB)) { gridB = numArray2; point = new Point(m, j); num = 2; flag = true; } } } } } } if (!flag) { point = new Point(random.Next(1, 6), random.Next(1, 12)); } return(point); }
public Board(Color[,] colors) { Colors = (Color[, ])colors.Clone(); FireBoardUpdated(); }
public void detectObjects(Color[,] imageToReturn) { Color[,] imageToProcess = (Color[, ])imageToReturn.Clone(); for (int x = 0; x < imageToProcess.GetLength(0); x++) { for (int y = 0; y < imageToProcess.GetLength(1); y++) { if (imageToProcess[x, y].ToArgb() == Color.Black.ToArgb()) { Queue <ListPixel> queue = new Queue <ListPixel>(); List <ListPixel> pixelList = new List <ListPixel>(); bool[,] initialCanGo = new bool[3, 3]; for (int v = 0; v < 3; v++) { for (int w = 0; w < 3; w++) { int testX = x + v - 1; int testY = y + w - 1; if ((v != 1 || w != 1) && testX > 0 && testX < imageToProcess.GetLength(0) && testY > 0 && testY < imageToProcess.GetLength(1)) { if (imageToProcess[testX, testY].ToArgb() == Color.Black.ToArgb()) { initialCanGo[v, w] = true; } else { initialCanGo[v, w] = false; } } else { initialCanGo[v, w] = false; } } } queue.Enqueue(new ListPixel(x, y, initialCanGo)); while (queue.Count > 0) { ListPixel queueItem = queue.Dequeue(); int newX = queueItem.X; int newY = queueItem.Y; if (imageToProcess[newX, newY].ToArgb() == Color.Black.ToArgb()) { imageToProcess[newX, newY] = Color.White; pixelList.Add(queueItem); for (int v = 0; v < 3; v++) { for (int w = 0; w < 3; w++) { if (queueItem.CanGo[v, w]) { queueItem.CanGo[v, w] = false; bool[,] canGo = new bool[3, 3]; for (int n = 0; n < 3; n++) { for (int m = 0; m < 3; m++) { int nextX = newX + v + n - 2; int nextY = newY + w + m - 2; if ((n != 1 || m != 1) && nextX > 0 && nextX < imageToProcess.GetLength(0) && nextY > 0 && nextY < imageToProcess.GetLength(1)) { if (imageToProcess[nextX, nextY].ToArgb() == Color.Black.ToArgb()) { canGo[n, m] = true; // Need to check if there is already a path queued to it } else { canGo[n, m] = false; } } else { canGo[n, m] = false; } } } queue.Enqueue(new ListPixel(newX + v - 1, newY + w - 1, canGo)); } } } } } detectedObjects.Add(new ImageObject(pixelList)); } } } // Filter 'empty' objects int sumStack = 0; foreach (var imageObject in detectedObjects) { sumStack += imageObject.Area; } int sumPixels = 0; foreach (var pixel in imageToReturn) { sumPixels += pixel.ToArgb() == Color.Black.ToArgb() ? 1 : 0; } Console.WriteLine("Sum of stack sizes: {0}", sumStack); Console.WriteLine("Sum of black pixels: {0}", sumPixels); }
public Color[,] GetColorsClone() { return(Colors.Clone() as Color[, ]); }
/// <summary> /// 返回颜色数组的浅表副本 /// </summary> public Color[,] GetColorsClone() { return((Color[, ])Colors.Clone()); }
public int[] FindBestMove(Color[,] Grid, int ClickX, int ClickY) { int[] array = new int[0]; if (this.CanClick(Grid, ClickX, ClickY)) { Color[,] colorArray = this.ClickGrid((Color[, ])Grid.Clone(), ClickX, ClickY); if (((ClickX <= 3) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX + 1, ClickY - 1]))) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX + 2, ClickY - 1]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; } if (((ClickX >= 3) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 2, ClickY - 1]))) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 3, ClickY - 1]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; } if ((((ClickY <= 10) && (ClickY >= 3)) && (((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY])) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY + 1])))) && (((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 2])) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 3])))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 5; } else if ((((ClickY <= 11) && (ClickY >= 3)) && (((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY])) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 2])))) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 3]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 4; } else if ((((ClickY <= 10) && (ClickY >= 2)) && (((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY])) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY + 1])))) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 2]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 4; } else if (((ClickY <= 11) && (ClickY >= 2)) && (((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY])) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 2])))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; } else if (((ClickY >= 3) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 2]))) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY - 3]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; } else if (((ClickY <= 10) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY]))) && ((colorArray[ClickX - 1, ClickY - 1]) == (colorArray[ClickX - 1, ClickY + 1]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; } if ((((ClickY <= 10) && (ClickY >= 3)) && (((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY])) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY + 1])))) && (((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 2])) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 3])))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 5; return(array); } if ((((ClickY <= 11) && (ClickY >= 3)) && (((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY])) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 2])))) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 3]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 4; return(array); } if ((((ClickY <= 10) && (ClickY >= 2)) && (((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY])) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY + 1])))) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 2]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 4; return(array); } if (((ClickY <= 11) && (ClickY >= 2)) && (((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY])) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 2])))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; return(array); } if (((ClickY >= 3) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 2]))) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY - 3]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; return(array); } if (((ClickY <= 10) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY]))) && ((colorArray[ClickX, ClickY - 1]) == (colorArray[ClickX, ClickY + 1]))) { Array.Resize <int>(ref array, array.Length + 1); array[array.Length - 1] = 3; } } return(array); }