Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ISurfaceImageSourceNativeWithD2D interface

Provides the implementation of a shared Microsoft DirectX surface which is displayed in a SurfaceImageSource or VirtualSurfaceImageSource.

Members

The ISurfaceImageSourceNativeWithD2D interface inherits from the IUnknown interface. ISurfaceImageSourceNativeWithD2D also has these types of members:

Methods

The ISurfaceImageSourceNativeWithD2D interface has these methods.

MethodDescription
BeginDraw

Initiates an update to the associated SurfaceImageSource or VirtualSurfaceImageSource.

EndDraw

Closes the surface draw operation.

ResumeDraw

Resume the drawing operation.

SetDevice

Sets the DXGI or Direct2D device, created with D3D11_CREATE_DEVICE_BGRA_SUPPORT, that will draw the surface.

SuspendDraw

Suspends the drawing operation.

 

Remarks

The ISurfaceImageSourceNativeWithD2D interface provides the native implementation of the SurfaceImageSource class. To get a pointer to the ISurfaceImageSourceNativeWithD2D interface, you must cast a SurfaceImageSource instance to IInspectable or IUnknown, and call the QueryInterface method.



Microsoft::WRL::ComPtr<ISurfaceImageSourceNativeWithD2D>	m_sisD2DNative;
// ...
IInspectable* sisInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(surfaceImageSource);
sisInspectable->QueryInterface(__uuidof(ISurfaceImageSourceNative), (void **)&m_sisD2DNative)
	

The ISurfaceImageSourceNativeWithD2D interface provides high-performance batched Direct2D drawing, which enables drawing to multiple different SurfaceImageSource or VirtualSurfaceImageSource objects in the same batch, as long as they share the same Direct2D device. Batching can improve performance when updating multiple surfaces at the same time.

The ISurfaceImageSourceNativeWithD2D interface enables drawing to a SurfaceImageSource or VirtualSurfaceImageSource from one or more background threads, which allows high-performance DirectX rendering off the UI thread.

Only call the SetDevice, BeginDraw, and EndDraw methods on ISurfaceImageSourceNativeWithD2D interface, not on the ISurfaceImageSourceNative or IVirtualSurfaceImageSourceNative interfaces.

In order to support batching updates to multiple surfaces to improve performance, you can pass an ID2D1Device to the SetDevice method, instead of an ID3D11Device. The BeginDraw method can then optionally return a shared ID2D1DeviceContext, which the app uses to draw all content for that update.

To draw to the surface from a background thread, you must set any DirectX resources, including the Microsoft Direct3D device, Direct3D device context, Direct2D device, and Direct2D device context, to enable multithreading support.

You can call the BeginDraw, SuspendDraw, and ResumeDraw methods from any background thread to enable high-performance multithreaded drawing.

Always call the EndDraw method on the UI thread in order to synchronize updating the DirectX content with the current XAML UI thread frame. You can call BeginDraw on a background thread, call SuspendDraw when you're done drawing on the background thread, and call EndDraw on the UI thread.

Use SuspendDraw and ResumeDraw to suspend and resume drawing on any background or UI thread.

Handle the SurfaceContentsLost event to determine when you need to recreate content which may be lost if the system resets the GPU.

Requirements

Minimum supported client

Windows 8.1 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 R2 [desktop apps | Windows Store apps]

Header

Windows.ui.xaml.media.dxinterop.h

IDL

Windows.ui.xaml.media.dxinterop.idl

DLL

Windows.UI.Xaml.dll

IID

IID_ISurfaceImageSourceNativeWithD2D is defined as 54298223-41e1-4a41-9c08-02e8256864a1

See also

VirtualSurfaceImageSource
SurfaceImageSource
SurfaceContentsLost
DirectX and XAML interop

 

 

Community Additions

Show:
© 2014 Microsoft. All rights reserved.