static void SaveMatrixAsImage(TurmiteMatrix matrix) { Bitmap bitmap = new Bitmap(matrix.GetLength(), matrix.GetLength()); for (int i = 0; i < matrix.GetLength(); i++) for (int k = 0; k < matrix.GetLength(); k++) bitmap.SetPixel(i, k, matrix.GetCellColor(i, k)); Console.WriteLine(GetNewImageFileName()); bitmap.Save(GetNewImageFileName(),System.Drawing.Imaging.ImageFormat.Bmp); }
private void DrawMatrix(TurmiteMatrix matrix) { SolidBrush myBrush = new SolidBrush(System.Drawing.Color.White); for (int i = 0; i < matrix.GetLength(); i++) { for (int k = 0; k < matrix.GetLength(); k++) { Color cellColor = matrix.GetCellColor(i, k); myBrush.Color = cellColor; if (myBrush.Color != Color.Black) canvas.FillRectangle(myBrush, new Rectangle(i * SCALE, k * SCALE, SCALE, SCALE)); } } myBrush.Dispose(); }