Image Source Class
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides Microsoft DirectX shared surfaces to draw into and then composes the bits into app content.
Equivalent WinUI class: Microsoft.UI.Xaml.Media.Imaging.SurfaceImageSource.
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)] /// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] /// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] class SurfaceImageSource : ImageSource
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)] [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] public class SurfaceImageSource : ImageSource
Public Class SurfaceImageSource Inherits ImageSource
Windows 10 (introduced in 10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced in v1.0)
This class is a display area for Microsoft DirectX interoperation whereby Microsoft DirectX content can draw within an otherwise XAML-composed UI. One consideration for a SurfaceImageSource is that while it can incorporate the Microsoft DirectX content, the rendering cycle is still XAML-centric. Too many Microsoft DirectX draws in this render model can result in latency or poor responsiveness. If you anticipate a high number of redraws for your Microsoft DirectX content, and you intend to display that content full-screen without any surrounding XAML UI, you probably should use the SwapChainBackgroundPanel technique instead. Another alternative for non-full-screen content is to render to a separate scratch surface on a background thread, then copy its contents to the surface returned from BeginDraw on the UI thread. This can unblock the UI thread at the cost of higher memory usage.
For more info on how to draw to a SurfaceImageSource, including sample code, see DirectX and XAML interop.
This class has additional API, but those API are for Microsoft DirectX interoperation and are not part of the general app programming model otherwise described in this documentation. For example, from the Microsoft DirectX side, you can call BeginDraw.
SurfaceImageSource derived classes
SurfaceImageSource is the parent class for VirtualSurfaceImageSource.
Initializes a new instance of the SurfaceImageSource class, specifying the size of the drawing area.
|SurfaceImageSource(Int32, Int32, Boolean)||
Initializes a new instance of the SurfaceImageSource class, specifying the size of the drawing area, and whether opacity is expected to be always full opacity. Use this with
Gets the CoreDispatcher that this object is associated with. The CoreDispatcher represents a facility that can access the DependencyObject on the UI thread even if the code is initiated by a non-UI thread.
Equivalent WinUI property: Microsoft.UI.Xaml.DependencyObject.Dispatcher.(Inherited from DependencyObject)