CanvasSwapChain Class |
Namespace: Microsoft.Graphics.Canvas
public sealed class CanvasSwapChain : IDisposable, ICanvasResourceCreatorWithDpi, ICanvasResourceCreator
The CanvasSwapChain type exposes the following members.
Name | Description | |
---|---|---|
CanvasSwapChain(ICanvasResourceCreatorWithDpi, Size) | Initializes a new instance of the CanvasSwapChain class, with the specified size. | |
CanvasSwapChain(ICanvasResourceCreatorWithDpi, Single, Single) | Initializes a new instance of the CanvasSwapChain class, with the specified width and height. | |
CanvasSwapChain(ICanvasResourceCreator, Single, Single, Single) | Initializes a new instance of the CanvasSwapChain class with the specified width, height, and dpi. | |
CanvasSwapChain(ICanvasResourceCreator, Single, Single, Single, DirectXPixelFormat, Int32, CanvasAlphaMode) | Initializes a new instance of the CanvasSwapChain class with the options specified. |
Name | Description | |
---|---|---|
AlphaMode | Gets the alpha mode associated with this CanvasSwapChain. | |
BufferCount | Gets the number of buffers that comprise this CanvasSwapChain. | |
Device | Gets the device associated with this CanvasSwapChain. | |
Dpi | Gets the dots-per-inch (DPI) of this swap chain. | |
Format | Gets the pixel format associated with this CanvasSwapChain. | |
Rotation | Rotates the swap chain. | |
Size | Gets the size of the swap chain, in device independent pixels (DIPs). | |
SizeInPixels | Gets the size of the swap chain, in pixels. | |
SourceSize | Specifies that only a subregion of the swap chain should be displayed. | |
TransformMatrix | Specifies a transform matrix that will be applied to the swap chain upon the next present. |
Name | Description | |
---|---|---|
ConvertDipsToPixels | Converts units from device independent pixels (DIPs) to physical pixels based on the DPI of this swap chain. | |
ConvertPixelsToDips | Converts units from physical pixels to device independent pixels (DIPs) based on the DPI of this swap chain. | |
CreateDrawingSession | Creates a drawing session that will draw onto this CanvasSwapChain. | |
CreateForCoreWindow(ICanvasResourceCreator, CoreWindow, Single) | Initializes a new instance of a CanvasSwapChain, suitable for use with CoreWindow. | |
CreateForCoreWindow(ICanvasResourceCreator, CoreWindow, Single, Single, Single, DirectXPixelFormat, Int32) | Initializes a new instance of a CanvasSwapChain, suitable for use with CoreWindow. | |
Dispose | Releases all resources used by the CanvasSwapChain. | |
Present | Presents a rendered image. | |
Present(Int32) | Presents a rendered image, using the specified sync interval. | |
ResizeBuffers(Size) | Changes the CanvasSwapChain's back buffer size. | |
ResizeBuffers(Single, Single) | Changes the CanvasSwapChain's back buffer size. | |
ResizeBuffers(Single, Single, Single) | Changes the CanvasSwapChain's back buffer size, and DPI. | |
ResizeBuffers(Single, Single, Single, DirectXPixelFormat, Int32) | Changes the CanvasSwapChain's back buffer size, DPI, pixel format, and number of buffers. | |
WaitForVerticalBlank | Waits until the next vertical blank occurs on the display. |
Like a bitmap, a swap chain has a fixed with and height, and stores 2D information. Underlying this, however, it may consist of multiple buffers. For more information about native swap chains, see the documentation on IDXGISwapChain.
Two types of CanvasSwapChain are supported: composition and CoreWindow.
Composition swap chains are constructed via CanvasSwapChain Overload and are suitable for use in XAML apps. These swap chains can be displayed using CanvasSwapChainPanel. CanvasAnimatedControl uses a composition swap chain internally.
var swapChain = new CanvasSwapChain(device, width, height, dpi); swapChainPanel.SwapChain = swapChain; // ... later ... swapChain.Present();
CoreWindow swap chains are constructed via CreateForCoreWindow Overload and can only be used in non-XAML apps (also known as "DirectX apps".)
var swapChain = CanvasSwapChain.CreateForCoreWindow(device, coreWindow, dpi); // ... later ... swapChain.Present();
When using Direct2D interop, this Win2D class corresponds to the DXGI interface IDXGISwapChain1.