static void ClearBitmap(BitmapCanvas img) { Color c = Color.FromArgb(0); for (int y = 0; y < img.Height; y++) { for (int x = 0; x < img.Width; x++) { img.SetPixel(x, y, c); } } }
private async Task Redraw() { IsRedrawing = true; int w = this.pictureBox1.Width; int h = this.pictureBox1.Height; Fractal = new BitmapCanvas(w, h); Highlight = new BitmapCanvas(w, h); Canvas = new BitmapCanvas(w, h); await Renderer.RenderToCanvas(Fractal, Config); this.pictureBox1.Image = Fractal.Source; IsRedrawing = false; }
static void JoinBitmaps(BitmapCanvas bottom, BitmapCanvas top, BitmapCanvas dest) { int w = Min(bottom.Width, top.Width, dest.Width); int h = Min(bottom.Height, top.Height, dest.Height); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { Color bc = bottom.GetPixel(x, y); Color tc = top.GetPixel(x, y); Color fin = tc.ToArgb() == 0 ? bc : tc; dest.SetPixel(x, y, fin); } } }
static async Task MainCmd() { if (ShouldCreateOrbits) { ProduceOrbits(); } else { var ren = new Render(); var bmp = new BitmapCanvas(Width, Height); var conf = new FracConfig { Escape = 4.0, Plane = Planes.XY, Resolution = Resolution, X = 0.0, Y = 0.0, W = 0.0, Z = 0.0, IterMax = 1000, OffsetX = Width / 2, OffsetY = Height / 2 }; await ren.RenderToCanvas(bmp, conf); bmp.SavePng(FileName + ".png"); } }