public VideoPanel() { var lTuple = D3D9Image.createD3D9Image(); if (lTuple != null) { this.imageSource = lTuple.Item1; this.sharedResource = lTuple.Item2; this.sharedHandle = sharedResource.SharedHandle; } if (this.imageSource != null) { var image = new System.Windows.Controls.Image(); image.Stretch = System.Windows.Media.Stretch.Uniform; image.Source = this.imageSource; this.AddChild(image); // To greatly reduce flickering we're only going to AddDirtyRect // when WPF is rendering. System.Windows.Media.CompositionTarget.Rendering += this.CompositionTargetRendering; } }
static public System.Tuple <D3DImage, Direct3DSurface9> createD3D9Image() { D3D9Image lImageSource = new D3D9Image(); return(lImageSource.init() ? System.Tuple.Create <D3DImage, Direct3DSurface9>(lImageSource, lImageSource.surface) : null); }