private void PrepareBuffer() { ClearBuffer(); _image = new Bitmap(_size.Width, _size.Height, PixelFormat.Format16bppRgb565); _graphics = Graphics.FromImage(_image); _drawingGraphics = DrawingGraphics.FromGraphicsAndRect(_graphics, _image, new Rectangle(0, 0, _image.Width, _image.Height)); }
private void ClearBuffer() { if (_graphics != null) { _graphics.Dispose(); _graphics = null; } if (_image != null) { _image.Dispose(); _image = null; } _drawingGraphics = null; }
public static DrawingGraphics FromPaintEventArgs(PaintEventArgs e, Image canvasImage) { return(DrawingGraphics.FromGraphicsAndRect(e.Graphics, canvasImage, e.ClipRectangle)); }