IDirect3DSurface 接口
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
这表示 IDXGISurface,可用于在需要交换 IDXGISurface 引用Windows 运行时组件之间进行互操作。
public interface class IDirect3DSurface : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(200581446, 5057, 18068, 190, 227, 122, 191, 21, 234, 245, 134)]
struct IDirect3DSurface : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(200581446, 5057, 18068, 190, 227, 122, 191, 21, 234, 245, 134)]
public interface IDirect3DSurface : System.IDisposable
Public Interface IDirect3DSurface
Implements IDisposable
- 属性
- 实现
Windows 要求
设备系列 |
Windows 10 (在 10.0.10240.0 中引入)
|
API contract |
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)
|
示例
// Create a new Windows Console Application (C++/WinRT) project, and
// replace the contents of `pch.h` and `main.cpp` source code files with the code below.
// Be aware that the code below omits the details of obtaining a WinRT Direct3DSurface in
// the first segment of code, and obtaining a native DirectX surface in the second segment.
// The code shows only how to perform the conversion between the two.
// pch.h
#pragma once
#include <d3d11_4.h>
#include <Windows.Graphics.DirectX.Direct3D11.interop.h>
#include <unknwn.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Graphics.DirectX.Direct3D11.h>
// main.cpp
#include "pch.h"
int main()
{
winrt::init_apartment();
// To get the native DirectX surface that is wrapped by a Direct3DSurface.
winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface d3dSurface /* = ... */;
winrt::com_ptr<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess> dxgiInterfaceAccess{
d3dSurface.as<::Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess>()
};
winrt::com_ptr<::IDXGISurface> nativeSurface;
winrt::check_hresult(dxgiInterfaceAccess->GetInterface(
__uuidof(nativeSurface),
nativeSurface.put_void()));
// To create a new Direct3DSurface object wrapping a native DirectX surface.
winrt::com_ptr<::IDXGISurface> nativeSurface2 /* = ... */;
winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface d3dSurface2{ nullptr };
winrt::check_hresult(::CreateDirect3D11SurfaceFromDXGISurface(
nativeSurface2.get(),
reinterpret_cast<::IInspectable**>(winrt::put_abi(d3dSurface2))));
}
// First include the necessary headers and namespaces.
#include <Windows.Graphics.DirectX.Direct3D11.interop.h>
#include <dxgi.h>
using namespace Windows::Graphics::DirectX::Direct3D11;
using namespace Microsoft::WRL;
// To get the native DirectX surface that is wrapped by a Direct3DSurface.
IDirect3DSurface^ d3dSurface = ...;
ComPtr<IDXGISurface> nativeSurface;
HRESULT hr = GetDXGIInterface(d3dSurface, nativeSurface.GetAddressOf());
// To create a new Direct3DSurface object wrapping a native DirectX surface.
ComPtr<IDXGISurface> nativeSurface = ...;
IDirect3DSurface^ d3dSurface = CreateDirect3DSurface(nativeSurface.Get());
注解
若要在 IDirect3DSurface 和 IDXGISurface 之间来回移动,请使用 CreateDirect3DSurface 和 GetDXGIInterface (IDirect3DSurface^,DXGI_TYPE**) 函数。
属性
Description |
获取描述图 面的 Direct3DSurfaceDescription 。 |
方法
Dispose() |
执行与释放或重置非托管资源关联的应用程序定义的任务。 |