public void SaveToFile(string s) { mMutex.WaitOne(); try { Bitmap b = new Bitmap(Width, Height, CreateGraphics()); WindowGDI.Initialize(Graphics.FromImage(b)); foreach (GraphicCommand c in mCmds) { WindowGDI.Draw(c); } b.Save(s); } finally { mMutex.ReleaseMutex(); } }
private void GraphWindow_Paint(object sender, PaintEventArgs e) { mMutex.WaitOne(); try { Bitmap b = new Bitmap(Width, Height, CreateGraphics()); WindowGDI.Initialize(Graphics.FromImage(b)); foreach (GraphicCommand c in mCmds) { WindowGDI.Draw(c); } if (Config.gbShowTurtle) { WindowGDI.DrawTurtle(); } // TODO: replace this call with a bit block transfer API call e.Graphics.DrawImageUnscaled(b, 0, 0); } finally { mMutex.ReleaseMutex(); } }