共用方式為


D2D1CreateFactory 函式 (d2d1.h)

建立可用來建立 Direct2D 資源的 Factory 物件。

語法

HRESULT D2D1CreateFactory(
  [in]           D2D1_FACTORY_TYPE          factoryType,
  [in]           REFIID                     riid,
  [in, optional] const D2D1_FACTORY_OPTIONS *pFactoryOptions,
  [out]          void                       **ppIFactory
);

參數

[in] factoryType

類型: D2D1_FACTORY_TYPE

處理站的執行緒模型及其建立的資源。

[in] riid

類型: REFIID

使用 __uuidof(ID2D1Factory) 取得之ID2D1Factory 之 IID的參考。

[in, optional] pFactoryOptions

類型:const D2D1_FACTORY_OPTIONS*

提供給偵錯層的詳細資料層級。

[out] ppIFactory

類型: void**

當這個方法傳回時,會包含新處理站指標的位址。

傳回值

類型: HRESULT

如果函式成功,它會 傳回S_OK。 否則,它會傳回 HRESULT錯誤碼

備註

ID2D1Factory介面提供 Direct2D 的起點。 一般而言,從 Factory 物件的單一實例建立的物件可以與其他從該實例建立的資源搭配使用,但不能與其他處理站實例所建立的資源搭配使用。

規格需求

   
最低支援的用戶端 適用于 Windows Vista 的 Windows 7、Windows Vista SP2 和平臺更新 [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 d2d1.h
程式庫 D2d1.lib
Dll D2d1.dll

另請參閱

Direct2D API 概觀