void StartSerialSyncCapture() { _fpsStopWatch = Stopwatch.StartNew(); SerialManager.SerialAcknowledged += OnSerialAcknowledged; MatrixFrame.InjestGDIBitmap(ScreenRecorder.ScreenToBitmap(), ScreenRecorder.InterpMode); // Dispatcher.Invoke(() => { FrameToPreview(); }); SerialManager.PushFrame(); }
void OnSerialAcknowledged() { if (SyncSerial == true) { MatrixFrame.InjestGDIBitmap(ScreenRecorder.ScreenToBitmap(), ScreenRecorder.InterpMode); // Dispatcher.Invoke(() => { FrameToPreview(); }); SerialManager.PushFrame(); LocalFPS = SerialFPS = _fpsStopWatch.ElapsedMilliseconds - _localPreviousMillis; _localPreviousMillis = _fpsStopWatch.ElapsedMilliseconds; } }
void PixelDataCallback(Bitmap capturedBitmap) { frame.InjestGDIBitmap(capturedBitmap); if (frame.ContentImage != null) { frame.ContentImage.Freeze(); Dispatcher.Invoke(() => { UpdateContentImage(); }); } Dispatcher.Invoke(() => { UpdatePreview(); }); sm.SerialSendFrame(frame); GC.Collect(); }
void PixelDataCallback(Bitmap capturedBitmap) { LocalFPS = _fpsStopWatch.ElapsedMilliseconds - _localPreviousMillis; _localPreviousMillis = _fpsStopWatch.ElapsedMilliseconds; MatrixFrame.InjestGDIBitmap(capturedBitmap, ScreenRecorder.InterpMode); // Dispatcher.Invoke(() => { FrameToPreview(); }); if (SerialManager.PushFrame()) { SerialFPS = _fpsStopWatch.ElapsedMilliseconds - _serialPreviousMillis; _serialPreviousMillis = _fpsStopWatch.ElapsedMilliseconds; } //GC.Collect(); }