Exemplo n.º 1
0
 private void ReleaseRenderer()
 {
     if (this.render != null)
     {
         this.render.Dispose();
         this.render = null;
     }
 }
        public MainWindow()
        {
            InitializeComponent();

            this.timer = new Timer();
            this.timer.Interval = 40;
            this.timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);

            this.d3dSource = new D3DImageSource();
            this.wbSource = new WriteableBitmapSource();

            this.frameIndex = 0;

            try
            {
                this.yuvData = FrameData.LoadData("yv12.dat");

                if (this.wbSource.SetupSurface(this.yuvData.FrameWidth, this.yuvData.FrameHeight, FrameFormat.YV12))
                {
                    this.imageWB.Source = this.wbSource.ImageSource;
                }
                else
                {
                    MessageBox.Show("WriteableBitmapSource不支持该种帧格式:" + FrameFormat.YV12);
                }

                if (this.d3dSource.SetupSurface(this.yuvData.FrameWidth, this.yuvData.FrameHeight, FrameFormat.YV12))
                {
                    this.imageD3D.Source = this.d3dSource.ImageSource;
                }
                else
                {
                    MessageBox.Show("本机显卡不支持该种帧格式:" + FrameFormat.YV12);
                }
            }
            catch
            {
                MessageBox.Show("加载数据文件失败");
            }
        }
Exemplo n.º 3
0
 private void ReleaseRenderer()
 {
     if (this.render != null)
     {
         this.render.Dispose();
         this.render = null;
     }
 }
Exemplo n.º 4
0
        //protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        //{
        //    base.OnRenderSizeChanged(sizeInfo);
        //}

        #endregion

        #region 私有函数

        private void CreateRenderer()
        {
            this.ReleaseRenderer();
            this.render = new D3DImageSource();
        }
Exemplo n.º 5
0
        //protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        //{
        //    base.OnRenderSizeChanged(sizeInfo);
        //}

        #endregion

        #region 私有函数

        private void CreateRenderer()
        {
            this.ReleaseRenderer();
            this.render = new D3DImageSource();
        }