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();
        }
示例#2
0
        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();
            })
                );
        }
示例#3
0
 protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
 {
     base.OnLostKeyboardFocus(e);
     _adorner.InvalidateVisual();
 }