private void DoUpdateImage(TIS.Imaging.IFrame buffer) { int bufferWidth = buffer.FrameType.Width; int bufferHeight = buffer.FrameType.Height; PixelFormat bufferFormat = PixelFormatFromFrameType(buffer.FrameType); if ((_source == null) || (_source.PixelWidth != bufferWidth) || (_source.PixelHeight != bufferHeight) || (_source.Format != bufferFormat)) { _source = CreateBackBuffer(bufferWidth, bufferHeight, bufferFormat); CopyImageBufferToWritableBitmap(buffer, _source); display.Source = _source; } else { CopyImageBufferToWritableBitmap(buffer, _source); } if (_overlayAdorner != null) { _overlayAdorner.InvalidateVisual(); } IsSourceBottomUp = buffer.FrameType.IsBottomUp; UpdateFlip(); }
public void UpdateImage(TIS.Imaging.IFrameQueueBuffer buffer) { int bufferWidth = buffer.FrameType.Width; int bufferHeight = buffer.FrameType.Height; PixelFormat bufferFormat = PixelFormatFromFrameType(buffer.FrameType); display.Dispatcher.Invoke( (Action)(() => { if ((_source == null) || (_source.PixelWidth != bufferWidth) || (_source.PixelHeight != bufferHeight) || (_source.Format != bufferFormat)) { _source = CreateBackBuffer(bufferWidth, bufferHeight, bufferFormat); CopyImageBufferToWritableBitmap(buffer, _source); display.Source = _source; } else { CopyImageBufferToWritableBitmap(buffer, _source); } _overlayAdorner.InvalidateVisual(); IsSourceBottomUp = buffer.FrameType.IsBottomUp; UpdateFlip(); }) ); }
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) { base.OnLostKeyboardFocus(e); _adorner.InvalidateVisual(); }