SurfaceImageSource SurfaceImageSource SurfaceImageSource Class

Provides Microsoft DirectX shared surfaces to draw into and then composes the bits into app content.

Syntax

Declaration

public class SurfaceImageSourcepublic class SurfaceImageSourcePublic Class SurfaceImageSource

Inheritance Hierarchy

Remarks

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.

Constructors summary

Initializes a new instance of the SurfaceImageSource class, specifying the size of the drawing area.

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 isOpaque=true if SurfaceImageSource should not support transparency; this can increase performance.

Constructors

  • SurfaceImageSource(System.Int32,System.Int32)
    SurfaceImageSource(System.Int32,System.Int32)
    SurfaceImageSource(System.Int32,System.Int32)
    SurfaceImageSource(System.Int32,System.Int32)

    Initializes a new instance of the SurfaceImageSource class, specifying the size of the drawing area.

    public SurfaceImageSource(System.Int32 pixelWidth,System.Int32 pixelHeight)public SurfaceImageSource(System.Int32 pixelWidth,System.Int32 pixelHeight)Public Function SurfaceImageSource(pixelWidth As System.Int32,pixelHeight As System.Int32) As

    Parameters

    • pixelWidth
      System.Int32
      System.Int32
      System.Int32

      Width of the drawing area in pixels.

    • pixelHeight
      System.Int32
      System.Int32
      System.Int32

      Height of the drawing area in pixels.

  • SurfaceImageSource(System.Int32,System.Int32,System.Boolean)
    SurfaceImageSource(System.Int32,System.Int32,System.Boolean)
    SurfaceImageSource(System.Int32,System.Int32,System.Boolean)
    SurfaceImageSource(System.Int32,System.Int32,System.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 isOpaque=true if SurfaceImageSource should not support transparency; this can increase performance.

    public SurfaceImageSource(System.Int32 pixelWidth,System.Int32 pixelHeight,System.Boolean isOpaque)public SurfaceImageSource(System.Int32 pixelWidth,System.Int32 pixelHeight,System.Boolean isOpaque)Public Function SurfaceImageSource(pixelWidth As System.Int32,pixelHeight As System.Int32,isOpaque As System.Boolean) As

    Parameters

    • pixelWidth
      System.Int32
      System.Int32
      System.Int32

      Width of the drawing area in pixels.

    • pixelHeight
      System.Int32
      System.Int32
      System.Int32

      Height of the drawing area in pixels.

    • isOpaque
      System.Boolean
      System.Boolean
      System.Boolean

      true if the area should render opaque. false to render with possible alpha transparency. A value of true can provide a performance benefit if the content is not transparent.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ComposableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.Xaml.Media.Imaging.dll