コード例 #1
0
        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.IFrame buffer)
        {
            if (display.Dispatcher.CheckAccess())
            {
                DoUpdateImage(buffer);
            }
            else
            {
                if ((_updateImageOperation != null) && (_updateImageOperation.Status != System.Windows.Threading.DispatcherOperationStatus.Completed))
                {
                    return;
                }

                _updateImageOperation = display.Dispatcher.BeginInvoke(new Action(() => DoUpdateImage(buffer)));
            }
        }
コード例 #3
0
        private static void CopyImageBufferToWritableBitmap(TIS.Imaging.IFrame buffer, WriteableBitmap wb)
        {
            var rect = new Int32Rect(0, 0, buffer.FrameType.Width, buffer.FrameType.Height);

            wb.WritePixels(rect, buffer.GetIntPtr(), buffer.FrameType.BufferSize, buffer.FrameType.BytesPerLine);
        }