/// <summary> /// This Outputs the PixelBuffer data to the panel. /// </summary> async Task OutputToPanel(PixelBuffer buffer) { if (_outputing) { return; } _frame++; if (_frame < 20) { return; } _frame = 0; _outputing = true; try { if (_pictureWidth == 0 || _pictureHeight == 0) { _outputing = false; return; } Bitmap display = new Bitmap(_pictureWidth, _pictureHeight); int w = display.Width; int h = display.Height; for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { display.SetPixel(x, y, Color.Black); } } foreach (var node in _nodes) { Color color = getPixelColor(node, buffer); display.SetPixel(node.X, _pictureHeight - node.Y, color); } //display.Save(_showDir + "//virtualdisplay.jpg"); _form.SetDisplayImage(display); } catch (Exception) { } _outputing = false; }