本文整理汇总了C#中Factory.CreateDxgiSurfaceRenderTarget方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.CreateDxgiSurfaceRenderTarget方法的具体用法?C# Factory.CreateDxgiSurfaceRenderTarget怎么用?C# Factory.CreateDxgiSurfaceRenderTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory.CreateDxgiSurfaceRenderTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderTarget
/// <summary>
/// Creates a render target that draws to a DirectX Graphics Infrastructure (DXGI) surface.
/// </summary>
/// <remarks>
/// To write to a Direct3D surface, you obtain an <see cref="SharpDX.DXGI.Surface"/> and pass it to the {{CreateDxgiSurfaceRenderTarget}} method to create a DXGI surface render target; you can then use the DXGI surface render target to draw 2-D content to the DXGI surface. A DXGI surface render target is a type of <see cref="SharpDX.Direct2D1.RenderTarget"/>. Like other Direct2D render targets, you can use it to create resources and issue drawing commands. The DXGI surface render target and the DXGI surface must use the same DXGI format. If you specify the {{DXGI_FORMAT_UNKOWN}} format when you create the render target, it will automatically use the surface's format.The DXGI surface render target does not perform DXGI surface synchronization. To work with Direct2D, the Direct3D device that provides the <see cref="SharpDX.DXGI.Surface"/> must be created with the D3D10_CREATE_DEVICE_BGRA_SUPPORT flag.For more information about creating and using DXGI surface render targets, see the {{Direct2D and Direct3D Interoperability Overview}}.When you create a render target and hardware acceleration is available, you allocate resources on the computer's GPU. By creating a render target once and retaining it as long as possible, you gain performance benefits. Your application should create render targets once and hold onto them for the life of the application or until the render target's {{EndDraw}} method returns the {{D2DERR_RECREATE_TARGET}} error. When you receive this error, you need to recreate the render target (and any resources it created).
/// </remarks>
/// <param name="factory">an instance of <see cref = "SharpDX.Direct2D1.Factory" /></param>
/// <param name="dxgiSurface">The DXGI surface to bind this render target to</param>
/// <param name="properties">The rendering mode, pixel format, remoting options, DPI information, and the minimum DirectX support required for hardware rendering. For information about supported pixel formats, see {{Supported Pixel Formats and Alpha Modes}}.</param>
public RenderTarget(Factory factory, Surface dxgiSurface, RenderTargetProperties properties)
: base(IntPtr.Zero)
{
factory.CreateDxgiSurfaceRenderTarget(dxgiSurface, ref properties, this);
}